linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH PREEMPT_RT]: On AT91 ARM: GPIO Interrupt handling can/will stall forever
@ 2007-11-26 13:31 Remy Bohmer
  2007-11-26 13:45 ` Remy Bohmer
       [not found] ` <87bq9fqpoi.fsf@vence.hilman.org>
  0 siblings, 2 replies; 33+ messages in thread
From: Remy Bohmer @ 2007-11-26 13:31 UTC (permalink / raw)
  To: Ingo Molnar, Steven Rostedt; +Cc: ARM Linux Mailing List, RT, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 569 bytes --]

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fix-gpio-irq-stalling-bug.patch --]
[-- Type: text/x-patch; name=fix-gpio-irq-stalling-bug.patch, Size: 2062 bytes --]

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 |    3 +++
 1 file changed, 3 insertions(+)

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 13:48:30.000000000 +0100
@@ -646,6 +646,9 @@ static void thread_simple_irq(irq_desc_t
 			note_interrupt(irq, desc, action_ret);
 	}
 	desc->status &= ~IRQ_INPROGRESS;
+
+	if (!(desc->status & IRQ_DISABLED) && desc->chip->unmask)
+		desc->chip->unmask(irq);
 }
 
 /*

^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2007-12-12 21:38 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).