public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: 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>,
	Remy Bohmer <linux@bohmer.net>
Subject: Re: [PATCH PREEMPT_RT]: On AT91 ARM: GPIO Interrupt handling can/will stall forever
Date: Tue, 27 Nov 2007 10:11:34 -0500	[thread overview]
Message-ID: <1196176294.13982.58.camel@localhost.localdomain> (raw)
In-Reply-To: <3efb10970711260545i419a8352o4ca5248b10d81db5@mail.gmail.com>

Thomas,

Can you ACK or NACK this patch.  I know you play with a bunch of
hardware that this patch may affect.

Thanks,

-- Steve


On Mon, 2007-11-26 at 14:45 +0100, Remy Bohmer wrote:
> Attached the same patch, but it also cleans the manage.c code a bit,
> because the IRQ types 'simple IRQ', 'level-IRQ' and 'FastEOI' were
> handled differently while they should be handled the same.
> 
> Kind Regards,
> 
> Remy
> 
> 2007/11/26, Remy Bohmer <linux@bohmer.net>:
> > Hello,
> >
> > I use 2.6.23.1-rt5 on the Atmel AT91 series.
> > Interrupt threading on Preempt-RT and ARM works fine, except for
> > (edge-triggered) GPIO interrupts. There is a problem when a new
> > interrupt arives while the interrupt thread is handling the previous
> > interrupt. If this occurs the interrupt handling stalls forever.
> >
> > This is caused by a unbalanced interrupt mask/unmask problem in the kernel.
> > The attached patch fixes this. More information about this problem is
> > documented inside the patch itself.
> >
> > This patch is meant for Preempt-RT only.
> >
> > Kind Regards,
> >
> > Remy Bohmer
> >
> >

On ARM there is a problem where the interrupt handler stalls when they are 
coming faster than the kernel can handle.

The problem occurs when the routine handle_simple_irq() masks the interrupt 
when an IRQ-thread is handling the interrupt at the same time. (IRQ_INPROGRESS
is set). The interrupt thread, however does **never** a 
desc->chip->unmask(), so the interrupt becomes disabled forever.

IRQ_DISABLED is usually not set for this interrupt

This is in kernel/irq/chip.c, where the irq is masked when a IRQ-thread is
running: 
--------------------------------------------------------------------------
void fastcall
handle_simple_irq(unsigned int irq, struct irq_desc *desc)
{

....
....

	if (unlikely(!action || (desc->status & (IRQ_INPROGRESS |
						 IRQ_DISABLED)))) {
(!!)->		if (desc->chip->mask)
(!!)->			desc->chip->mask(irq);
		desc->status &= ~(IRQ_REPLAY | IRQ_WAITING);
		desc->status |= IRQ_PENDING;
		goto out_unlock;
	}

....
....
}
--------------------------------------------------------------------------

Masking the interrupt seems valid, because the interrupt handler thread is 
still running, so it can handle the new pending interrupt. But, it has to be
umasked somewhere. The logical place is to do this in kernel/irq/manage.c, 
because this situation is also handled for the thread_level_irq() and 
thread_fasteoi_irq(), but not for thread_simple_irq(). This patch adds this
for these kind of interrupts also.

Signed-off-by: Remy Bohmer <linux@bohmer.net>
---
 kernel/irq/manage.c |   29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

Index: linux-2.6.23/kernel/irq/manage.c
===================================================================
--- linux-2.6.23.orig/kernel/irq/manage.c	2007-11-26 13:46:58.000000000 +0100
+++ linux-2.6.23/kernel/irq/manage.c	2007-11-26 14:43:32.000000000 +0100
@@ -646,28 +646,7 @@ static void thread_simple_irq(irq_desc_t
 			note_interrupt(irq, desc, action_ret);
 	}
 	desc->status &= ~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);
-	if (!(desc->status & IRQ_DISABLED) && desc->chip->unmask)
-		desc->chip->unmask(irq);
-}
-
-/*
- * threaded fasteoi type irq handler
- */
-static void thread_fasteoi_irq(irq_desc_t *desc)
-{
-	unsigned int irq = desc - irq_desc;
 
-	thread_simple_irq(desc);
 	if (!(desc->status & IRQ_DISABLED) && desc->chip->unmask)
 		desc->chip->unmask(irq);
 }
@@ -747,12 +726,10 @@ static void do_hardirq(struct irq_desc *
 	if (!(desc->status & IRQ_INPROGRESS))
 		goto out;
 
-	if (desc->handle_irq == handle_simple_irq)
+	if ((desc->handle_irq == handle_simple_irq) ||
+	    (desc->handle_irq == handle_level_irq)  ||
+	    (desc->handle_irq == handle_fasteoi_irq))
 		thread_simple_irq(desc);
-	else if (desc->handle_irq == handle_level_irq)
-		thread_level_irq(desc);
-	else if (desc->handle_irq == handle_fasteoi_irq)
-		thread_fasteoi_irq(desc);
 	else if (desc->handle_irq == handle_edge_irq)
 		thread_edge_irq(desc);
 	else



  reply	other threads:[~2007-11-27 15:12 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-26 13:31 [PATCH PREEMPT_RT]: On AT91 ARM: GPIO Interrupt handling can/will stall forever Remy Bohmer
2007-11-26 13:45 ` Remy Bohmer
2007-11-27 15:11   ` Steven Rostedt [this message]
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
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=1196176294.13982.58.camel@localhost.localdomain \
    --to=rostedt@goodmis.org \
    --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=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