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

From: Hans Grobler (grobh@sun.ac.za)
Date: Fri Sep 29 2000 - 13:10:33 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 ...

More specifically, I have a card that requires lengthy reconfiguration
sequences during its normal operation. This card is an old, very slow ISA
card. For most of the driver I'd like to use spin_*lock_irq*. During the
long reconfiguration sequences I'd like to do (allowing servicing of other
interrupts, particularly on UP):

    disable_irq(driver_irq);
    spin_lock(&driver_lock);

    /* ... hardware reconfig (critical section) ... */

    spin_unlock(&driver_lock);
    enable_irq(driver_irq);

where the following is used elsewhere:

    unsigned long flags;

    spin_lock_irqsave (&driver_lock, flags);

    /* ... hardware stuff (critical section) ... */

    spin_unlock_irqrestore (&driver_lock, flags);

Since this driver is a network driver, the spin_lock in the first fragment
would be to prevent unsafe interaction with the network layer (via the
net_device methods).

Would this work or have I missed something? What would be the best
why to handle this situation (i.e. very slow ISA card, long port
access sequences, 2.4.x, SMP & UP)?

Thanks
-- Hans

-
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