[PATCH 2/7] x86/apic: Implement self-NMI support

Chang S. Bae posted 7 patches 2 weeks ago
[PATCH 2/7] x86/apic: Implement self-NMI support
Posted by Chang S. Bae 2 weeks ago
From: David Kaplan <david.kaplan@amd.com>

Add function to send an NMI-to-self which is needed for stop_machine_nmi().
Note that send_IPI_self() cannot be used to send an NMI so send_IPI() is
used.

Signed-off-by: David Kaplan <david.kaplan@amd.com>
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
---
Updates from the original version:
* Rename the subject to highlight arch-side "implementation"
---
 arch/x86/kernel/apic/ipi.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/x86/kernel/apic/ipi.c b/arch/x86/kernel/apic/ipi.c
index 98a57cb4aa86..6d4e5aa27529 100644
--- a/arch/x86/kernel/apic/ipi.c
+++ b/arch/x86/kernel/apic/ipi.c
@@ -4,6 +4,7 @@
 #include <linux/delay.h>
 #include <linux/smp.h>
 #include <linux/string_choices.h>
+#include <linux/stop_machine.h>
 
 #include <asm/io_apic.h>
 
@@ -248,6 +249,12 @@ void default_send_IPI_self(int vector)
 	__default_send_IPI_shortcut(APIC_DEST_SELF, vector);
 }
 
+/* Self-NMI is used in stop_machine_nmi() */
+void arch_send_self_nmi(void)
+{
+	apic->send_IPI(smp_processor_id(), NMI_VECTOR);
+}
+
 #ifdef CONFIG_X86_32
 void default_send_IPI_mask_sequence_logical(const struct cpumask *mask, int vector)
 {
-- 
2.51.0
Re: [PATCH 2/7] x86/apic: Implement self-NMI support
Posted by Thomas Gleixner 1 week, 4 days ago
On Sun, Jan 25 2026 at 01:42, Chang S. Bae wrote:
> From: David Kaplan <david.kaplan@amd.com>
>
> Add function to send an NMI-to-self which is needed for stop_machine_nmi().

Add _a_ function... It's not that hard to write proper sentences.
Re: [PATCH 2/7] x86/apic: Implement self-NMI support
Posted by Chang S. Bae 1 week, 3 days ago
On 1/28/2026 12:05 AM, Thomas Gleixner wrote:
> On Sun, Jan 25 2026 at 01:42, Chang S. Bae wrote:
>> From: David Kaplan <david.kaplan@amd.com>
>>
>> Add function to send an NMI-to-self which is needed for stop_machine_nmi().
> 
> Add _a_ function... It's not that hard to write proper sentences.

My apologies. I should have caught the typo.