Re: [patch] SMP race fix [was Re: SMP lockup & 3c509 on 2.2.x [aka.

Andrea Arcangeli (andrea@e-mind.com)
Wed, 5 May 1999 14:31:16 +0200 (CEST)


On Wed, 5 May 1999, Andrea Arcangeli wrote:

>other CPU. So basically I think that with this second patch above we
>woudn't need to synchronize with irqs at all. So I think we could add a
>new call to disable_irq_nosync(irq) that simply forget to
>`while(irq_inprogress) sync_irq', but it will only care that the irq won't

I did that. This third patch is against the two previous ones:

Index: arch/i386/kernel//irq.c
===================================================================
RCS file: /var/cvs/linux/arch/i386/kernel/irq.c,v
retrieving revision 1.1.2.26
diff -u -r1.1.2.26 irq.c
--- irq.c 1999/05/05 12:20:24 1.1.2.26
+++ linux/arch/i386/kernel/irq.c 1999/05/05 12:23:50
@@ -759,7 +759,7 @@
* hardware disable after having gotten the irq
* controller lock.
*/
-void disable_irq(unsigned int irq)
+static inline __disable_irq(unsigned int irq)
{
unsigned long flags;

@@ -769,9 +769,18 @@
irq_desc[irq].handler->disable(irq);
}
spin_unlock_irqrestore(&irq_controller_lock, flags);
+}

+void disable_irq(unsigned int irq)
+{
+ __disable_irq(irq);
while (irq_desc[irq].status & IRQ_INPROGRESS)
synchronize_irq();
+}
+
+void disable_irq_nosync(unsigned int irq)
+{
+ __disable_irq(irq);
}

void enable_irq(unsigned int irq)
Index: include/asm/irq.h
===================================================================
RCS file: /var/cvs/linux/include/asm-i386/irq.h,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 irq.h
--- irq.h 1999/02/20 15:57:39 1.1.2.2
+++ linux/include/asm-i386/irq.h 1999/05/05 12:23:47
@@ -29,6 +29,7 @@
}

extern void disable_irq(unsigned int);
+extern void disable_irq_nosync(unsigned int);
extern void enable_irq(unsigned int);

#endif /* _ASM_IRQ_H */
Index: drivers/net//8390.c
===================================================================
RCS file: /var/cvs/linux/drivers/net/8390.c,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 8390.c
--- 8390.c 1999/05/05 10:27:02 1.1.2.3
+++ linux/drivers/net/8390.c 1999/05/05 12:24:29
@@ -257,7 +257,7 @@

/* Ugly but a reset can be slow, yet must be protected */

- disable_irq(dev->irq);
+ disable_irq_nosync(dev->irq);
spin_lock(&ei_local->page_lock);

/* Try to restart the card. Perhaps the user has fixed something. */
@@ -285,7 +285,7 @@
* Slow phase with lock held.
*/

- disable_irq(dev->irq);
+ disable_irq_nosync(dev->irq);

spin_lock(&ei_local->page_lock);

Comments?

Andrea Arcangeli

-
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/