Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1265959 > unrolled thread

Re: [PATCH v4 RESEND 4/11] x86/asm: Fix pud/pmd interfaces to handle large PAT bit

Started byToshi Kani <toshi.kani@hpe.com>
First post2015-11-09 20:30 +0100
Last post2015-11-09 22:20 +0100
Articles 8 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v4 RESEND 4/11] x86/asm: Fix pud/pmd interfaces to  handle large PAT bit Toshi Kani <toshi.kani@hpe.com> - 2015-11-09 20:30 +0100
    Re: [PATCH v4 RESEND 4/11] x86/asm: Fix pud/pmd interfaces to handle  large PAT bit Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2015-11-09 20:50 +0100
      Re: [PATCH v4 RESEND 4/11] x86/asm: Fix pud/pmd interfaces to handle  large PAT bit "Kirill A. Shutemov" <kirill@shutemov.name> - 2015-11-09 21:50 +0100
        Re: [PATCH v4 RESEND 4/11] x86/asm: Fix pud/pmd interfaces to handle  large PAT bit Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2015-11-09 23:40 +0100
          Re: [PATCH v4 RESEND 4/11] x86/asm: Fix pud/pmd interfaces to  handle large PAT bit Toshi Kani <toshi.kani@hpe.com> - 2015-11-10 00:30 +0100
            Re: [PATCH v4 RESEND 4/11] x86/asm: Fix pud/pmd interfaces to  handle large PAT bit Toshi Kani <toshi.kani@hpe.com> - 2015-11-10 01:50 +0100
    Re: [PATCH v4 RESEND 4/11] x86/asm: Fix pud/pmd interfaces to handle  large PAT bit "Kirill A. Shutemov" <kirill@shutemov.name> - 2015-11-09 21:20 +0100
      Re: [PATCH v4 RESEND 4/11] x86/asm: Fix pud/pmd interfaces to  handle large PAT bit Toshi Kani <toshi.kani@hpe.com> - 2015-11-09 22:20 +0100

#1265959 — Re: [PATCH v4 RESEND 4/11] x86/asm: Fix pud/pmd interfaces to handle large PAT bit

FromToshi Kani <toshi.kani@hpe.com>
Date2015-11-09 20:30 +0100
SubjectRe: [PATCH v4 RESEND 4/11] x86/asm: Fix pud/pmd interfaces to handle large PAT bit
Message-ID<qt0iC-2cL-15@gated-at.bofh.it>
On Mon, 2015-11-09 at 13:06 -0500, Boris Ostrovsky wrote:
> On 09/17/2015 02:24 PM, Toshi Kani wrote:
> > Now that we have pud/pmd mask interfaces, which handle pfn & flags
> > mask properly for the large PAT bit.
> > 
> > Fix pud/pmd pfn & flags interfaces by replacing PTE_PFN_MASK and
> > PTE_FLAGS_MASK with the pud/pmd mask interfaces.
> > 
> > Suggested-by: Juergen Gross <jgross@suse.com>
> > Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
> > Cc: Juergen Gross <jgross@suse.com>
> > Cc: Konrad Wilk <konrad.wilk@oracle.com>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: H. Peter Anvin <hpa@zytor.com>
> > Cc: Ingo Molnar <mingo@redhat.com>
> > Cc: Borislav Petkov <bp@alien8.de>
> > ---
> >   arch/x86/include/asm/pgtable.h       |   14 ++++++++------
> >   arch/x86/include/asm/pgtable_types.h |    4 ++--
> >   2 files changed, 10 insertions(+), 8 deletions(-)
> > 
> 
> 
> Looks like this commit is causing this splat for 32-bit kernels. I am 
> attaching my config file, just in case.

Thanks for the report!  I'd like to reproduce the issue since I am not sure how
this change caused it...

I tried to build a kernel with the attached config file, and got the following
error.  Not sure what I am missing.  

----
$ make -j24 ARCH=i386
   :
  LD      drivers/built-in.o
  LINK    vmlinux
./.config: line 44: $'\r': command not found
Makefile:929: recipe for target 'vmlinux' failed
make: *** [vmlinux] Error 127
----

Do you have steps to reproduce the issue?  Or do you see it during boot-time?

Thanks,
-Toshi

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

[toc] | [next] | [standalone]


#1265971 — Re: [PATCH v4 RESEND 4/11] x86/asm: Fix pud/pmd interfaces to handle large PAT bit

FromBoris Ostrovsky <boris.ostrovsky@oracle.com>
Date2015-11-09 20:50 +0100
SubjectRe: [PATCH v4 RESEND 4/11] x86/asm: Fix pud/pmd interfaces to handle large PAT bit
Message-ID<qt0BZ-2jS-41@gated-at.bofh.it>
In reply to#1265959
On 11/09/2015 02:16 PM, Toshi Kani wrote:
> On Mon, 2015-11-09 at 13:06 -0500, Boris Ostrovsky wrote:
>> On 09/17/2015 02:24 PM, Toshi Kani wrote:
>>> Now that we have pud/pmd mask interfaces, which handle pfn & flags
>>> mask properly for the large PAT bit.
>>>
>>> Fix pud/pmd pfn & flags interfaces by replacing PTE_PFN_MASK and
>>> PTE_FLAGS_MASK with the pud/pmd mask interfaces.
>>>
>>> Suggested-by: Juergen Gross <jgross@suse.com>
>>> Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
>>> Cc: Juergen Gross <jgross@suse.com>
>>> Cc: Konrad Wilk <konrad.wilk@oracle.com>
>>> Cc: Thomas Gleixner <tglx@linutronix.de>
>>> Cc: H. Peter Anvin <hpa@zytor.com>
>>> Cc: Ingo Molnar <mingo@redhat.com>
>>> Cc: Borislav Petkov <bp@alien8.de>
>>> ---
>>>    arch/x86/include/asm/pgtable.h       |   14 ++++++++------
>>>    arch/x86/include/asm/pgtable_types.h |    4 ++--
>>>    2 files changed, 10 insertions(+), 8 deletions(-)
>>>
>>
>> Looks like this commit is causing this splat for 32-bit kernels. I am
>> attaching my config file, just in case.
> Thanks for the report!  I'd like to reproduce the issue since I am not sure how
> this change caused it...
>
> I tried to build a kernel with the attached config file, and got the following
> error.  Not sure what I am missing.
>
> ----
> $ make -j24 ARCH=i386
>     :
>    LD      drivers/built-in.o
>    LINK    vmlinux
> ./.config: line 44: $'\r': command not found

I wonder whether my email client added ^Ms to the file that I send. It 
shouldn't have.

> Makefile:929: recipe for target 'vmlinux' failed
> make: *** [vmlinux] Error 127
> ----
>
> Do you have steps to reproduce the issue?  Or do you see it during boot-time?

This always happens just after system has booted, it may still be going 
over init scripts. I am booting with ramdisk, don't know whether it has 
anything to do with this problem.

FWIW, it looks like pmd_pfn_mask() inline is causing this. Reverting it 
alone makes this crash go away.


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

[toc] | [prev] | [next] | [standalone]


#1265996 — Re: [PATCH v4 RESEND 4/11] x86/asm: Fix pud/pmd interfaces to handle large PAT bit

From"Kirill A. Shutemov" <kirill@shutemov.name>
Date2015-11-09 21:50 +0100
SubjectRe: [PATCH v4 RESEND 4/11] x86/asm: Fix pud/pmd interfaces to handle large PAT bit
Message-ID<qt1y2-2UV-9@gated-at.bofh.it>
In reply to#1265971
On Mon, Nov 09, 2015 at 02:39:31PM -0500, Boris Ostrovsky wrote:
> On 11/09/2015 02:16 PM, Toshi Kani wrote:
> >On Mon, 2015-11-09 at 13:06 -0500, Boris Ostrovsky wrote:
> >>On 09/17/2015 02:24 PM, Toshi Kani wrote:
> >>>Now that we have pud/pmd mask interfaces, which handle pfn & flags
> >>>mask properly for the large PAT bit.
> >>>
> >>>Fix pud/pmd pfn & flags interfaces by replacing PTE_PFN_MASK and
> >>>PTE_FLAGS_MASK with the pud/pmd mask interfaces.
> >>>
> >>>Suggested-by: Juergen Gross <jgross@suse.com>
> >>>Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
> >>>Cc: Juergen Gross <jgross@suse.com>
> >>>Cc: Konrad Wilk <konrad.wilk@oracle.com>
> >>>Cc: Thomas Gleixner <tglx@linutronix.de>
> >>>Cc: H. Peter Anvin <hpa@zytor.com>
> >>>Cc: Ingo Molnar <mingo@redhat.com>
> >>>Cc: Borislav Petkov <bp@alien8.de>
> >>>---
> >>>   arch/x86/include/asm/pgtable.h       |   14 ++++++++------
> >>>   arch/x86/include/asm/pgtable_types.h |    4 ++--
> >>>   2 files changed, 10 insertions(+), 8 deletions(-)
> >>>
> >>
> >>Looks like this commit is causing this splat for 32-bit kernels. I am
> >>attaching my config file, just in case.
> >Thanks for the report!  I'd like to reproduce the issue since I am not sure how
> >this change caused it...
> >
> >I tried to build a kernel with the attached config file, and got the following
> >error.  Not sure what I am missing.
> >
> >----
> >$ make -j24 ARCH=i386
> >    :
> >   LD      drivers/built-in.o
> >   LINK    vmlinux
> >./.config: line 44: $'\r': command not found
> 
> I wonder whether my email client added ^Ms to the file that I send. It
> shouldn't have.
> 
> >Makefile:929: recipe for target 'vmlinux' failed
> >make: *** [vmlinux] Error 127
> >----
> >
> >Do you have steps to reproduce the issue?  Or do you see it during boot-time?
> 
> This always happens just after system has booted, it may still be going over
> init scripts. I am booting with ramdisk, don't know whether it has anything
> to do with this problem.
> 
> FWIW, it looks like pmd_pfn_mask() inline is causing this. Reverting it
> alone makes this crash go away.

Could you check the patch below?

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;
 	else
 		return PTE_PFN_MASK;
 }
 
 static inline pudval_t pud_flags_mask(pud_t pud)
 {
-	if (native_pud_val(pud) & _PAGE_PSE)
-		return ~(PUD_PAGE_MASK & (pudval_t)PHYSICAL_PAGE_MASK);
-	else
-		return ~PTE_PFN_MASK;
+	return ~pud_pfn_mask(pud);
 }
 
 static inline pudval_t pud_flags(pud_t pud)
@@ -300,17 +297,14 @@ static inline pudval_t pud_flags(pud_t pud)
 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;
 }
 
 static inline pmdval_t pmd_flags_mask(pmd_t pmd)
 {
-	if (native_pmd_val(pmd) & _PAGE_PSE)
-		return ~(PMD_PAGE_MASK & (pmdval_t)PHYSICAL_PAGE_MASK);
-	else
-		return ~PTE_PFN_MASK;
+	return ~pmd_pfn_mask(pmd);
 }
 
 static inline pmdval_t pmd_flags(pmd_t pmd)
-- 
 Kirill A. Shutemov
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1266058 — Re: [PATCH v4 RESEND 4/11] x86/asm: Fix pud/pmd interfaces to handle large PAT bit

FromBoris Ostrovsky <boris.ostrovsky@oracle.com>
Date2015-11-09 23:40 +0100
SubjectRe: [PATCH v4 RESEND 4/11] x86/asm: Fix pud/pmd interfaces to handle large PAT bit
Message-ID<qt3gt-4EA-7@gated-at.bofh.it>
In reply to#1265996
On 11/09/2015 03:47 PM, Kirill A. Shutemov wrote:
> On Mon, Nov 09, 2015 at 02:39:31PM -0500, Boris Ostrovsky wrote:
>> On 11/09/2015 02:16 PM, Toshi Kani wrote:
>>> On Mon, 2015-11-09 at 13:06 -0500, Boris Ostrovsky wrote:
>>>> On 09/17/2015 02:24 PM, Toshi Kani wrote:
>>>>> Now that we have pud/pmd mask interfaces, which handle pfn & flags
>>>>> mask properly for the large PAT bit.
>>>>>
>>>>> Fix pud/pmd pfn & flags interfaces by replacing PTE_PFN_MASK and
>>>>> PTE_FLAGS_MASK with the pud/pmd mask interfaces.
>>>>>
>>>>> Suggested-by: Juergen Gross <jgross@suse.com>
>>>>> Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
>>>>> Cc: Juergen Gross <jgross@suse.com>
>>>>> Cc: Konrad Wilk <konrad.wilk@oracle.com>
>>>>> Cc: Thomas Gleixner <tglx@linutronix.de>
>>>>> Cc: H. Peter Anvin <hpa@zytor.com>
>>>>> Cc: Ingo Molnar <mingo@redhat.com>
>>>>> Cc: Borislav Petkov <bp@alien8.de>
>>>>> ---
>>>>>    arch/x86/include/asm/pgtable.h       |   14 ++++++++------
>>>>>    arch/x86/include/asm/pgtable_types.h |    4 ++--
>>>>>    2 files changed, 10 insertions(+), 8 deletions(-)
>>>>>
>>>> Looks like this commit is causing this splat for 32-bit kernels. I am
>>>> attaching my config file, just in case.
>>> Thanks for the report!  I'd like to reproduce the issue since I am not sure how
>>> this change caused it...
>>>
>>> I tried to build a kernel with the attached config file, and got the following
>>> error.  Not sure what I am missing.
>>>
>>> ----
>>> $ make -j24 ARCH=i386
>>>     :
>>>    LD      drivers/built-in.o
>>>    LINK    vmlinux
>>> ./.config: line 44: $'\r': command not found
>> I wonder whether my email client added ^Ms to the file that I send. It
>> shouldn't have.
>>
>>> Makefile:929: recipe for target 'vmlinux' failed
>>> make: *** [vmlinux] Error 127
>>> ----
>>>
>>> Do you have steps to reproduce the issue?  Or do you see it during boot-time?
>> This always happens just after system has booted, it may still be going over
>> init scripts. I am booting with ramdisk, don't know whether it has anything
>> to do with this problem.
>>
>> FWIW, it looks like pmd_pfn_mask() inline is causing this. Reverting it
>> alone makes this crash go away.
> Could you check the patch below?


I does fix the problem on baremetal, thanks. My 32-bit Xen guests still 
fail which I thought was the same issue but now that I looked at it more 
carefully it has different signature.

-boris


>
> 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;
>   	else
>   		return PTE_PFN_MASK;
>   }
>   
>   static inline pudval_t pud_flags_mask(pud_t pud)
>   {
> -	if (native_pud_val(pud) & _PAGE_PSE)
> -		return ~(PUD_PAGE_MASK & (pudval_t)PHYSICAL_PAGE_MASK);
> -	else
> -		return ~PTE_PFN_MASK;
> +	return ~pud_pfn_mask(pud);
>   }
>   
>   static inline pudval_t pud_flags(pud_t pud)
> @@ -300,17 +297,14 @@ static inline pudval_t pud_flags(pud_t pud)
>   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;
>   }
>   
>   static inline pmdval_t pmd_flags_mask(pmd_t pmd)
>   {
> -	if (native_pmd_val(pmd) & _PAGE_PSE)
> -		return ~(PMD_PAGE_MASK & (pmdval_t)PHYSICAL_PAGE_MASK);
> -	else
> -		return ~PTE_PFN_MASK;
> +	return ~pmd_pfn_mask(pmd);
>   }
>   
>   static inline pmdval_t pmd_flags(pmd_t pmd)

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

[toc] | [prev] | [next] | [standalone]


#1266082

FromToshi Kani <toshi.kani@hpe.com>
Date2015-11-10 00:30 +0100
Message-ID<qt42S-5vi-27@gated-at.bofh.it>
In reply to#1266058
On Mon, 2015-11-09 at 17:36 -0500, Boris Ostrovsky wrote:
> On 11/09/2015 03:47 PM, Kirill A. Shutemov wrote:
> > On Mon, Nov 09, 2015 at 02:39:31PM -0500, Boris Ostrovsky wrote:
> > > On 11/09/2015 02:16 PM, Toshi Kani wrote:
> > > > On Mon, 2015-11-09 at 13:06 -0500, Boris Ostrovsky wrote:
> > > > > On 09/17/2015 02:24 PM, Toshi Kani wrote:
> > > > > > Now that we have pud/pmd mask interfaces, which handle pfn & flags
> > > > > > mask properly for the large PAT bit.
> > > > > > 
> > > > > > Fix pud/pmd pfn & flags interfaces by replacing PTE_PFN_MASK and
> > > > > > PTE_FLAGS_MASK with the pud/pmd mask interfaces.
> > > > > > 
> > > > > > Suggested-by: Juergen Gross <jgross@suse.com>
> > > > > > Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
> > > > > > Cc: Juergen Gross <jgross@suse.com>
> > > > > > Cc: Konrad Wilk <konrad.wilk@oracle.com>
> > > > > > Cc: Thomas Gleixner <tglx@linutronix.de>
> > > > > > Cc: H. Peter Anvin <hpa@zytor.com>
> > > > > > Cc: Ingo Molnar <mingo@redhat.com>
> > > > > > Cc: Borislav Petkov <bp@alien8.de>
> > > > > > ---
> > > > > >    arch/x86/include/asm/pgtable.h       |   14 ++++++++------
> > > > > >    arch/x86/include/asm/pgtable_types.h |    4 ++--
> > > > > >    2 files changed, 10 insertions(+), 8 deletions(-)
> > > > > > 
> > > > > Looks like this commit is causing this splat for 32-bit kernels. I am
> > > > > attaching my config file, just in case.
> > > > Thanks for the report!  I'd like to reproduce the issue since I am not
> > > > sure how
> > > > this change caused it...
> > > > 
> > > > I tried to build a kernel with the attached config file, and got the
> > > > following
> > > > error.  Not sure what I am missing.
> > > > 
> > > > ----
> > > > $ make -j24 ARCH=i386
> > > >     :
> > > >    LD      drivers/built-in.o
> > > >    LINK    vmlinux
> > > > ./.config: line 44: $'\r': command not found
> > > I wonder whether my email client added ^Ms to the file that I send. It
> > > shouldn't have.
> > > 
> > > > Makefile:929: recipe for target 'vmlinux' failed
> > > > make: *** [vmlinux] Error 127
> > > > ----
> > > > 
> > > > Do you have steps to reproduce the issue?  Or do you see it during boot
> > > > -time?
> > > This always happens just after system has booted, it may still be going
> > > over
> > > init scripts. I am booting with ramdisk, don't know whether it has
> > > anything
> > > to do with this problem.
> > > 
> > > FWIW, it looks like pmd_pfn_mask() inline is causing this. Reverting it
> > > alone makes this crash go away.
> > Could you check the patch below?
> 
> 
> I does fix the problem on baremetal, thanks. My 32-bit Xen guests still 
> fail which I thought was the same issue but now that I looked at it more 
> carefully it has different signature.

I do not think Xen is hitting this, but I think page_level_mask() has the same
issue for a long time.  I will set up 32-bit env on a system with >4GB memory to
verify this.

Thanks,
-Toshi

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

[toc] | [prev] | [next] | [standalone]


#1266129

FromToshi Kani <toshi.kani@hpe.com>
Date2015-11-10 01:50 +0100
Message-ID<qt5ih-6fS-1@gated-at.bofh.it>
In reply to#1266082
On Mon, 2015-11-09 at 16:18 -0700, Toshi Kani wrote:
> On Mon, 2015-11-09 at 17:36 -0500, Boris Ostrovsky wrote:
> > On 11/09/2015 03:47 PM, Kirill A. Shutemov wrote:
> > > On Mon, Nov 09, 2015 at 02:39:31PM -0500, Boris Ostrovsky wrote:
> > > > On 11/09/2015 02:16 PM, Toshi Kani wrote:
 :
> > > > 
> > > > FWIW, it looks like pmd_pfn_mask() inline is causing this. Reverting it
> > > > alone makes this crash go away.
> > > Could you check the patch below?
> > 
> > 
> > I does fix the problem on baremetal, thanks. My 32-bit Xen guests still 
> > fail which I thought was the same issue but now that I looked at it more 
> > carefully it has different signature.
> 
> I do not think Xen is hitting this, but I think page_level_mask() has the same
> issue for a long time.  I will set up 32-bit env on a system with >4GB memory 
> to verify this.

As Kirill explained me in his code review comment for *PAGE_MASK, page_level_mas
k() is fine as it is used for virtual addresses.

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

[toc] | [prev] | [next] | [standalone]


#1265987 — Re: [PATCH v4 RESEND 4/11] x86/asm: Fix pud/pmd interfaces to handle large PAT bit

From"Kirill A. Shutemov" <kirill@shutemov.name>
Date2015-11-09 21:20 +0100
SubjectRe: [PATCH v4 RESEND 4/11] x86/asm: Fix pud/pmd interfaces to handle large PAT bit
Message-ID<qt150-2JC-21@gated-at.bofh.it>
In reply to#1265959
On Mon, Nov 09, 2015 at 12:16:41PM -0700, Toshi Kani wrote:
> On Mon, 2015-11-09 at 13:06 -0500, Boris Ostrovsky wrote:
> > On 09/17/2015 02:24 PM, Toshi Kani wrote:
> > > Now that we have pud/pmd mask interfaces, which handle pfn & flags
> > > mask properly for the large PAT bit.
> > > 
> > > Fix pud/pmd pfn & flags interfaces by replacing PTE_PFN_MASK and
> > > PTE_FLAGS_MASK with the pud/pmd mask interfaces.
> > > 
> > > Suggested-by: Juergen Gross <jgross@suse.com>
> > > Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
> > > Cc: Juergen Gross <jgross@suse.com>
> > > Cc: Konrad Wilk <konrad.wilk@oracle.com>
> > > Cc: Thomas Gleixner <tglx@linutronix.de>
> > > Cc: H. Peter Anvin <hpa@zytor.com>
> > > Cc: Ingo Molnar <mingo@redhat.com>
> > > Cc: Borislav Petkov <bp@alien8.de>
> > > ---
> > >   arch/x86/include/asm/pgtable.h       |   14 ++++++++------
> > >   arch/x86/include/asm/pgtable_types.h |    4 ++--
> > >   2 files changed, 10 insertions(+), 8 deletions(-)
> > > 
> > 
> > 
> > Looks like this commit is causing this splat for 32-bit kernels. I am 
> > attaching my config file, just in case.
> 
> Thanks for the report!  I'd like to reproduce the issue since I am not sure how
> this change caused it...
> 
> I tried to build a kernel with the attached config file, and got the following
> error.  Not sure what I am missing.  

The problem is that PMD_PAGE_MASK as well as PUD_PAGE_MASK are 'unsigned
long', not 'unsigned long long'. So on 32-bit with PAE enabled your
pmd_pfn_mask()/pud_pfn_mask() will truncate bits 32..43 of pmd/pudval and
you'll never get proper page frame for pages above 4G.

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

[toc] | [prev] | [next] | [standalone]


#1266022

FromToshi Kani <toshi.kani@hpe.com>
Date2015-11-09 22:20 +0100
Message-ID<qt215-3od-39@gated-at.bofh.it>
In reply to#1265987
On Mon, 2015-11-09 at 22:10 +0200, Kirill A. Shutemov wrote:
> On Mon, Nov 09, 2015 at 12:16:41PM -0700, Toshi Kani wrote:
> > On Mon, 2015-11-09 at 13:06 -0500, Boris Ostrovsky wrote:
> > > On 09/17/2015 02:24 PM, Toshi Kani wrote:
> > > > Now that we have pud/pmd mask interfaces, which handle pfn & flags
> > > > mask properly for the large PAT bit.
> > > > 
> > > > Fix pud/pmd pfn & flags interfaces by replacing PTE_PFN_MASK and
> > > > PTE_FLAGS_MASK with the pud/pmd mask interfaces.
> > > > 
> > > > Suggested-by: Juergen Gross <jgross@suse.com>
> > > > Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
> > > > Cc: Juergen Gross <jgross@suse.com>
> > > > Cc: Konrad Wilk <konrad.wilk@oracle.com>
> > > > Cc: Thomas Gleixner <tglx@linutronix.de>
> > > > Cc: H. Peter Anvin <hpa@zytor.com>
> > > > Cc: Ingo Molnar <mingo@redhat.com>
> > > > Cc: Borislav Petkov <bp@alien8.de>
> > > > ---
> > > >   arch/x86/include/asm/pgtable.h       |   14 ++++++++------
> > > >   arch/x86/include/asm/pgtable_types.h |    4 ++--
> > > >   2 files changed, 10 insertions(+), 8 deletions(-)
> > > > 
> > > 
> > > 
> > > Looks like this commit is causing this splat for 32-bit kernels. I am 
> > > attaching my config file, just in case.
> > 
> > Thanks for the report!  I'd like to reproduce the issue since I am not sure 
> > how this change caused it...
> > 
> > I tried to build a kernel with the attached config file, and got the 
> > following error.  Not sure what I am missing.  
> 
> The problem is that PMD_PAGE_MASK as well as PUD_PAGE_MASK are 'unsigned
> long', not 'unsigned long long'. So on 32-bit with PAE enabled your
> pmd_pfn_mask()/pud_pfn_mask() will truncate bits 32..43 of pmd/pudval and
> you'll never get proper page frame for pages above 4G.

Thanks Kirill!  Yes, this explains the issue.  Since I did not change these
MASKs, and I tested 32-bit kernels on a small system, I was not able to catch
this issue...
-Toshi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web