fix preempt hardirqs on OMAP
PATCH RESEND 1/1 fix preempt hardirqs on OMAP
This should fix hardirq threading when the chained handler disables an interrupt while setting IRQ_PENDING. Which happens on ARM OMAP. It also has the effect of re-running the interrupt on IRQ_PENDING, which would normally be handled inside the chained handler. Since this happens inside a thread the chained handler will just wake up the thread multiple times, leaving the thread to actually rerun the interrupt.
--- kernel/irq/manage.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+)
kernel/irq/manage.c +14 -0
@@ -546,6 +546,7 @@ static void thread_simple_irq(irq_desc_tunsigned int irq = desc - irq_desc;irqreturn_t action_ret; +restart:if (action && !desc->depth) {spin_unlock (&desc->lock); action_ret =handle_IRQ_event (irq, action);
@@ -555,6 +556,19 @@ static void thread_simple_irq(irq_desc_tif (!noirqdebug)note_interrupt (irq, desc, action_ret); } + +/* +* Some boards will disable an interrupt when it +* sets IRQ_PENDING . So we have to remove the flag +* and re-enable to handle it. +*/ +if (desc->status &IRQ_PENDING ) { + desc->status &= ~IRQ_PENDING ; +if (desc->chip) + desc->chip->enable (irq); + goto restart; + } + desc->status &= ~IRQ_INPROGRESS ; }
--
kernel/irq/manage.c static void thread_simple_irq(irq_desc_t · line 570
Quoted 11 lines · Daniel Walker
kernel/irq/manage.c +11
-0+/* +* Some boards will disable an interrupt when it +* sets IRQ_PENDING . So we have to remove the flag +* and re-enable to handle it. +*/ +if (desc->status &IRQ_PENDING ) { + desc->status &= ~IRQ_PENDING ; +if (desc->chip) + desc->chip->enable (irq); + goto restart; + }
what if the irq got disabled meanwhile? Also, chip->enable is a compatibility method, not something we should use in a flow handler.
Ingo
Quoted 16 lines · Ingo Molnar
kernel/irq/manage.c static void thread_simple_irq(irq_desc_t · line 570
Quoted 11 lines · Daniel Walker
kernel/irq/manage.c +11
-0+/* +* Some boards will disable an interrupt when it +* sets IRQ_PENDING . So we have to remove the flag +* and re-enable to handle it. +*/ +if (desc->status &IRQ_PENDING ) { + desc->status &= ~IRQ_PENDING ; +if (desc->chip) + desc->chip->enable (irq); + goto restart; + }what if the irq got disabled meanwhile? Also,
chip->enableis a compatibility method, not something we should use in a flow handler.
I don't know how other arches deal with IRQ_PENDING, but ARM (OMAP at least) disables the IRQ on IRQ_PENDING. The problem is that by threading the IRQ we take some control away from the low level code, which needs to be replaced.
I'm open to potentially removing the irq disable()->enable() cycle on IRQ_PENDING if it's only done on OMAP. My feeling is that it's in other ARM's which would make that change more invasive, but I haven't actually researched that.
Daniel
Hi,
Quoted 23 lines · Daniel Walker
Quoted 16 lines · Ingo Molnar
kernel/irq/manage.c static void thread_simple_irq(irq_desc_t · line 570
Quoted 11 lines · Daniel Walker
kernel/irq/manage.c +11
-0+/* +* Some boards will disable an interrupt when it +* sets IRQ_PENDING . So we have to remove the flag +* and re-enable to handle it. +*/ +if (desc->status &IRQ_PENDING ) { + desc->status &= ~IRQ_PENDING ; +if (desc->chip) + desc->chip->enable (irq); + goto restart; + }what if the irq got disabled meanwhile? Also,
chip->enableis a compatibility method, not something we should use in a flow handler.I don't know how other arches deal with
IRQ_PENDING, but ARM (OMAP at least) disables the IRQ onIRQ_PENDING. The problem is that by threading the IRQ we take some control away from the low level code, which needs to be replaced.
Quoted 4 lines
I'm open to potentially removing the irq disable()->enable() cycle on
IRQ_PENDINGif it's only done on OMAP. My feeling is that it's in other ARM's which would make that change more invasive, but I haven't actually researched that.
Hmm, I wonder if this is just legacy left over from earlier when set_irq_type() was used and the flags not passed with request_irq(). This was causing some omap gpio interrupts to trigger immediately after request_irq().
Regards,
Tony
Quoted 18 lines · Daniel Walker
Quoted 16 lines · Ingo Molnar
kernel/irq/manage.c static void thread_simple_irq(irq_desc_t · line 570
Quoted 11 lines · Daniel Walker
kernel/irq/manage.c +11
-0+/* +* Some boards will disable an interrupt when it +* sets IRQ_PENDING . So we have to remove the flag +* and re-enable to handle it. +*/ +if (desc->status &IRQ_PENDING ) { + desc->status &= ~IRQ_PENDING ; +if (desc->chip) + desc->chip->enable (irq); + goto restart; + }what if the irq got disabled meanwhile? Also,
chip->enableis a compatibility method, not something we should use in a flow handler.
Quoted 2 lines
I don't know how other arches deal with
IRQ_PENDING, but ARM (OMAP at least) disables the IRQ onIRQ_PENDING.
Please point out where it's doing that, and I'll take a look to see if it's doing something it shouldn't.
Signature · 3 lines
Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of:
Quoted 8 lines · Russell King
Quoted 5 lines
Quoted 2 lines
what if the irq got disabled meanwhile? Also,
chip->enableis a compatibility method, not something we should use in a flow handler.I don't know how other arches deal with
IRQ_PENDING, but ARM (OMAP at least) disables the IRQ onIRQ_PENDING.Please point out where it's doing that, and I'll take a look to see if it's doing something it shouldn't.
It's in arch/arm/plat-omap/gpio.c . It uses the lowlevel function to disable the interrupt, not chip->disable() . In gpio_irq_handler() .
Daniel