Re: bisected boot regression post 2.6.25-rc3.. please revert

From: Segher Boessenkool
Date: Mon Mar 03 2008 - 16:14:34 EST


hm. I suspect some gcc related difference related to the handling of this masking:
pmd_val(x) & ~(PAGE_MASK | _PAGE_USER | _PAGE_PSE | _PAGE_NX)
versus:
pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)
perhaps it will work if you change it to:
pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER & ~_PAGE_PSE & ~_PAGE_NX)
?
in any case, the commit has to be reverted as it clearly isnt a NOP on your box as it was intended to be. (it should only have made a difference in a rare hugetlbfs case)

interesting observation: if I turn the macros into inlines... the difference goes away.

include/asm-x86/pgtable.h has

#define _PAGE_BIT_PSE 7

#define _PAGE_PSE (_AC(1, L)<<_PAGE_BIT_PSE)

and

#define _PAGE_BIT_NX 63

#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
#define _PAGE_NX (_AC(1, ULL) << _PAGE_BIT_NX)

so (on 32-bit) ~_PAGE_PSE is ~0x80L is 0xffffff7f, which when cast to
64-bit is 0x00000000ffffff7f, so in

(~PAGE_MASK & ~_PAGE_USER & ~_PAGE_PSE & ~_PAGE_NX)

all the high bits are lost, while the original

~(PAGE_MASK | _PAGE_USER | _PAGE_PSE | _PAGE_NX)

works as intended, since the bit inversion is done on a 64-bit number.


Maybe all those pagetable bit definitions should use 64-bit (ULL or a cast),
as it is now some dangerous detail is hidden behind the macros. Using inline
functions for simple constants seems like overkill to me, but would also work
of course.


Segher

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/