veerasena reddy
2011-Aug-03 13:56 UTC
[Xen-devel] Pinning a DomU Guest data page from Hypervisor
Hi, I have a DomU Guest (PVHVM) running a customized PV network driver. To increase the network IO performance I would like to try providing the address of the Guest pages directly to the network device without involving dom0. For this i need to convert the GMFN of the page to MFN in hypervisor and pin the page. I could map the device BAR to hypervisor and write the Guest addresses to device. But I couldn''t get how to Pin the Guest pages. I looked into code "xen/arch/x86/mm.c", do_mmuext_op() which was invoking xsm_memory_pin_page() only for L1 to L4 page table type pages. Can i use the same API to pin data pages? Could anybody please advice how can I pin a Guest data page from hypervisor. Any APIs or sequence of operations to be done on MFN of the guest page? Thanks & Regards, VSR. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Pasi Kärkkäinen
2011-Aug-03 17:09 UTC
Re: [Xen-devel] Pinning a DomU Guest data page from Hypervisor
On Wed, Aug 03, 2011 at 07:26:47PM +0530, veerasena reddy wrote:> Hi, > I have a DomU Guest (PVHVM) running a customized PV network driver. To > increase the network IO performance I would like to try providing the > address of the Guest pages directly to the network device without > involving dom0.Hmm.. can''t you use IOMMU PCI passthru? http://wiki.xen.org/xenwiki/XenPCIpassthrough -- Pasi> For this i need to convert the GMFN of the page to MFN in hypervisor and > pin the page. I could map the device BAR to hypervisor and write the Guest > addresses to device. But I couldn''t get how to Pin the Guest pages. > I looked into code "xen/arch/x86/mm.c", do_mmuext_op() which was > invoking xsm_memory_pin_page() only for L1 to L4 page table type pages. > Can i use the same API to pin data pages? > Could anybody please advice how can I pin a Guest data page from > hypervisor. Any APIs or sequence of operations to be done on MFN of the > guest page? > Thanks & Regards, > VSR.> _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Tim Deegan
2011-Aug-03 17:16 UTC
Re: [Xen-devel] Pinning a DomU Guest data page from Hypervisor
Hi, At 19:26 +0530 on 03 Aug (1312399607), veerasena reddy wrote:> I looked into code "xen/arch/x86/mm.c", do_mmuext_op() which was > invoking xsm_memory_pin_page() only for L1 to L4 page table type pages. Can > i use the same API to pin data pages? > > Could anybody please advice how can I pin a Guest data page from hypervisor. > Any APIs or sequence of operations to be done on MFN of the guest page?What exactly do you mean by "pin"? If you mean stop the guest OS from paging out the contents, that can''t be done from inside the hypervisor. If you mean keep it from being used as a pagetable, LDT or other special page, that can be done with get_page_and_type(), but you still need the guest OS to cooperate. Tim. -- Tim Deegan <tim@xen.org> Principal Software Engineer, Xen Platform Team Citrix Systems UK Ltd. (Company #02937203, SL9 0BG) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
veerasena reddy
2011-Aug-03 17:50 UTC
Re: [Xen-devel] Pinning a DomU Guest data page from Hypervisor
Hi, Thanks for the response. By pinning, I mean to keep the data page always in main memory for the device to access. Once the device processes the page, i can unpin. Please correct me, if i understood page pinning concept wrongly. But, my goal is to keep the page in main memory until the device processes it. Please advice. Thanks & Regards, VSR. On Wed, Aug 3, 2011 at 10:46 PM, Tim Deegan <tim@xen.org> wrote:> Hi, > > At 19:26 +0530 on 03 Aug (1312399607), veerasena reddy wrote: > > I looked into code "xen/arch/x86/mm.c", do_mmuext_op() which was > > invoking xsm_memory_pin_page() only for L1 to L4 page table type pages. > Can > > i use the same API to pin data pages? > > > > Could anybody please advice how can I pin a Guest data page from > hypervisor. > > Any APIs or sequence of operations to be done on MFN of the guest page? > > What exactly do you mean by "pin"? If you mean stop the guest OS from > paging out the contents, that can''t be done from inside the hypervisor. > If you mean keep it from being used as a pagetable, LDT or other special > page, that can be done with get_page_and_type(), but you still need the > guest OS to cooperate. > > Tim. > > -- > Tim Deegan <tim@xen.org> > Principal Software Engineer, Xen Platform Team > Citrix Systems UK Ltd. (Company #02937203, SL9 0BG) >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Tim Deegan
2011-Aug-03 18:13 UTC
Re: [Xen-devel] Pinning a DomU Guest data page from Hypervisor
Hi, At 23:20 +0530 on 03 Aug (1312413612), veerasena reddy wrote:> By pinning, I mean to keep the data page always in main memory for the > device to access. Once the device processes the page, i can unpin. > Please correct me, if i understood page pinning concept wrongly. > But, my goal is to keep the page in main memory until the device processes > it.If you want to stop _xen_ reassigning this frame (including any hypervisor-level paging) you can just take a reference count (probably you want a writeable-tyrp typecount using get_page_and_type()). But Xen can''t stop the guest OS from reusing the frame (including paging its contents out), so you will need to address that inside the guest OS. Tim. -- Tim Deegan <tim@xen.org> Principal Software Engineer, Xen Platform Team Citrix Systems UK Ltd. (Company #02937203, SL9 0BG) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
veerasena reddy
2011-Aug-04 06:13 UTC
Re: [Xen-devel] Pinning a DomU Guest data page from Hypervisor
Thanks a lot. I can make Guest not to reassign my data pages by doing dma_map_single() on all my data pages. I will try that. thanks again. Regards, VSR. On Wed, Aug 3, 2011 at 11:43 PM, Tim Deegan <tim@xen.org> wrote:> Hi, > > At 23:20 +0530 on 03 Aug (1312413612), veerasena reddy wrote: > > By pinning, I mean to keep the data page always in main memory for the > > device to access. Once the device processes the page, i can unpin. > > Please correct me, if i understood page pinning concept wrongly. > > But, my goal is to keep the page in main memory until the device > processes > > it. > > If you want to stop _xen_ reassigning this frame (including any > hypervisor-level paging) you can just take a reference count (probably > you want a writeable-tyrp typecount using get_page_and_type()). But Xen > can''t stop the guest OS from reusing the frame (including paging its > contents out), so you will need to address that inside the guest OS. > > Tim. > > -- > Tim Deegan <tim@xen.org> > Principal Software Engineer, Xen Platform Team > Citrix Systems UK Ltd. (Company #02937203, SL9 0BG) >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel