Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

genirq: warn when IRQF_DISABLED may be ignored

Impact: emit new warning

We periodically waste time tracking down problems from the genirq
framework not respecting IRQF_DISABLED for some shared IRQ cases. Linus
views this as "will not fix", but we're still left with the bugs caused by
this misbehavior.

This patch adds a nag message in request_irq(), so that drivers can fix
their IRQ handlers to avoid this problem.

Note that developers will never see the relevant bugs when they run with
LOCKDEP, so it's no wonder these bugs are hard to find. (That also means
LOCKDEP is overlooking some IRQ-related bugs involving IRQ handlers that
don't set IRQF_DISABLED...)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

authored by

David Brownell and committed by
Ingo Molnar
470c6623 7807fafa

+12
+12
kernel/irq/manage.c
··· 635 635 struct irq_desc *desc; 636 636 int retval; 637 637 638 + /* 639 + * handle_IRQ_event() always ignores IRQF_DISABLED except for 640 + * the _first_ irqaction (sigh). That can cause oopsing, but 641 + * the behavior is classified as "will not fix" so we need to 642 + * start nudging drivers away from using that idiom. 643 + */ 644 + if ((irqflags & (IRQF_SHARED|IRQF_DISABLED)) 645 + == (IRQF_SHARED|IRQF_DISABLED)) 646 + pr_warning("IRQ %d/%s: IRQF_DISABLED is not " 647 + "guaranteed on shared IRQs\n", 648 + irq, devname); 649 + 638 650 #ifdef CONFIG_LOCKDEP 639 651 /* 640 652 * Lockdep wants atomic interrupt handlers: