Mike Sun
2008-May-12 20:01 UTC
[Xen-devel] Does paging_gva_to_gfn() convert to mfn for PV guests?
Hi, Does the function "paging_gva_to_gfn()" in xen/include/asm-x86/paging.h translate from guest virtual address to mfns or to pfns in PV guests that are not using fully translated shadow page tables (e.g. dom)? Thanks, Mike _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Tim Deegan
2008-May-13 08:34 UTC
Re: [Xen-devel] Does paging_gva_to_gfn() convert to mfn for PV guests?
At 16:01 -0400 on 12 May (1210608109), Mike Sun wrote:> Does the function "paging_gva_to_gfn()" in > xen/include/asm-x86/paging.h translate from guest virtual address to > mfns or to pfns in PV guests that are not using fully translated > shadow page tables (e.g. dom)?It ought to, as long as they''re using *some* kind of paging assistance. For non-HVM guests, that means shadow paging, e.g. log-dirty or ''test'' mode. Tim. -- Tim Deegan <Tim.Deegan@citrix.com> Principal Software Engineer, Citrix Systems (R&D) Ltd. [Company #02300071, SL9 0DZ, UK.] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Mike Sun
2008-May-13 15:23 UTC
Re: [Xen-devel] Does paging_gva_to_gfn() convert to mfn for PV guests?
Hmm... I''m not sure if I''m understanding clearly what you''re saying. If I use this function to translate virtual addresses from dom0 (a PV guest without shadow paging). will I get an mfn or a pfn? My expectation would be that I get an mfn since PV guests without any sort of shadow paging have virt --> machine translations installed in the page tables and do not actually use the p2m table for translation. Is this correct? Thanks, Mike On Tue, May 13, 2008 at 4:34 AM, Tim Deegan <Tim.Deegan@citrix.com> wrote:> > At 16:01 -0400 on 12 May (1210608109), Mike Sun wrote: > > Does the function "paging_gva_to_gfn()" in > > xen/include/asm-x86/paging.h translate from guest virtual address to > > mfns or to pfns in PV guests that are not using fully translated > > shadow page tables (e.g. dom)? > > It ought to, as long as they''re using *some* kind of paging assistance. > For non-HVM guests, that means shadow paging, e.g. log-dirty or ''test'' mode. > > Tim. > > -- > Tim Deegan <Tim.Deegan@citrix.com> > Principal Software Engineer, Citrix Systems (R&D) Ltd. > [Company #02300071, SL9 0DZ, UK.] >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Tim Deegan
2008-May-13 16:04 UTC
Re: [Xen-devel] Does paging_gva_to_gfn() convert to mfn for PV guests?
At 11:23 -0400 on 13 May (1210677791), Mike Sun wrote:> Hmm... I''m not sure if I''m understanding clearly what you''re saying. > If I use this function to translate virtual addresses from dom0 (a PV > guest without shadow paging). will I get an mfn or a pfn?No. :) The code behind that function relies on data structures which are only maintained if paging assistance (shadow or HAP) is turned on.> My expectation would be that I get an mfn since PV guests without any > sort of shadow paging have virt --> machine translations installed in > the page tables and do not actually use the p2m table for translation. > Is this correct?In the case of PV guests with shadow pagetables turned on (typically this is only while live migration is in progress), then yes, you should get an MFN. Cheers, Tim -- Tim Deegan <Tim.Deegan@citrix.com> Principal Software Engineer, Citrix Systems (R&D) Ltd. [Company #02300071, SL9 0DZ, UK.] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Mike Sun
2008-May-13 16:12 UTC
Re: [Xen-devel] Does paging_gva_to_gfn() convert to mfn for PV guests?
Thanks Tim. In that case, is there a function or macro that will translate a guest va from dom0 to mfn in Xen? I''ve seen that functions like copy_to_guest will allow Xen to write into a dom0 guest address, but the way it''s it''s implemented (kernel to userspace copy), seems to require that the current address space in cr3 be the same as the guest process containing that guest address. I want to be able to copy from Xen to a guest address in dom0 regardless of what guest address space is currently loaded in cr3. I was hoping to do the gva --> mfn translation, store the mfn and map that mfn in to Xen on demand when I wanted to do the copy. Any ideas? Thanks, Mike On Tue, May 13, 2008 at 12:04 PM, Tim Deegan <Tim.Deegan@citrix.com> wrote:> At 11:23 -0400 on 13 May (1210677791), Mike Sun wrote: > > Hmm... I''m not sure if I''m understanding clearly what you''re saying. > > If I use this function to translate virtual addresses from dom0 (a PV > > guest without shadow paging). will I get an mfn or a pfn? > > No. :) The code behind that function relies on data structures which are > only maintained if paging assistance (shadow or HAP) is turned on. > > > > My expectation would be that I get an mfn since PV guests without any > > sort of shadow paging have virt --> machine translations installed in > > the page tables and do not actually use the p2m table for translation. > > Is this correct? > > In the case of PV guests with shadow pagetables turned on (typically > this is only while live migration is in progress), then yes, you should > get an MFN. > > Cheers, > > > > Tim > > -- > Tim Deegan <Tim.Deegan@citrix.com> > Principal Software Engineer, Citrix Systems (R&D) Ltd. > [Company #02300071, SL9 0DZ, UK.] >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel