]> git.baikalelectronics.ru Git - kernel.git/commit
x86/apic: Plug racy xAPIC access of CPU hotplug code
authorJan Kiszka <jan.kiszka@siemens.com>
Mon, 27 Jan 2014 19:14:06 +0000 (20:14 +0100)
committerIngo Molnar <mingo@kernel.org>
Tue, 11 Mar 2014 11:03:31 +0000 (12:03 +0100)
commit9ba665b6983c2bc1708fbf177d7d08e6a36f5ce3
treed67398dcdacf14f473de2db3f1dcf6a1c69ef782
parent4645af2524947362e699bc0d0b98632afa336788
x86/apic: Plug racy xAPIC access of CPU hotplug code

apic_icr_write() and its users in smpboot.c were apparently
written under the assumption that this code would only run
during early boot. But nowadays we also execute it when onlining
a CPU later on while the system is fully running. That will make
wakeup_cpu_via_init_nmi and, thus, also native_apic_icr_write
run in plain process context. If we migrate the caller to a
different CPU at the wrong time or interrupt it and write to
ICR/ICR2 to send unrelated IPIs, we can end up sending INIT,
SIPI or NMIs to wrong CPUs.

Fix this by disabling interrupts during the write to the ICR
halves and disable preemption around waiting for ICR
availability and using it.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Tested-By: Igor Mammedov <imammedo@redhat.com>
Link: http://lkml.kernel.org/r/52E6AFFE.3030004@siemens.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/kernel/apic/apic.c
arch/x86/kernel/smpboot.c