[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150227145019.2bdd4354@gandalf.local.home>
Date: Fri, 27 Feb 2015 14:50:19 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Andy Lutomirski <luto@...capital.net>,
Thomas Gleixner <tglx@...utronix.de>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>
Subject: [PATCH] x86: Init per-cpu shadow copy of CR4 for i386 too
On Fri, 27 Feb 2015 10:59:52 -0800
Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> Presumably there is some initialization missing - I suspect that the
> cached value of cr4 is from the *previous* time the CPU was up, and we
> don't correctly initialize the cached copy at early CPU bringup.
Found it. The problem is that there's two cpu_init()s in common.c. Andy
only added the cr4 init to one of them.
x86: Init per-cpu shadow copy of CR4 for i386 too
The commit 1e02ce4cccdc "x86: Store a per-cpu shadow copy of CR4" added
a shadow CR4 such that reads and writes that do not modify the CR4
execute much faster than always reading the register itself.
The change modified cpu_init() in common.c, so that the shadow CR4 gets
initialized before anything uses it. Unfortunately, there's two
cpu_init()s in common.c. There's one for x86_64 and one for i386. The
commit only added the shadow init to x86_64. The i386 needs the init
too.
Link: http://lkml.kernel.org/r/20150227125208.71c36402@gandalf.local.home
Fixes: 1e02ce4cccdc "x86: Store a per-cpu shadow copy of CR4"
Signed-off-by: Steven Rostedt <rostedt@...dmis.org>
---
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index b5c8ff5e9dfc..2346c95c6ab1 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1396,6 +1396,12 @@ void cpu_init(void)
wait_for_master_cpu(cpu);
+ /*
+ * Initialize the CR4 shadow before doing anything that could
+ * try to read it.
+ */
+ cr4_init_shadow();
+
show_ucode_info_early();
printk(KERN_INFO "Initializing CPU#%d\n", cpu);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists