All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Borislav Petkov <bp@alien8.de>
Cc: "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>
Subject: Re: [PATCH] x86/mm: fix regression with huge pages on PAE
Date: Tue, 10 Nov 2015 15:53:03 +0200	[thread overview]
Message-ID: <20151110135303.GA11246@node.shutemov.name> (raw)
In-Reply-To: <20151110123429.GE19187@pd.tnic>

On Tue, Nov 10, 2015 at 01:34:29PM +0100, Borislav Petkov wrote:
> On Tue, Nov 10, 2015 at 01:18:10AM +0200, Kirill A. Shutemov wrote:
> > 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;
> 
> In file included from ./arch/x86/include/asm/boot.h:5:0,
>                  from ./arch/x86/boot/boot.h:26,
>                  from arch/x86/realmode/rm/wakemain.c:2:
> ./arch/x86/include/asm/pgtable_types.h: In function ‘pud_pfn_mask’:
> ./arch/x86/include/asm/pgtable_types.h:282:10: warning: large integer implicitly truncated to unsigned type [-Woverflow]
>    return ~((1ULL << PUD_SHIFT) - 1) & PHYSICAL_PAGE_MASK;
>           ^
> ./arch/x86/include/asm/pgtable_types.h: In function ‘pmd_pfn_mask’:
> ./arch/x86/include/asm/pgtable_types.h:300:10: warning: large integer implicitly truncated to unsigned type [-Woverflow]
>    return ~((1ULL << PMD_SHIFT) - 1) & PHYSICAL_PAGE_MASK;
>           ^
> In file included from ./arch/x86/include/asm/boot.h:5:0,
>                  from arch/x86/realmode/rm/../../boot/boot.h:26,
>                  from arch/x86/realmode/rm/../../boot/video-mode.c:18,
>                  from arch/x86/realmode/rm/video-mode.c:1:
> ./arch/x86/include/asm/pgtable_types.h: In function ‘pud_pfn_mask’:
> ./arch/x86/include/asm/pgtable_types.h:282:10: warning: large integer implicitly truncated to unsigned type [-Woverflow]
>    return ~((1ULL << PUD_SHIFT) - 1) & PHYSICAL_PAGE_MASK;
>           ^
> ...
> 
> That's a 64-bit config.

Oh.. pmdval_t/pudval_t is 'unsinged long' on 64 bit. But realmode code
uses -m16 which makes 'unsigned long' 32-bit therefore truncation warning.

These helpers not really used in realmode code. I see few ways out:

 - convert helpers to macros to avoid their translation;

 - wrap the code into not-for-realmode ifdef. (Do we have any?);

 - convert pudval_t/pmdval_t to u64 for 64-bit. I'm not sure what side
   effects would it have.

Any opinions?

-- 
 Kirill A. Shutemov

WARNING: multiple messages have this Message-ID (diff)
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Borislav Petkov <bp@alien8.de>
Cc: "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>
Subject: Re: [PATCH] x86/mm: fix regression with huge pages on PAE
Date: Tue, 10 Nov 2015 15:53:03 +0200	[thread overview]
Message-ID: <20151110135303.GA11246@node.shutemov.name> (raw)
In-Reply-To: <20151110123429.GE19187@pd.tnic>

On Tue, Nov 10, 2015 at 01:34:29PM +0100, Borislav Petkov wrote:
> On Tue, Nov 10, 2015 at 01:18:10AM +0200, Kirill A. Shutemov wrote:
> > 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;
> 
> In file included from ./arch/x86/include/asm/boot.h:5:0,
>                  from ./arch/x86/boot/boot.h:26,
>                  from arch/x86/realmode/rm/wakemain.c:2:
> ./arch/x86/include/asm/pgtable_types.h: In function a??pud_pfn_maska??:
> ./arch/x86/include/asm/pgtable_types.h:282:10: warning: large integer implicitly truncated to unsigned type [-Woverflow]
>    return ~((1ULL << PUD_SHIFT) - 1) & PHYSICAL_PAGE_MASK;
>           ^
> ./arch/x86/include/asm/pgtable_types.h: In function a??pmd_pfn_maska??:
> ./arch/x86/include/asm/pgtable_types.h:300:10: warning: large integer implicitly truncated to unsigned type [-Woverflow]
>    return ~((1ULL << PMD_SHIFT) - 1) & PHYSICAL_PAGE_MASK;
>           ^
> In file included from ./arch/x86/include/asm/boot.h:5:0,
>                  from arch/x86/realmode/rm/../../boot/boot.h:26,
>                  from arch/x86/realmode/rm/../../boot/video-mode.c:18,
>                  from arch/x86/realmode/rm/video-mode.c:1:
> ./arch/x86/include/asm/pgtable_types.h: In function a??pud_pfn_maska??:
> ./arch/x86/include/asm/pgtable_types.h:282:10: warning: large integer implicitly truncated to unsigned type [-Woverflow]
>    return ~((1ULL << PUD_SHIFT) - 1) & PHYSICAL_PAGE_MASK;
>           ^
> ...
> 
> That's a 64-bit config.

Oh.. pmdval_t/pudval_t is 'unsinged long' on 64 bit. But realmode code
uses -m16 which makes 'unsigned long' 32-bit therefore truncation warning.

These helpers not really used in realmode code. I see few ways out:

 - convert helpers to macros to avoid their translation;

 - wrap the code into not-for-realmode ifdef. (Do we have any?);

 - convert pudval_t/pmdval_t to u64 for 64-bit. I'm not sure what side
   effects would it have.

Any opinions?

-- 
 Kirill A. Shutemov

--
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-10 13:53 UTC|newest]

Thread overview: 49+ 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:18 ` Kirill A. Shutemov
2015-11-09 23:43 ` Toshi Kani
2015-11-09 23:43   ` Toshi Kani
2015-11-09 23:57   ` Kirill A. Shutemov
2015-11-09 23:57     ` Kirill A. Shutemov
2015-11-10  0:12     ` Toshi Kani
2015-11-10  0:12       ` Toshi Kani
2015-11-10 12:34 ` Borislav Petkov
2015-11-10 12:34   ` Borislav Petkov
2015-11-10 13:53   ` Kirill A. Shutemov [this message]
2015-11-10 13:53     ` Kirill A. Shutemov
2015-11-10 14:46     ` Borislav Petkov
2015-11-10 14:46       ` Borislav Petkov
2015-11-10 15:07       ` Kirill A. Shutemov
2015-11-10 15:07         ` Kirill A. Shutemov
2015-11-10 17:04         ` Borislav Petkov
2015-11-10 17:04           ` Borislav Petkov
2015-11-11  9:51           ` Borislav Petkov
2015-11-11  9:51             ` Borislav Petkov
2015-11-12  7:48             ` Ingo Molnar
2015-11-12  7:48               ` Ingo Molnar
2015-11-12  7:57               ` Kirill A. Shutemov
2015-11-12  7:57                 ` Kirill A. Shutemov
2015-11-12  8:00                 ` Ingo Molnar
2015-11-12  8:00                   ` Ingo Molnar
2015-11-12  8:46                   ` Kirill A. Shutemov
2015-11-12  8:46                     ` Kirill A. Shutemov
2015-11-12  8:54                     ` Ingo Molnar
2015-11-12  8:54                       ` Ingo Molnar
2015-11-12  9:00                       ` Kirill A. Shutemov
2015-11-12  9:00                         ` Kirill A. Shutemov
2015-11-12 13:29                         ` Ingo Molnar
2015-11-12 13:29                           ` Ingo Molnar
2015-11-24 14:59                         ` Boris Ostrovsky
2015-11-24 14:59                           ` Boris Ostrovsky
2015-11-24 20:14                           ` Kirill A. Shutemov
2015-11-24 20:14                             ` Kirill A. Shutemov
2015-11-25 10:27                             ` Borislav Petkov
2015-11-25 10:27                               ` Borislav Petkov
2015-11-27 10:14                             ` Ingo Molnar
2015-11-27 10:14                               ` Ingo Molnar
2015-11-12  8:55                     ` Ingo Molnar
2015-11-12  8:55                       ` Ingo Molnar
2015-11-12 19:29                   ` Linus Torvalds
2015-11-12 19:29                     ` Linus Torvalds
2015-11-13  9:01                     ` Dan Williams
2015-11-13  9:01                       ` Dan Williams
2015-11-30 10:10 [PATCH] tip-queue 2015-11-30 Borislav Petkov
2015-11-30 10:10 ` [PATCH] x86/mm: Fix regression with huge pages on PAE Borislav Petkov

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=20151110135303.GA11246@node.shutemov.name \
    --to=kirill@shutemov.name \
    --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=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.