]> Git Repo - linux.git/commit - arch/x86/kernel/smpboot.c
x86/mm/64: Initialize CR4.PCIDE early
authorAndy Lutomirski <[email protected]>
Mon, 11 Sep 2017 00:48:27 +0000 (17:48 -0700)
committerIngo Molnar <[email protected]>
Wed, 13 Sep 2017 07:54:43 +0000 (09:54 +0200)
commitc7ad5ad297e644601747d6dbee978bf85e14f7bc
treec64d91dacc129d327d2c9af7770efb02dce455d5
parentf34902c5c6c08024371202a680ce69f2d488776d
x86/mm/64: Initialize CR4.PCIDE early

cpu_init() is weird: it's called rather late (after early
identification and after most MMU state is initialized) on the boot
CPU but is called extremely early (before identification) on secondary
CPUs.  It's called just late enough on the boot CPU that its CR4 value
isn't propagated to mmu_cr4_features.

Even if we put CR4.PCIDE into mmu_cr4_features, we'd hit two
problems.  First, we'd crash in the trampoline code.  That's
fixable, and I tried that.  It turns out that mmu_cr4_features is
totally ignored by secondary_start_64(), though, so even with the
trampoline code fixed, it wouldn't help.

This means that we don't currently have CR4.PCIDE reliably initialized
before we start playing with cpu_tlbstate.  This is very fragile and
tends to cause boot failures if I make even small changes to the TLB
handling code.

Make it more robust: initialize CR4.PCIDE earlier on the boot CPU
and propagate it to secondary CPUs in start_secondary().

( Yes, this is ugly.  I think we should have improved mmu_cr4_features
  to actually control CR4 during secondary bootup, but that would be
  fairly intrusive at this stage. )

Signed-off-by: Andy Lutomirski <[email protected]>
Reported-by: Sai Praneeth Prakhya <[email protected]>
Tested-by: Sai Praneeth Prakhya <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Fixes: 660da7c9228f ("x86/mm: Enable CR4.PCIDE on supported systems")
Signed-off-by: Ingo Molnar <[email protected]>
arch/x86/kernel/cpu/common.c
arch/x86/kernel/setup.c
arch/x86/kernel/smpboot.c
arch/x86/mm/init.c
This page took 0.068293 seconds and 4 git commands to generate.