asm/page.h inconsistencies?
Could anyone explain the non-symmetric implementation of __pte/__pmd/__pud/__pgd compared to pte_val/pmd_val/pud_val/pgd_val on x86-64? On i386, the "... & 1" is consistently used across all of these, but on x86-64 only the __pte/pte_val pair does so.
Thanks, Jan
Quoted 4 lines · Jan Beulich
Could anyone explain the non-symmetric implementation of __pte/__pmd/__pud/__pgd compared to pte_val/pmd_val/pud_val/pgd_val on x86-64? On i386, the "... & 1" is consistently used across all of these, but on x86-64 only the __pte/pte_val pair does so.
We only ever test '& 1' in pte_val(). In higher-level *_val functions we need not limit the test to bit 0 (because an unused page directory entry is always 0 in Linux) and also we *cannot* limit the test to bit 0 (at least for pmd_val()) because Xen will silently temporarily remove _PAGE_PRESENT from page directory entries as part of the writable-pagetable implementation.
It is certainly arguable that the __pgd/__pud/__pmd macros should do the same test as the corresponding *_val function, for symmetry, but neither xen/i386 nor xen/x86_64 is symmetric right now (at least in xen-unstable.hg).
-- Keir