tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Problems with UVM pagefaults

On 10/01/13 18:05, Manuel Bouyer wrote:
> On Thu, Jan 10, 2013 at 05:41:38PM +0100, Roger Pau Monné wrote:
>> [...]
>> That's how is done in Linux, and that was my first attempt to implement
>> this device under NetBSD. However, I've also found problems with this
>> implementation. In d_mmap you have to return physical addresses, the
>> problem with that is that Xen has physical addresses and machine
>> addresses, and there's a mapping between physical and machine addresses
>> (physical addresses are used as a translation to machine addresses, so
>> the OS thinks memory is contiguous, when it is not).
>> When returning physical addresses from the d_mmap handler I've found
>> that the memory system extracts the machine address behind that physical
>> address and tries to assign that machine address to a VA in the calling
>> process virtual memory. This did not work, because the machine address
>> behind the physical address returned in the handler doesn't belong to
>> the same domain, so trying to map this to a different VA in userspace is
>> not allowed (Xen only allows this by using a set of specific hypercalls,
>> as you can see in gntmap_grant_ref).
> Can't your ioctl work in the same way as IOCTL_PRIVCMD_MMAP ?
> Reading quickly the code, I think this one works with machine adresses and
> its onw fault handler, and doesn't deal with physical addresses at all.
> I think this is what you need.

Yes, I think it could work that way, I just wanted to avoid doing that
for performance reasons. Having to issue a hypercall to set up each page
when we could set them all with a single hypercall is not really optimal.

Home | Main Index | Thread Index | Old Index