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


Groups > linux.kernel > #1733517

[tip:x86/urgent] x86/mm/32: Move setup_clear_cpu_cap(X86_FEATURE_PCID) earlier

From tip-bot for Andy Lutomirski <tipbot@zytor.com>
Newsgroups linux.kernel
Subject [tip:x86/urgent] x86/mm/32: Move setup_clear_cpu_cap(X86_FEATURE_PCID) earlier
Date 2017-09-17 20:30 +0200
Message-ID <uqMul-36u-9@gated-at.bofh.it> (permalink)
References <uqKiS-1NC-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Commit-ID:  b8b7abaed7a49b350f8ba659ddc264b04931d581
Gitweb:     http://git.kernel.org/tip/b8b7abaed7a49b350f8ba659ddc264b04931d581
Author:     Andy Lutomirski <luto@kernel.org>
AuthorDate: Sun, 17 Sep 2017 09:03:50 -0700
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Sun, 17 Sep 2017 18:59:08 +0200

x86/mm/32: Move setup_clear_cpu_cap(X86_FEATURE_PCID) earlier

Otherwise we might have the PCID feature bit set during cpu_init().

This is just for robustness.  I haven't seen any actual bugs here.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bpetkov@suse.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: cba4671af755 ("x86/mm: Disable PCID on 32-bit kernels")
Link: http://lkml.kernel.org/r/b16dae9d6b0db5d9801ddbebbfd83384097c61f3.1505663533.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/cpu/bugs.c   | 8 --------
 arch/x86/kernel/cpu/common.c | 8 ++++++++
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index db68488..0af86d9 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -21,14 +21,6 @@
 
 void __init check_bugs(void)
 {
-#ifdef CONFIG_X86_32
-	/*
-	 * Regardless of whether PCID is enumerated, the SDM says
-	 * that it can't be enabled in 32-bit mode.
-	 */
-	setup_clear_cpu_cap(X86_FEATURE_PCID);
-#endif
-
 	identify_boot_cpu();
 
 	if (!IS_ENABLED(CONFIG_SMP)) {
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 775f101..c9176ba 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -904,6 +904,14 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
 
 	setup_force_cpu_cap(X86_FEATURE_ALWAYS);
 	fpu__init_system(c);
+
+#ifdef CONFIG_X86_32
+	/*
+	 * Regardless of whether PCID is enumerated, the SDM says
+	 * that it can't be enabled in 32-bit mode.
+	 */
+	setup_clear_cpu_cap(X86_FEATURE_PCID);
+#endif
 }
 
 void __init early_cpu_init(void)

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/4] More PCID fixes Andy Lutomirski <luto@kernel.org> - 2017-09-17 18:10 +0200
  [PATCH 3/4] x86/mm/32: Move setup_clear_cpu_cap(X86_FEATURE_PCID) earlier Andy Lutomirski <luto@kernel.org> - 2017-09-17 18:10 +0200
    [tip:x86/urgent] x86/mm/32: Move  setup_clear_cpu_cap(X86_FEATURE_PCID) earlier tip-bot for Andy Lutomirski <tipbot@zytor.com> - 2017-09-17 20:30 +0200
  [PATCH 4/4] x86/mm/32: Load a sane CR3 before cpu_init() on secondary CPUs Andy Lutomirski <luto@kernel.org> - 2017-09-17 18:10 +0200
    [tip:x86/urgent] x86/mm/32: Load a sane CR3 before cpu_init() on  secondary CPUs tip-bot for Andy Lutomirski <tipbot@zytor.com> - 2017-09-17 20:30 +0200
      Re: [tip:x86/urgent] x86/mm/32: Load a sane CR3 before cpu_init() on  secondary CPUs Paul Menzel <pmenzel@molgen.mpg.de> - 2017-09-18 10:20 +0200
      Re: [tip:x86/urgent] x86/mm/32: Load a sane CR3 before cpu_init() on  secondary CPUs Pavel Machek <pavel@ucw.cz> - 2017-09-20 15:00 +0200
  [PATCH 2/4] x86/mm/64: Stop using CR3.PCID == 0 in ASID-aware code Andy Lutomirski <luto@kernel.org> - 2017-09-17 18:10 +0200
    [tip:x86/urgent] x86/mm/64: Stop using CR3.PCID == 0 in ASID-aware  code tip-bot for Andy Lutomirski <tipbot@zytor.com> - 2017-09-17 20:30 +0200
  [PATCH 1/4] x86/mm: Factor out CR3-building code Andy Lutomirski <luto@kernel.org> - 2017-09-17 18:10 +0200
    [tip:x86/urgent] x86/mm: Factor out CR3-building code tip-bot for Andy Lutomirski <tipbot@zytor.com> - 2017-09-17 20:30 +0200

csiph-web