On 09/01/13 00:02, Cherry G. Mathew wrote: > Hi Roger, > > I've got two immediate thoughts:
Hello Cherry, Thanks for the feedback > > On 9 January 2013 00:46, Roger Pau Monné <[email protected]> wrote: > >> This device works by passing a memory region previously allocated with >> mmap(NULL, size, prot, MAP_ANON | MAP_SHARED, -1, 0). This region is > > i) wire down the mapping with MAP_WIRED > > This will prevent it from being paged in/out and thus pagefaulting on access. This was a mistake from my previous email, I already allocate the memory using MAP_WIRED. I've also tried uvm_map_pageable with new_pageable = FALSE on the memory region, it all ends up with the same result. > ... > >> So far I've been able to get the ptes, pass them to Xen and stablish the >> mapping. Writing to that memory area from userspace seems to work fine >> (using pread), but the problem comes when the userspace program executes >> something like: >> >> pwrite(fd, buf,...) > > ii) If this is a xen specific page aliasing issue (where a writeable > page is disallowed because it points to RO pagetables mappings of > domains), perhaps that's nothing to do with UVM ? Yes, page is RO, but I assume NetBSD will not try to write to that memory region if what I'm doing is a pwrite, it is supposed to only read from that memory region and write to the fd. On the other hand, preads to granted memory pages seems to work ok.
