[vortex] Re: 3com 3c905c-txm

Jeff Garzik jgarzik@mandrakesoft.com
Sun, 14 May 2000 02:33:51 -0400


Andrew Morton wrote:
> Donald Becker wrote:
> > The later chips do not need any spinlocking with a properly designed
> > transmit routine.  Especially not the painfully slow 'irqsave' versions of
> > the spinlocks.

> How so?  spin_lock_irqsave() is six instructions if the lock is free.

lock_irqsave is "slow but safe", lock_irq is faster and doesn't require
a 'flags' variable, but also has certain restrictions like cannot be
called with interrupts disabled.

I never got a satisfactory answer about whether you need a h/w lock, or
whether the low-level bus serializes transactions correctly on SMP... 
if so, you wouldn't need a hardware lock at all.  I believe it is ok to
use h/w lock only when logical synchronization is called for (or when
hardware requirements dictate), but until I have it confirmed, the SMP
locking in some of the drivers might be a bit overzealous, preferring to
err on the side of caution.

Also one thing I've looked at is making the "cur_tx" and "dirty_tx"
indices into atomic variables (atomic_t), to greatly narrow the window
of time which a spinlock needs to be held.  It might even be possible to
completely eliminate the spinlock on the tx side, in some cases.

	Jeff



-- 
Jeff Garzik              | Liberty is always dangerous, but
Building 1024            | it is the safest thing we have.
MandrakeSoft, Inc.       |      -- Harry Emerson Fosdick