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.
Quoted 30 lines · weiming
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 viaguest_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);
Quoted 9 lines
...
...what's the purpose of this table?
Thanks
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 5 lines · weiming
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.
Signature · 3 lines
Tim Deegan <[email protected]> Principal Software Engineer, Citrix Systems (R&D) Ltd. [Company #02300071, SL9 0DZ, UK.]
Quoted 8 lines · Tim Deegan
Quoted 5 lines · weiming
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.
Signature · 3 lines
Tim Deegan <[email protected]> Principal Software Engineer, Citrix Systems (R&D) Ltd. [Company #02300071, SL9 0DZ, UK.]