linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Borislav Petkov <bp@alien8.de>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	hpa@zytor.com, tglx@linutronix.de, mingo@redhat.com,
	akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, x86@kernel.org, jgross@suse.com,
	konrad.wilk@oracle.com, elliott@hpe.com,
	boris.ostrovsky@oracle.com, Toshi Kani <toshi.kani@hpe.com>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH] x86/mm: fix regression with huge pages on PAE
Date: Thu, 12 Nov 2015 09:00:59 +0100	[thread overview]
Message-ID: <20151112080059.GA6835@gmail.com> (raw)
In-Reply-To: <20151112075758.GA20702@node.shutemov.name>


* Kirill A. Shutemov <kirill@shutemov.name> wrote:

> On Thu, Nov 12, 2015 at 08:48:54AM +0100, Ingo Molnar wrote:
> > 
> > * Borislav Petkov <bp@alien8.de> wrote:
> > 
> > > --- a/arch/x86/include/asm/pgtable_types.h
> > > +++ b/arch/x86/include/asm/pgtable_types.h
> > > @@ -279,17 +279,14 @@ static inline pmdval_t native_pmd_val(pmd_t pmd)
> > >  static inline pudval_t pud_pfn_mask(pud_t pud)
> > >  {
> > >  	if (native_pud_val(pud) & _PAGE_PSE)
> > > -		return PUD_PAGE_MASK & PHYSICAL_PAGE_MASK;
> > > +		return ~((1ULL << PUD_SHIFT) - 1) & PHYSICAL_PAGE_MASK;
> > >  	else
> > >  		return PTE_PFN_MASK;
> > >  }
> > 
> > >  static inline pmdval_t pmd_pfn_mask(pmd_t pmd)
> > >  {
> > >  	if (native_pmd_val(pmd) & _PAGE_PSE)
> > > -		return PMD_PAGE_MASK & PHYSICAL_PAGE_MASK;
> > > +		return ~((1ULL << PMD_SHIFT) - 1) & PHYSICAL_PAGE_MASK;
> > >  	else
> > >  		return PTE_PFN_MASK;
> > >  }
> > 
> > So instead of uglifying the code, why not fix the real bug: change the 
> > PMD_PAGE_MASK/PUD_PAGE_MASK definitions to be 64-bit everywhere?
> 
> *PAGE_MASK are usually applied to virtual addresses. I don't think it
> should anything but 'unsigned long'. This is odd use case really.

So we already have PHYSICAL_PAGE_MASK, why not introduce PHYSICAL_PMD_MASK et al, 
instead of uglifying the code?

But, what problems do you expect with having a wider mask than its primary usage? 
If it's used for 32-bit values it will be truncated down safely. (But I have not 
tested it, so I might be missing some complication.)

Thanks,

	Ingo

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2015-11-12  8:01 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-09 23:18 [PATCH] x86/mm: fix regression with huge pages on PAE Kirill A. Shutemov
2015-11-09 23:43 ` Toshi Kani
2015-11-09 23:57   ` Kirill A. Shutemov
2015-11-10  0:12     ` Toshi Kani
2015-11-10 12:34 ` Borislav Petkov
2015-11-10 13:53   ` Kirill A. Shutemov
2015-11-10 14:46     ` Borislav Petkov
2015-11-10 15:07       ` Kirill A. Shutemov
2015-11-10 17:04         ` Borislav Petkov
2015-11-11  9:51           ` Borislav Petkov
2015-11-12  7:48             ` Ingo Molnar
2015-11-12  7:57               ` Kirill A. Shutemov
2015-11-12  8:00                 ` Ingo Molnar [this message]
2015-11-12  8:46                   ` Kirill A. Shutemov
2015-11-12  8:54                     ` Ingo Molnar
2015-11-12  9:00                       ` Kirill A. Shutemov
2015-11-12 13:29                         ` Ingo Molnar
2015-11-24 14:59                         ` Boris Ostrovsky
2015-11-24 20:14                           ` Kirill A. Shutemov
2015-11-25 10:27                             ` Borislav Petkov
2015-11-27 10:14                             ` Ingo Molnar
2015-11-12  8:55                     ` Ingo Molnar
2015-11-12 19:29                   ` Linus Torvalds
2015-11-13  9:01                     ` Dan Williams

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=20151112080059.GA6835@gmail.com \
    --to=mingo@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=boris.ostrovsky@oracle.com \
    --cc=bp@alien8.de \
    --cc=elliott@hpe.com \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=kirill@shutemov.name \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=toshi.kani@hpe.com \
    --cc=x86@kernel.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).