linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Arjan van de Ven <arjan@linux.intel.com>
Cc: hans.rosenfeld@amd.com, torvalds@linux-foundation.org,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: bisected boot regression post 2.6.25-rc3.. please revert
Date: Mon, 3 Mar 2008 22:13:24 +0100	[thread overview]
Message-ID: <962471e5d2b8c88858dd5e0f50269751@kernel.crashing.org> (raw)
In-Reply-To: <47CC451A.2060501@linux.intel.com>

>> 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


  parent reply	other threads:[~2008-03-03 21:14 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-01 18:56 bisected boot regression post 2.6.25-rc3.. please revert Arjan van de Ven
2008-03-03  7:46 ` Ingo Molnar
2008-03-03  9:13   ` Ingo Molnar
2008-03-03 16:41     ` Arjan van de Ven
2008-03-03 17:40       ` Ingo Molnar
2008-03-03 17:51         ` Nish Aravamudan
2008-03-03 17:55           ` Ingo Molnar
2008-03-03 17:58             ` H. Peter Anvin
2008-03-03 18:36         ` Arjan van de Ven
2008-03-03 18:44           ` Linus Torvalds
2008-03-03 22:00             ` Arjan van de Ven
2008-03-04  1:05               ` Arjan van de Ven
2008-03-04  6:53                 ` Ingo Molnar
2008-03-05 15:35                   ` Arjan van de Ven
2008-03-09 11:56             ` Ingo Molnar
2008-03-09 17:27               ` Linus Torvalds
2008-03-09 18:57                 ` Ingo Molnar
2008-03-10  2:45                 ` Jeremy Fitzhardinge
2008-03-10  4:35                 ` Paul Mackerras
2008-03-03 21:13           ` Segher Boessenkool [this message]
2008-03-03 21:22             ` Segher Boessenkool
2008-03-03 22:33               ` Segher Boessenkool
2008-03-03 22:55                 ` H. Peter Anvin
2008-03-03 22:56                 ` Jeremy Fitzhardinge
2008-03-03 23:04                   ` H. Peter Anvin
2008-03-04  6:58             ` Ingo Molnar
2008-03-03 17:15 ` Nish Aravamudan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=962471e5d2b8c88858dd5e0f50269751@kernel.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=arjan@linux.intel.com \
    --cc=hans.rosenfeld@amd.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).