Skip to content

Commit

Permalink
x86: Init per-cpu shadow copy of CR4 on 32-bit CPUs too
Browse files Browse the repository at this point in the history
[ Upstream commit 5b2bdbc ]

Commit:

   1e02ce4 ("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@gandalf.local.home Fixes: 1e02ce4 "x86: Store a per-cpu shadow copy of CR4"
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Andy Lutomirski <luto@amacapital.net>
Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/20150227145019.2bdd4354@gandalf.local.home
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
  • Loading branch information
Steven Rostedt authored and Sasha Levin committed Oct 28, 2015
1 parent 4f1a98a commit 4534a1c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions arch/x86/kernel/cpu/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1405,6 +1405,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);
Expand Down

0 comments on commit 4534a1c

Please sign in to comment.