public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: Ingo Molnar <mingo@elte.hu>, linux-kernel@vger.kernel.org
Cc: Linus Torvalds <torvalds@osdl.org>
Subject: IRQF_DISABLED problem
Date: Thu, 26 Jul 2007 14:13:56 -0600	[thread overview]
Message-ID: <20070726201355.GP19275@parisc-linux.org> (raw)


I noticed that we only look at the first action in the chain when
determining whether to re-enable local interrupts during handle_IRQ_event.
But we don't try to exclude sharing interrupts with mixtures of
IRQF_DISABLED set and clear.  I just tried to do that locally, and one
of my USB ports disappears, because it shares an interrupt with qla2xxx
which sets IRQF_DISABLED, and UHCI doesn't.

Another possibility is to force it if *any* of the handlers want
IRQF_DISABLED.  This seems to work:

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 203a518..d804a0b 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -308,6 +308,15 @@ int setup_irq(unsigned int irq, struct irqaction *new)
 			goto mismatch;
 #endif
 
+		/* If one handler wants interrupts to be disabled,
+		 * they must all be disabled.  Rather than walk the list of
+		 * handlers twice at interrupt time, just make sure the
+		 * head handler has its flag set
+		 */
+		if ((new->flags & IRQF_DISABLED) &&
+		    !(old->flags & IRQF_DISABLED)
+			old->flags |= IRQF_DISABLED);
+
 		/* add new interrupt at end of irq queue */
 		do {
 			p = &old->next;


This patch makes interrupts requested with IRQF_DISABLED non-matching
fail, in case you think it's a better solution:

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 203a518..2c99b88 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -293,10 +293,12 @@ int setup_irq(unsigned int irq, struct irqaction *new)
 		 * Can't share interrupts unless both agree to and are
 		 * the same type (level, edge, polarity). So both flag
 		 * fields must have IRQF_SHARED set and the bits which
-		 * set the trigger type must match.
+		 * set the trigger type must match and the disabled bit
+		 * must match.
 		 */
 		if (!((old->flags & new->flags) & IRQF_SHARED) ||
-		    ((old->flags ^ new->flags) & IRQF_TRIGGER_MASK)) {
+		    ((old->flags ^ new->flags) &
+		     (IRQF_TRIGGER_MASK | IRQF_DISABLED))) {
 			old_name = old->name;
 			goto mismatch;
 		}

-- 
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

             reply	other threads:[~2007-07-26 20:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-26 20:13 Matthew Wilcox [this message]
2007-07-26 20:41 ` IRQF_DISABLED problem Linus Torvalds
2007-07-26 22:23 ` David Miller
2007-07-26 23:04   ` Linus Torvalds
2007-07-26 23:14     ` David Miller
2007-07-26 23:17     ` Linus Torvalds
2007-07-27 20:11       ` Arjan van de Ven
2007-07-27 20:50         ` David Miller
     [not found] <fa.mb8woD3e5JnT1x6AgEMOmnlVvg0@ifi.uio.no>
     [not found] ` <fa.axY2ukp7kqKVMAidyu4NVN81MbI@ifi.uio.no>
     [not found]   ` <fa.tS+LCGnYgeCNRIaF90yH21XBCqI@ifi.uio.no>
     [not found]     ` <fa./08N/HtpJQ6zg8Xc1K5pP6/aKMM@ifi.uio.no>
2007-07-29 15:41       ` Robert Hancock
2007-08-02 15:40         ` Mark Lord

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070726201355.GP19275@parisc-linux.org \
    --to=matthew@wil.cx \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox