[PATCH v4 2/7] genirq: Allow global interrupts in request_nmi()

From: Mayank Rungta

Date: Wed Nov 11 2026 - 22:23:03 EST


request_nmi() currently requires IRQF_PERCPU and forces
IRQF_NOBALANCING. For global system-wide interrupts (such as watchdog
pretimeout SPIs), forcing IRQF_PERCPU sets IRQD_PER_CPU and prevents CPU
hotplug teardown (migrate_one_irq()) from migrating the interrupt off an
offline CPU.

Now that in-flight NMI handlers are synchronized via
__synchronize_nmi(), drop the mandatory IRQF_PERCPU check and stop
forcing IRQF_NOBALANCING in request_nmi() (existing per-CPU callers
already pass both flags explicitly). Also check irq_is_nmi(desc) in
irq_seq_show() (matching kstat_irqs_desc() from commit c09cb1293523
("genirq: Update irq stats from NMI handlers")) so /proc/interrupts
emits per-CPU counts for non-IRQF_PERCPU NMIs.

Signed-off-by: Mayank Rungta <mrungta@xxxxxxxxxx>
---
kernel/irq/manage.c | 9 +++------
kernel/irq/proc.c | 6 ++++--
2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 3fb77a2d954d..bd7cf91719d7 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -2352,8 +2352,8 @@ EXPORT_SYMBOL_GPL(request_any_context_irq);
* An interrupt line delivering NMIs cannot be shared and IRQ handling
* cannot be threaded.
*
- * Interrupt lines requested for NMI delivering must produce per cpu
- * interrupts and have auto enabling setting disabled.
+ * Interrupt lines requested for NMI delivering must have auto enabling
+ * setting disabled.
*
* @dev_id must be globally unique. Normally the address of the device data
* structure is used as the cookie. Since the handler receives this value
@@ -2376,9 +2376,6 @@ int request_nmi(unsigned int irq, irq_handler_t handler,
if (irqflags & (IRQF_SHARED | IRQF_COND_SUSPEND | IRQF_IRQPOLL))
return -EINVAL;

- if (!(irqflags & IRQF_PERCPU))
- return -EINVAL;
-
if (!handler)
return -EINVAL;

@@ -2396,7 +2393,7 @@ int request_nmi(unsigned int irq, irq_handler_t handler,
return -ENOMEM;

action->handler = handler;
- action->flags = irqflags | IRQF_NO_THREAD | IRQF_NOBALANCING;
+ action->flags = irqflags | IRQF_NO_THREAD;
action->name = name;
action->dev_id = dev_id;

diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index 0c0df16de581..d92f456191e1 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -559,10 +559,12 @@ static int irq_seq_show(struct seq_file *p, void *v)
seq_putc(p, ':');

/*
- * Always output per CPU interrupts. Output device interrupts only when
- * desc::tot_count is not zero.
+ * Always output per CPU and NMI interrupts, as NMI handlers only
+ * update per-CPU kstat counters and leave desc::tot_count zero.
+ * Output other device interrupts only when desc::tot_count is not zero.
*/
if (irq_settings_is_per_cpu(desc) || irq_settings_is_per_cpu_devid(desc) ||
+ irq_is_nmi(desc) ||
data_race(desc->tot_count))
irq_proc_emit_counts(p, &desc->kstat_irqs->cnt);
else
--
2.56.0.611.g1030f0b940-goog