Skip to contentSkip to conversation

v6.14: fix hardirq context detection

Dovetail Philippe Gerum 1 participant 1 message Mar 3, 2025 IRQ

lore
Share & tools
lore
#0 lore raw

Hi Florian,

As we discussed, this should help with the IRQ denial you spotted on v6.14. I'll take care of backporting this patch to v6.1.y-cip and v6.12.y.

---

From: Philippe Gerum <[email protected]>
Subject: [PATCH] genirq: irq_pipeline: fix hardirq context detection (irqctx)

Each incoming IRQ passed to handle_irq_desc() is checked for calling context correctness, in order to detect invalid calls from non-interrupt context for interrupts marked as IRQD_HANDLE_ENFORCE_IRQCTX.

When pipelining is enabled, the IRQ context spans from the early handling from the pipeline entry (i.e. in_pipeline()) up to the completion point of the full interrupt path, which includes the oob->in-band deferral path.

The test checking for the latter was mistakenly inverted, causing the interrupt to be dismissed if bearing the IRQD_HANDLE_ENFORCE_IRQCTX flag.

---
 kernel/irq/irqdesc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/irq/irqdesc.c +1 -1
index 151ed61a88ae3..110ceb75d0f4b 100644
@@ -706,7 +706,7 @@ static inline bool is_hardirq(struct irq_desc *desc)
 	if (!irqs_pipelined())
 		return in_hardirq();
 
-	if (in_pipeline() || !(desc->istate & IRQS_DEFERRED))
+	if (in_pipeline() || (desc->istate & IRQS_DEFERRED))
 		return true;
 
 	return false;
Signature · 4 lines
2.48.1

-- 
Philippe.