summaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/apic/local.h
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2019-07-22 20:47:22 +0200
committerThomas Gleixner <tglx@linutronix.de>2019-07-25 16:12:00 +0200
commit6a1cb5f5c6413222b8532722562dd1edb5fdfd38 (patch)
tree140ed1ae3359c26ebc75ace8ff334a231a982bf4 /arch/x86/kernel/apic/local.h
parentbdda3b93e66085abf0b2c16bcdf471176e3c816a (diff)
downloadlinux-stable-6a1cb5f5c6413222b8532722562dd1edb5fdfd38.tar.gz
linux-stable-6a1cb5f5c6413222b8532722562dd1edb5fdfd38.tar.bz2
linux-stable-6a1cb5f5c6413222b8532722562dd1edb5fdfd38.zip
x86/apic: Add static key to Control IPI shorthands
The IPI shorthand functionality delivers IPI/NMI broadcasts to all CPUs in the system. This can have similar side effects as the MCE broadcasting when CPUs are waiting in the BIOS or are offlined. The kernel tracks already the state of offlined CPUs whether they have been brought up at least once so that the CR4 MCE bit is set to make sure that MCE broadcasts can't brick the machine. Utilize that information and compare it to the cpu_present_mask. If all present CPUs have been brought up at least once then the broadcast side effect is mitigated by disabling regular interrupt/IPI delivery in the APIC itself and by the cpu offline check at the begin of the NMI handler. Use a static key to switch between broadcasting via shorthands or sending the IPI/NMI one by one. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/20190722105220.386410643@linutronix.de
Diffstat (limited to 'arch/x86/kernel/apic/local.h')
-rw-r--r--arch/x86/kernel/apic/local.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/kernel/apic/local.h b/arch/x86/kernel/apic/local.h
index bd074e5997b0..391594cd5ca9 100644
--- a/arch/x86/kernel/apic/local.h
+++ b/arch/x86/kernel/apic/local.h
@@ -7,6 +7,9 @@
* (c) 1998-99, 2000 Ingo Molnar <mingo@redhat.com>
* (c) 2002,2003 Andi Kleen, SuSE Labs.
*/
+
+#include <linux/jump_label.h>
+
#include <asm/apic.h>
/* APIC flat 64 */
@@ -22,6 +25,9 @@ int x2apic_phys_pkg_id(int initial_apicid, int index_msb);
void x2apic_send_IPI_self(int vector);
/* IPI */
+
+DECLARE_STATIC_KEY_FALSE(apic_use_ipi_shorthand);
+
static inline unsigned int __prepare_ICR(unsigned int shortcut, int vector,
unsigned int dest)
{