From: Toshi Kani <toshi.kani@hpe.com>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
hpa@zytor.com, tglx@linutronix.de, mingo@redhat.com,
akpm@linux-foundation.org, bp@alien8.de, 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
Subject: Re: [PATCH] x86/mm: fix regression with huge pages on PAE
Date: Mon, 09 Nov 2015 17:12:49 -0700 [thread overview]
Message-ID: <1447114369.21443.37.camel@hpe.com> (raw)
In-Reply-To: <20151109235728.GA7813@node.shutemov.name>
On Tue, 2015-11-10 at 01:57 +0200, Kirill A. Shutemov wrote:
> On Mon, Nov 09, 2015 at 04:43:11PM -0700, Toshi Kani wrote:
> > On Tue, 2015-11-10 at 01:18 +0200, Kirill A. Shutemov wrote:
> > > Recent PAT patchset has caused issue on 32-bit PAE machines:
> > :
> > > The problem is in pmd_pfn_mask() and pmd_flags_mask(). These helpers use
> > > PMD_PAGE_MASK to calculate resulting mask. PMD_PAGE_MASK is 'unsigned
> > > long', not 'unsigned long long' as physaddr_t. As result upper bits of
> > > resulting mask is truncated.
> > >
> > > The patch reworks code to use PMD_SHIFT as base of mask calculation
> > > instead of PMD_PAGE_MASK.
> > >
> > > pud_pfn_mask() and pud_flags_mask() aren't problematic since we don't
> > > have PUD page table level on 32-bit systems, but they reworked too to be
> > > consistent with PMD counterpart.
> > >
> > > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > > Reported-and-Tested-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> > > Fixes: f70abb0fc3da ("x86/asm: Fix pud/pmd interfaces to handle large PAT
> > > bit")
> > > Cc: Toshi Kani <toshi.kani@hpe.com>
> > > ---
> > > arch/x86/include/asm/pgtable_types.h | 14 ++++----------
> > > 1 file changed, 4 insertions(+), 10 deletions(-)
> > >
> > > diff --git a/arch/x86/include/asm/pgtable_types.h
> > > b/arch/x86/include/asm/pgtable_types.h
> > > index dd5b0aa9dd2f..c1e797266ce9 100644
> > > --- 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;
> >
> > Thanks for the fix! Should we fix the PMD/PUD MASK/SIZE macros, so that we
> > do not hit the same issue again when they are used?
>
> I don't this so. PAGE_SIZE is not 'unsigned long long'. And all *PAGE_MASK
> are usually applied to virtual addresses which are 'unsigned long'.
> I think it's safer to leave them as they are.
Thanks for the explanation! That makes sense.
Reviewed-by: Toshi Kani <toshi.kani@hpe.com>
-Toshi
--
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>
next prev parent reply other threads:[~2015-11-10 0:16 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-09 23:18 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 [this message]
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
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=1447114369.21443.37.camel@hpe.com \
--to=toshi.kani@hpe.com \
--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=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