Re: [Q] net_device methods and disable_irq interaction (SMP&UP)

From: Alan Cox (alan@lxorguk.ukuu.org.uk)
Date: Fri Sep 29 2000 - 13:33:40 EST


> Can spin_lock_irqsave and the disable_irq & spin_lock combinations be
> safely mixed, particularly with regards to the networking layer? This does
> not seem to be done anywhere in the kernel so I suspect that I'm trying
> to do something wrong/bogus ...

We do it on the 8390 and 3c509.

#ifdef __SMP__
                disable_irq_nosync(dev->irq);
                spin_lock(&lp->lock);
#endif
                slow stuff

#ifdef __SMP__
                spin_unlock(&lp->lock);
                     enable_irq(dev->irq);
#endif

You need to allow for an IRQ coming in after the disable_irq happens. If its
already pending at the wrong moment on SMP at least it happens very very
occasionally.

Alan

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



This archive was generated by hypermail 2b29 : Sat Sep 30 2000 - 21:00:25 EST