[lkml]   [2006]   [Mar]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] IRQ: prevent enabling of previously disabled interrupt
This fix prevents re-disabling and enabling of a previously disabled
interrupt in 2.6.16-rc5. On an SMP system with irq balancing enabled;
If an interrupt is disabled from within its own interrupt context with
disable_irq_nosync and is also earmarked for processor migration, the
interrupt is blindly moved to the other processor and enabled without
regard for its current "enabled" state. If there is an interrupt
pending, it will unexpectedly invoke the irq handler on the new irq
owning processor (even though the irq was previously disabled)

The more intuitive fix would be to invoke disable_irq_nosync and
enable_irq, but since we already have the desc->lock from __do_IRQ, we
cannot call them directly. Instead we can use the same logic to
disable and enable found in disable_irq_nosync and enable_irq, with
regards to the desc->depth.

This now prevents a disabled interrupt from being re-disabled, and
more importantly prevents a disabled interrupt from being incorrectly
enabled on a different processor.

Signed-off-by: Bryan Holty <>

--- 2.6.16-rc5/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -155,9 +155,13 @@
* Being paranoid i guess!
if (unlikely(!cpus_empty(tmp))) {
- desc->handler->disable(irq);
+ if (likely(!desc->depth++))
+ desc->handler->disable(irq);
- desc->handler->enable(irq);
+ if (likely(!--desc->depth))
+ desc->handler->enable(irq);

- Bryan Holty

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2006-03-06 22:41    [W:0.071 / U:0.276 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site