mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeff Dike <jdike@addtoit.com>
To: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] Deal with IRQs having different IRQF_DISABLED
Date: Wed, 23 May 2007 09:18:59 -0400	[thread overview]
Message-ID: <20070523131859.GA5686@c2.user-mode-linux.org> (raw)

handle_IRQ_event either enables IRQs or leaves them disabled for the
entire chain.  However, there is nothing in request_irq or setup_irq
which ensures that all IRQs in a chain will have the same
IRQF_DISABLED.

This seems like a bug to me.  Below are two possible fixes -
enable/disable IRQs for each action or refuse to register an IRQ if
there is a mismatched IRQF_DISABLED.

-- 
Work email - jdike at linux dot intel dot com

Refuse to register an IRQ if it has a mismatched IRQF_DISABLED with
what's already in the IRQ chain.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
--
 kernel/irq/manage.c |    8 ++++++++
 1 file changed, 8 insertions(+)

Index: linux-2.6.21-mm/kernel/irq/manage.c
===================================================================
--- linux-2.6.21-mm.orig/kernel/irq/manage.c	2007-05-23 09:01:16.000000000 -0400
+++ linux-2.6.21-mm/kernel/irq/manage.c	2007-05-23 09:02:28.000000000 -0400
@@ -301,6 +301,14 @@ int setup_irq(unsigned int irq, struct i
 			goto mismatch;
 		}
 
+		/*
+		 * Handlers must agree on disabling IRQs since
+		 * handle_IRQ_event leaves IRQs either on or off for
+		 * the entire chain.
+		 */
+		if ((old->flags ^ new->flags) & IRQF_DISABLED)
+			goto mismatch;
+
 #if defined(CONFIG_IRQ_PER_CPU)
 		/* All handlers must agree on per-cpuness */
 		if ((old->flags & IRQF_PERCPU) !=


Move the enabling/disabling of IRQs into the loop so that actions with
differing IRQF_DISABLED get the IRQ enabling that they asked for.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
--
 kernel/irq/handle.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Index: linux-2.6.21-mm/kernel/irq/handle.c
===================================================================
--- linux-2.6.21-mm.orig/kernel/irq/handle.c	2007-05-16 18:21:18.000000000 -0400
+++ linux-2.6.21-mm/kernel/irq/handle.c	2007-05-23 09:02:57.000000000 -0400
@@ -133,20 +133,21 @@ irqreturn_t handle_IRQ_event(unsigned in
 
 	handle_dynamic_tick(action);
 
-	if (!(action->flags & IRQF_DISABLED))
-		local_irq_enable_in_hardirq();
-
 	do {
+		if (!(action->flags & IRQF_DISABLED))
+			local_irq_enable_in_hardirq();
+
 		ret = action->handler(irq, action->dev_id);
 		if (ret == IRQ_HANDLED)
 			status |= action->flags;
 		retval |= ret;
 		action = action->next;
+
+		local_irq_disable();
 	} while (action);
 
 	if (status & IRQF_SAMPLE_RANDOM)
 		add_interrupt_randomness(irq);
-	local_irq_disable();
 
 	return retval;
 }

                 reply	other threads:[~2007-05-23 13:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20070523131859.GA5686@c2.user-mode-linux.org \
    --to=jdike@addtoit.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /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

Powered by JetHome