Patch "x86/PAT: Fix Xorg regression on CPUs that don't support PAT" has been added to the 4.11-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
x86/PAT: Fix Xorg regression on CPUs that don't support PAT
to the 4.11-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
x86-pat-fix-xorg-regression-on-cpus-that-don-t-support-pat.patch
and it can be found in the queue-4.11 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
cbed27cdf0e3f7ea3b2259e86b9e34df02be3fe4Mon Sep 17 00:00:00 2001
From: Mikulas Patocka <[email protected]>
Date: Tue, 18 Apr 2017 15:07:11 -0400
Subject: x86/PAT: Fix Xorg regression on CPUs that don't support PAT
From: Mikulas Patocka <[email protected]>
commit cbed27cdf0e3f7ea3b2259e86b9e34df02be3fe4 upstream.
In the file arch/x86/mm/pat.c, there's a '__pat_enabled' variable. The variable is set to 1 by default and the function pat_init() sets __pat_enabled to 0 if the CPU doesn't support PAT.
However, on AMD K6-3 CPUs, the processor initialization code never calls pat_init() and so __pat_enabled stays 1 and the function pat_enabled() returns true, even though the K6-3 CPU doesn't support PAT.
The result of this bug is that a kernel warning is produced when attempting to start the Xserver and the Xserver doesn't start (fork() returns ENOMEM). Another symptom of this bug is that the framebuffer driver doesn't set the K6-3 MTRR registers:
x86/PAT: Xorg:3891 map pfn expected mapping type uncached-minus for [mem 0xe4000000-0xe5ffffff], got write-combining
------------[ cut here ]------------ WARNING: CPU: 0 PID: 3891 at arch/x86/mm/pat.c:1020 untrack_pfn+0x5c/0x9f ... x86/PAT: Xorg:3891 map pfn expected mapping type uncached-minus for [mem 0xe4000000-0xe5ffffff], got write-combining
To fix the bug change pat_enabled() so that it returns true only if PAT initialization was actually done.
Also, I changed boot_cpu_has(X86_FEATURE_PAT) to this_cpu_has(X86_FEATURE_PAT) in pat_ap_init(), so that we check the PAT feature on the processor that is being initialized.
--- arch/x86/mm/pat.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
arch/x86/mm/pat.c +6 -3
@@ -64,9 +64,11 @@ static int __init nopat(char *str) }early_param ("nopat" , nopat); +static bool __read_mostly __pat_initialized = false; +bool pat_enabled (void ) { -return !!__pat_enabled; +return __pat_initialized; }EXPORT_SYMBOL_GPL (pat_enabled);
@@ -224,13 +226,14 @@ static void pat_bsp_init(u64 pat) }wrmsrl (MSR_IA32_CR_PAT , pat); + __pat_initialized = true;__init_cache_modes (pat); }static void pat_ap_init (u64 pat) { -if (!boot_cpu_has (X86_FEATURE_PAT )) { +if (!this_cpu_has (X86_FEATURE_PAT )) {/* * If this happens we are on a secondary CPU, but switched to * PAT on the boot CPU. We have no way to undo PAT.
@@ -305,7 +308,7 @@ void pat_init(void)u64 pat;struct cpuinfo_x86 *c = &boot_cpu_data; -if (!pat_enabled ()) { +if (!__pat_enabled) {init_cache_modes ();return ; }
Patches currently in stable-queue which might be from [email protected] are
queue-4.11/x86-pat-fix-xorg-regression-on-cpus-that-don-t-support-pat.patch
Hi
Please remove this patch from all stable kernels because it causes boot failure for some people. I will send another patch.
Mikulas
Quoted 118 lines · On Mon, 5 Jun 2017, [email protected] wrote:
This is a note to let you know that I've just added the patch titled
x86/PAT: Fix Xorg regression on CPUs that don't support PAT
to the 4.11-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summaryThe filename of the patch is:
x86-pat-fix-xorg-regression-on-cpus-that-don-t-support-pat.patch
and it can be found in the queue-4.11 subdirectory.If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
cbed27cdf0e3f7ea3b2259e86b9e34df02be3fe4Mon Sep 17 00:00:00 2001From: Mikulas Patocka <[email protected]>
Date: Tue, 18 Apr 2017 15:07:11 -0400
Subject: x86/PAT: Fix Xorg regression on CPUs that don't support PATFrom: Mikulas Patocka <[email protected]>
commit
cbed27cdf0e3f7ea3b2259e86b9e34df02be3fe4upstream.In the file
arch/x86/mm/pat.c, there's a '__pat_enabled' variable. The variable is set to 1 by default and the functionpat_init()sets__pat_enabledto 0 if the CPU doesn't support PAT.However, on AMD K6-3 CPUs, the processor initialization code never calls
pat_init()and so__pat_enabledstays 1 and the functionpat_enabled()returns true, even though the K6-3 CPU doesn't support PAT.The result of this bug is that a kernel warning is produced when attempting to start the Xserver and the Xserver doesn't start (
fork()returns ENOMEM). Another symptom of this bug is that the framebuffer driver doesn't set the K6-3 MTRR registers:x86/PAT: Xorg:3891 map pfn expected mapping type uncached-minus for [mem 0xe4000000-0xe5ffffff], got write-combining
------------[ cut here ]------------ WARNING: CPU: 0 PID: 3891 at arch/x86/mm/pat.c:1020 untrack_pfn+0x5c/0x9f ... x86/PAT: Xorg:3891 map pfn expected mapping type uncached-minus for [mem 0xe4000000-0xe5ffffff], got write-combiningTo fix the bug change
pat_enabled()so that it returns true only if PAT initialization was actually done.Also, I changed
boot_cpu_has(X86_FEATURE_PAT)tothis_cpu_has(X86_FEATURE_PAT)inpat_ap_init(), so that we check the PAT feature on the processor that is being initialized.Signed-off-by Mikulas Patocka <[email protected]>Cc Andrew Morton <[email protected]>Cc Andy Lutomirski <[email protected]>Cc Borislav Petkov <[email protected]>Cc Brian Gerst <[email protected]>Cc Denys Vlasenko <[email protected]>Cc H. Peter Anvin <[email protected]>Cc Josh Poimboeuf <[email protected]>Cc Linus Torvalds <[email protected]>Cc Luis R. Rodriguez <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Toshi Kani <[email protected]>Link http://lkml.kernel.org/r/alpine.LRH.2.02.1704181501450.26399@file01.intranet.prod.int.rdu2.redhat.com open hereSigned-off-by Ingo Molnar <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- arch/x86/mm/pat.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)arch/x86/mm/pat.c +6
-3@@ -64,9 +64,11 @@ static int __init nopat(char *str) }early_param ("nopat" , nopat); +static bool __read_mostly __pat_initialized = false; +bool pat_enabled (void ) { -return !!__pat_enabled; +return __pat_initialized; }EXPORT_SYMBOL_GPL (pat_enabled);@@ -224,13 +226,14 @@ static void pat_bsp_init(u64 pat) }wrmsrl (MSR_IA32_CR_PAT , pat); + __pat_initialized = true;__init_cache_modes (pat); }static void pat_ap_init (u64 pat) { -if (!boot_cpu_has (X86_FEATURE_PAT )) { +if (!this_cpu_has (X86_FEATURE_PAT )) {/* * If this happens we are on a secondary CPU, but switched to * PAT on the boot CPU. We have no way to undo PAT. @@ -305,7 +308,7 @@ void pat_init(void)u64 pat;struct cpuinfo_x86 *c = &boot_cpu_data; -if (!pat_enabled ()) { +if (!__pat_enabled) {init_cache_modes ();return ; }Patches currently in stable-queue which might be from [email protected] are
queue-4.11/x86-pat-fix-xorg-regression-on-cpus-that-don-t-support-pat.patch
Greg KH
maintainerQuoted 4 lines · Mikulas Patocka
Hi
Please remove this patch from all stable kernels because it causes boot failure for some people. I will send another patch.
Ok, now dropped, thanks for letting me know.
greg k-h