Am I correct in thinking that the use of the VM_FOREIGN flag, plus
the use of vm_private_data to store an array of struct page pointers,
enables the pages to be mapped into user space using get_user_pages()
(which is called by make_pages_present(), which is called by
do_mmap_pgoff())? Or is it the call to vm_insert_page()?

Yes, VM_FOREIGN was added to allow get_user_pages to sort out where
the granted page was mapped in kernel and to identify the underlying
machine mapping.  As blktap uses zero-copy, this was necessary for aio
to map down appropriately and to arrange DMA directly to the guest
pages.  The Linux virtual memory code has churned a bunch since I
wrote that, so there may now be a better approach than the
dual-mapping and the special case in get_user_pages() to resolve them
-- then again, maybe not. ;)

I really like the early cleanup hook in your patches to cleanly unmap
any outstanding granted pages before zapping the range on vm area
destruction.  It's something that I've been wanting to do for a while
-- very stability-adding. ;)


Xen-ppc-devel mailing list

Reply via email to