Skip to content

Commit aef30c8

Browse files
Sebastian Andrzej SiewiorThomas Gleixner
authored andcommitted
genirq: Warn about using IRQF_ONESHOT without a threaded handler
IRQF_ONESHOT disables the interrupt source until after the threaded handler completed its work. This is needed to allow the threaded handler to run - otherwise the CPU will get back to the interrupt handler because the interrupt source remains active and the threaded handler will not able to do its work. Specifying IRQF_ONESHOT without a threaded handler does not make sense. It could be a leftover if the handler _was_ threaded and changed back to primary and the flag was not removed. This can be problematic in the `threadirqs' case because the handler is exempt from forced-threading. This in turn can become a problem on a PREEMPT_RT system if the handler attempts to acquire sleeping locks. Warn about missing threaded handlers with the IRQF_ONESHOT flag. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Link: https://patch.msgid.link/20260112134013.eQWyReHR@linutronix.de
1 parent 90876d9 commit aef30c8

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

kernel/irq/manage.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,6 +1473,13 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
14731473
if (!(new->flags & IRQF_TRIGGER_MASK))
14741474
new->flags |= irqd_get_trigger_type(&desc->irq_data);
14751475

1476+
/*
1477+
* IRQF_ONESHOT means the interrupt source in the IRQ chip will be
1478+
* masked until the threaded handled is done. If there is no thread
1479+
* handler then it makes no sense to have IRQF_ONESHOT.
1480+
*/
1481+
WARN_ON_ONCE(new->flags & IRQF_ONESHOT && !new->thread_fn);
1482+
14761483
/*
14771484
* Check whether the interrupt nests into another interrupt
14781485
* thread.

0 commit comments

Comments
 (0)