mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Walker <dwalker@mvista.com>
To: Remy Bohmer <linux@bohmer.net>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
	ARM Linux Mailing List  <linux-arm-kernel@lists.arm.linux.org.uk>,
	RT <linux-rt-users@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH PREEMPT_RT]: On AT91 ARM: GPIO Interrupt handling can/will stall forever
Date: Wed, 28 Nov 2007 07:36:38 -0800	[thread overview]
Message-ID: <1196264198.27964.12.camel@imap.mvista.com> (raw)
In-Reply-To: <3efb10970711280638l3f57104y8cf9f2e58235c3@mail.gmail.com>

On Wed, 2007-11-28 at 15:38 +0100, Remy Bohmer wrote:
> Hello Daniel,
> 
> >  *      Note: The caller is expected to handle the ack, clear, mask and
> >  *      unmask issues if necessary.
> > So we shouldn't need any flow control unless there is some other
> > factors..
> 
> This comment can be misinterpreted, I think. Who is assumed to be the
> caller in this context? The 2 other routines in the driver that
> actually do the unmasking stuff besides only calling this routine? Is
> it allowed to call it directly or should it always be done through a
> wrapper that does all these special things?

The later I think .. 

> Either way, only masking interrupts, and never unmasking it, is a bug.
> If interrupts come and go slow enough you never run into this problem,
> and if this type is not used often, nobody will notice it.
> Usually interrupts needs clearence of the source before the hardware
> can generate a new one. GPIO interrupts are different, they are
> generated whenever a IO-level changes, there is no acknowledge or
> clearing of the interupt needed. These types of interrupts are never
> 'pending' from hardware point of view. So, with these type of
> interrupts, a new one can occur while the interrupt handler has not
> handled the previous one yet, and therefor these interrupt-types will
> show this bug.

Yeah, it's clear there needs to be an unmask for this special case..
I've attached a patch which only handles the special case.. Could you
test/review it..

> >
> > Additionally, we have a patch in the real time tree called
> > "irq-mask-fix.patch" which adds an "unmask" to handle_simple_irq, but as
> > the note says we don't need flow control..
> 
> You mean the Montavista real time tree?

No .. I wouldn't comment about an company specific tree. I was talking
about the broken out real time patches.

Daniel

--------


Remove the IRQ_PENDING flag if it's asserted, and unmask the irq. Also loop
around to account for the pending interrupt.

Signed-Off-By: Daniel Walker <dwalker@mvista.com>

---
 kernel/irq/manage.c |   28 +++++++++++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)

Index: linux-2.6.23/kernel/irq/manage.c
===================================================================
--- linux-2.6.23.orig/kernel/irq/manage.c
+++ linux-2.6.23/kernel/irq/manage.c
@@ -646,7 +646,7 @@ __setup("hardirq-preempt=", hardirq_pree
 /*
  * threaded simple handler
  */
-static void thread_simple_irq(irq_desc_t *desc)
+static void thread_core_irq(irq_desc_t *desc)
 {
 	struct irqaction *action = desc->action;
 	unsigned int irq = desc - irq_desc;
@@ -664,13 +664,35 @@ static void thread_simple_irq(irq_desc_t
 }
 
 /*
+ * threaded fasteoi type irq handler
+ */
+static void thread_simple_irq(irq_desc_t *desc)
+{
+	unsigned int irq = desc - irq_desc;
+
+	do {
+		/*
+		 * When another irq arrived while we were handling
+		 * one, we could have masked the irq.
+		 * Renable it, if it was not disabled in meantime.
+		 */
+		if (unlikely(desc->status & IRQ_PENDING)) {
+			desc->status &= ~IRQ_PENDING;
+			desc->chip->unmask(irq);
+		}
+		thread_core_irq(desc);
+	} while ((desc->status & (IRQ_PENDING | IRQ_INPROGRESS)));
+
+}
+
+/*
  * threaded level type irq handler
  */
 static void thread_level_irq(irq_desc_t *desc)
 {
 	unsigned int irq = desc - irq_desc;
 
-	thread_simple_irq(desc);
+	thread_core_irq(desc);
 	if (!(desc->status & IRQ_DISABLED) && desc->chip->unmask)
 		desc->chip->unmask(irq);
 }
@@ -682,7 +704,7 @@ static void thread_fasteoi_irq(irq_desc_
 {
 	unsigned int irq = desc - irq_desc;
 
-	thread_simple_irq(desc);
+	thread_core_irq(desc);
 	if (!(desc->status & IRQ_DISABLED) && desc->chip->unmask)
 		desc->chip->unmask(irq);
 }



  reply	other threads:[~2007-11-28 15:45 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-26 13:31 Remy Bohmer
2007-11-26 13:45 ` Remy Bohmer
2007-11-27 15:11   ` Steven Rostedt
2007-11-27 15:25     ` Daniel Walker
2007-11-27 15:53       ` Daniel Walker
2007-11-28 14:38         ` Remy Bohmer
2007-11-28 15:36           ` Daniel Walker [this message]
2007-11-28 17:25           ` Russell King - ARM Linux
2007-11-28 19:04             ` Steven Rostedt
2007-11-28 20:05               ` Russell King - ARM Linux
2007-11-28 20:16                 ` Steven Rostedt
2007-11-28 20:44                   ` Daniel Walker
2007-11-28 21:13                     ` Steven Rostedt
2007-11-28 23:03                       ` Russell King - ARM Linux
2007-11-28 23:19                         ` Daniel Walker
2007-11-29  9:04                           ` Russell King - ARM Linux
2007-11-29 10:14                   ` Remy Bohmer
2007-11-29 10:25                     ` Russell King - ARM Linux
2007-11-29 11:27                       ` Remy Bohmer
2007-11-29 13:36                         ` Russell King - ARM Linux
2007-11-29 13:57                           ` Steven Rostedt
2007-11-29 14:18                           ` Remy Bohmer
2007-11-29 14:29                             ` Russell King - ARM Linux
2007-11-29 15:33                               ` Remy Bohmer
2007-11-29 16:20                                 ` Remy Bohmer
2007-11-29 16:30                                 ` Steven Rostedt
2007-11-30 21:44                           ` Thomas Gleixner
2007-12-12 19:40         ` [PATCH RT] Revert Softdisable for simple irqs Steven Rostedt
2007-12-12 19:46           ` Russell King
2007-12-12 20:05           ` Remy Bohmer
2007-12-12 20:27             ` Steven Rostedt
2007-12-12 21:38               ` Remy Bohmer
     [not found] ` <87bq9fqpoi.fsf@vence.hilman.org>
2007-11-28 14:43   ` [PATCH PREEMPT_RT]: On AT91 ARM: GPIO Interrupt handling can/will stall forever Remy Bohmer

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=1196264198.27964.12.camel@imap.mvista.com \
    --to=dwalker@mvista.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=linux@bohmer.net \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    --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

all inboxes | Powered by JetHome®