weiming
2008-Mar-31 18:15 UTC
[Xen-devel] Re: what''s the purpose of linear page table (PML4 entry 258)
I find that it give the same pte value as I manually walking the 4 level page table directory. So I guest it facilitates the locating of a pte from va. It removes the 4-level looking up process: pgd->pud->pmd->pt->pte It saves time. Am I right? But I still don''t know how it works. On Mon, Mar 31, 2008 at 2:41 AM, weiming <zephyr.zhao@gmail.com> wrote:> Hi, > > When I read the code of do_update_va_mapping, I find that it update the > pte entry in the line page table by looking up the line page table via > guest_map_l1e() : > > 2998 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L2998> int do_update_va_mapping <http://lxr.xensource.com/lxr/ident?a=x86_64;i=do_update_va_mapping>(unsigned long va, u64 <http://lxr.xensource.com/lxr/ident?a=x86_64;i=u64> val64, > 2999 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L2999> unsigned long flags <http://lxr.xensource.com/lxr/ident?a=x86_64;i=flags>) > 3000 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L3000> { > 3001 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L3001> l1_pgentry_t <http://lxr.xensource.com/lxr/ident?a=x86_64;i=l1_pgentry_t> val <http://lxr.xensource.com/lxr/ident?a=x86_64;i=val> = l1e_from_intpte <http://lxr.xensource.com/lxr/ident?a=x86_64;i=l1e_from_intpte>(val64); > 3002 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L3002> struct vcpu <http://lxr.xensource.com/lxr/ident?a=x86_64;i=vcpu> *v <http://lxr.xensource.com/lxr/ident?a=x86_64;i=v> = current <http://lxr.xensource.com/lxr/ident?a=x86_64;i=current>; > 3003 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L3003> struct domain <http://lxr.xensource.com/lxr/ident?a=x86_64;i=domain> *d = v <http://lxr.xensource.com/lxr/ident?a=x86_64;i=v>->domain <http://lxr.xensource.com/lxr/ident?a=x86_64;i=domain>; > 3004 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L3004> l1_pgentry_t <http://lxr.xensource.com/lxr/ident?a=x86_64;i=l1_pgentry_t> *pl1e; > 3005 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L3005> unsigned long vmask, bmap_ptr, gl1mfn; > 3006 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L3006> cpumask_t <http://lxr.xensource.com/lxr/ident?a=x86_64;i=cpumask_t> pmask; > 3007 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L3007> int rc <http://lxr.xensource.com/lxr/ident?a=x86_64;i=rc> = 0; > 3008 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L3008> > 3009 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L3009> perfc_incr <http://lxr.xensource.com/lxr/ident?a=x86_64;i=perfc_incr>(calls_to_update_va); > 3010 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L3010> > 3011 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L3011> if ( unlikely <http://lxr.xensource.com/lxr/ident?a=x86_64;i=unlikely>(!__addr_ok <http://lxr.xensource.com/lxr/ident?a=x86_64;i=__addr_ok>(va) && !paging_mode_external <http://lxr.xensource.com/lxr/ident?a=x86_64;i=paging_mode_external>(d)) ) > 3012 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L3012> return -EINVAL <http://lxr.xensource.com/lxr/ident?a=x86_64;i=EINVAL>; > 3013 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L3013> > 3014 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L3014> rc <http://lxr.xensource.com/lxr/ident?a=x86_64;i=rc> = xsm_update_va_mapping <http://lxr.xensource.com/lxr/ident?a=x86_64;i=xsm_update_va_mapping>(current <http://lxr.xensource.com/lxr/ident?a=x86_64;i=current>->domain <http://lxr.xensource.com/lxr/ident?a=x86_64;i=domain>, val <http://lxr.xensource.com/lxr/ident?a=x86_64;i=val>); > 3015 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L3015> if ( rc <http://lxr.xensource.com/lxr/ident?a=x86_64;i=rc> ) > 3016 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L3016> return rc <http://lxr.xensource.com/lxr/ident?a=x86_64;i=rc>; > 3017 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L3017> > 3018 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L3018> LOCK_BIGLOCK <http://lxr.xensource.com/lxr/ident?a=x86_64;i=LOCK_BIGLOCK>(d); > 3019 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L3019> > 3020 <http://lxr.xensource.com/lxr/source/xen/arch/x86/mm.c?a=x86_64#L3020> pl1e = guest_map_l1e <http://lxr.xensource.com/lxr/ident?a=x86_64;i=guest_map_l1e>(v <http://lxr.xensource.com/lxr/ident?a=x86_64;i=v>, va, &gl1mfn); > > ... > ... > > > > what''s the purpose of this table? > > Thanks >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Tim Deegan
2008-Apr-01 08:47 UTC
Re: [Xen-devel] Re: what''s the purpose of linear page table (PML4 entry 258)
At 14:15 -0400 on 31 Mar (1206972951), weiming wrote:> I find that it give the same pte value as I manually walking the 4 level > page table directory. > So I guest it facilitates the locating of a pte from va. It removes the > 4-level looking up process: pgd->pud->pmd->pt->pte > It saves time. Am I right?IIRC, it just does that walk internally and hands back the answer. I don''t recall off the top of my head why Michael introduced it except that it was necessary for shadowing some kinds of PV guests. It may have been to do with the way the shadow-pagetable spinlocks used to work. 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-Apr-01 08:52 UTC
Re: [Xen-devel] Re: what''s the purpose of linear page table (PML4 entry 258)
At 08:47 +0000 on 01 Apr (1207039678), Tim Deegan wrote:> At 14:15 -0400 on 31 Mar (1206972951), weiming wrote: > > I find that it give the same pte value as I manually walking the 4 level > > page table directory. > > So I guest it facilitates the locating of a pte from va. It removes the > > 4-level looking up process: pgd->pud->pmd->pt->pte > > It saves time. Am I right? > > IIRC, it just does that walk internally and hands back the answer.Excuse me, not enough coffee. Yes, it uses the linear mapping of the pagetable to save time. 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