From: David Kaplan <david.kaplan@amd.com>
Call stop_machine_nmi_handler() from the NMI path when the corresponding
static key is enabled, in order to support stop_machine_nmi().
Signed-off-by: David Kaplan <david.kaplan@amd.com>
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
---
Update from the original posting:
* Massage the subject and expand changelog a little bit.
---
arch/x86/kernel/nmi.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c
index 3d239ed12744..4bc4b49f1ea7 100644
--- a/arch/x86/kernel/nmi.c
+++ b/arch/x86/kernel/nmi.c
@@ -24,6 +24,7 @@
#include <linux/export.h>
#include <linux/atomic.h>
#include <linux/sched/clock.h>
+#include <linux/stop_machine.h>
#include <linux/kvm_types.h>
#include <asm/cpu_entry_area.h>
@@ -382,6 +383,9 @@ static noinstr void default_do_nmi(struct pt_regs *regs)
instrumentation_begin();
+ if (stop_machine_nmi_handler_enabled() && stop_machine_nmi_handler())
+ goto out;
+
if (microcode_nmi_handler_enabled() && microcode_nmi_handler())
goto out;
--
2.51.0