[tip:x86/urgent] x86: Init per-cpu shadow copy of CR4 on 32-bit CPUs too

From: tip-bot for Steven Rostedt
Date: Sat Feb 28 2015 - 02:08:22 EST


Commit-ID: 5b2bdbc84556774afbe11bcfd24c2f6411cfa92b
Gitweb: http://git.kernel.org/tip/5b2bdbc84556774afbe11bcfd24c2f6411cfa92b
Author: Steven Rostedt <rostedt@xxxxxxxxxxx>
AuthorDate: Fri, 27 Feb 2015 14:50:19 -0500
Committer: Ingo Molnar <mingo@xxxxxxxxxx>
CommitDate: Sat, 28 Feb 2015 08:04:20 +0100

x86: Init per-cpu shadow copy of CR4 on 32-bit CPUs too

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 64-bit and one for 32-bit. The commit only added
the shadow init to the 64-bit path, but the 32-bit path
needs the init too.

Link: http://lkml.kernel.org/r/20150227125208.71c36402@xxxxxxxxxxxxxxxxxx Fixes: 1e02ce4cccdc "x86: Store a per-cpu shadow copy of CR4"
Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
Acked-by: Andy Lutomirski <luto@xxxxxxxxxxxxxx>
Cc: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Link: http://lkml.kernel.org/r/20150227145019.2bdd4354@xxxxxxxxxxxxxxxxxx
Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
---
arch/x86/kernel/cpu/common.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index b5c8ff5..2346c95 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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/