Re: Oops in 2.2.10-ac10 [PATCH]

Patrick J. LoPresti (patl@cag.lcs.mit.edu)
14 Jul 1999 15:06:13 -0400


The following patch attempts to avoid the race condition identified in
my last message. I have applied it to my kernel and it appears to fix
the problem; I never saw a successful shutdown before applying this
patch (four consecutive failures), and I have performed four
successful shutdowns since.

I am not terribly happy with this fix, since (in principle) it allows
another very busy device on the same IRQ to block the free_irq() call
indefinitely. This could be fixed by using a per-device "busy" flag
instead of per-interrupt, but I will leave such wizardry to the
wizards.

- Pat

--- arch/i386/kernel/irq.c~ Fri Jul 9 13:09:53 1999
+++ arch/i386/kernel/irq.c Wed Jul 14 14:23:52 1999
@@ -927,6 +927,17 @@
return;

spin_lock_irqsave(&irq_controller_lock,flags);
+
+#ifdef __SMP__
+ /* Make sure no interrupt handler is in progress when we
+ manipulate the action list and free the structure */
+ while (irq_desc[irq].status & IRQ_INPROGRESS) {
+ spin_unlock_irqrestore(&irq_controller_lock,flags);
+ udelay(1000);
+ spin_lock_irqsave(&irq_controller_lock,flags);
+ }
+#endif
+
for (p = &irq_desc[irq].action; (action = *p) != NULL; p = &action->next) {
if (action->dev_id != dev_id)
continue;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/