Re: PATCH: 2.6.26-rc8: Fix IRQF_DISABLED for shared interrupts

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Stefan Becker <Stefan.Becker@...>
Cc: <linux-kernel@...>, <linux-usb@...>, Alan Stern <stern@...>, Linus Torvalds <torvalds@...>
Date: Monday, June 30, 2008 - 3:57 pm

On Monday 30 June 2008, David Brownell wrote:

Well, here's a fix for that little problem.

Notice the rude interaction with LOCKDEP too.  If you used that,
you'd never have seen the behavior you saw.  And if you did use
that, with non-IRQF_DISABLED interrupt handlers, you'd wrongly
believe some IRQ code paths always ran with IRQs disabled...

- Dave


===== CUT HERE
We periodically have problems that get tracked down to the IRQ
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 will be missing some IRQ-related bugs
involving IRQ handlers that don't set IRQF_DISABLED.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
 kernel/irq/manage.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

--- a/kernel/irq/manage.c	2008-06-30 12:28:58.000000000 -0700
+++ b/kernel/irq/manage.c	2008-06-30 12:46:54.000000000 -0700
@@ -539,6 +539,18 @@ int request_irq(unsigned int irq, irq_ha
 	struct irqaction *action;
 	int retval;
 
+	/*
+	 * handle_IRQ_event() always ignores IRQF_DISABLED except for
+	 * the _first_ irqaction (sigh).  That can cause oopsing, but
+	 * the behavior is classified as "will not fix" so we need to
+	 * start nudging drivers away from using that idiom.
+	 */
+	if ((irqflags & (IRQF_SHARED|IRQF_DISABLED))
+			== (IRQF_SHARED|IRQF_DISABLED))
+		pr_warning("IRQ %d/%s: IRQF_DISABLED is not "
+				"guaranteed on shared IRQs\n",
+				irq, devname);
+
 #ifdef CONFIG_LOCKDEP
 	/*
 	 * Lockdep wants atomic interrupt handlers:

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
BUG in 2.6.26-rc8 interrupt handling, Becker Stefan (Nokia-D/Salo)..., (Sat Jun 28, 3:34 pm)
Re: BUG in 2.6.26-rc8 interrupt handling, David Brownell, (Sat Jun 28, 3:51 pm)
PATCH: 2.6.26-rc8: Fix IRQF_DISABLED for shared interrupts, Stefan Becker, (Sun Jun 29, 10:57 am)
Re: PATCH: 2.6.26-rc8: Fix IRQF_DISABLED for shared interrupts, David Brownell, (Mon Jun 30, 3:57 pm)
Re: [PATCH] USB: fix interrupt disabling for HCDs with share..., Leonardo Chiquitto, (Tue Jul 1, 10:19 am)
Re: PATCH: 2.6.26-rc8: Fix IRQF_DISABLED for shared interrupts, Henrique de Moraes Holschuh..., (Mon Jun 30, 10:28 am)