The actual game the driver is playing goes like this
ne2k-pci hardware is often very slow (some of it is isa chips nailed to
crappy pci/isa glue). 8390's also have the fun property that the
registers are windowed and you can't clear a pending IRQ without
flipping windows.
When we do a transmit we want to do the packet upload with most
interrupts enabled (or you drop serial interrupts and life sucks a lot).
We take the lock with the irq. We switch window (safely under the lock)
and we turn interrupts off on the card. We then release the lock.
At this point you might think all is safe. However IRQ delivery on x86
is asynchronous so an IRQ can be in flight after we turn it off but not
yet at the CPU. To cover this case we disable that IRQ line, then take
the lock - possibly waiting briefly for an IRQ handler to clear on
another CPU, but not where one can begin to occur and deadlock.
The end result of this little pile of tricks is that you can run ne2k
cards and a modem on a PC at the same time. I think you want to
disable pre-empt before we take the lock with irqsave - to cover the
moment we have the irq disabled against pre-emption and packet loss too
- ie move the pre-empt disable further backwards.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/