M. Warner Losh writes:
 > However in if_slowtimo we have:
 > if_slowtimo(arg)
 > {
 > ...  IFNET_RLOCK();
 > ...          if (ifp->if_watchdog)
 >                      (*ifp->if_watchdog)(ifp);
 > ...  IFNET_RUNLOCK();
 > }
 > and dc_watchdog does a DC_LOCK/UNLOCK pair).  This is a Lock Order
 > Reversal, and not a LotR :-)
 > What's worse is that dc_intr does:
 > ...dc_start (which calls IF_PREPEND which does the IFNET_LOCK/UNLOCK thing)
 > So even if we remove the one from attach, it looks like we have others
 > lurking in the code.
 > Either that, or it is too late for me to be looking at code like this
 > :-(

I think its too late at night ;)

The IFNET_RLOCK() called in if_slowtimo() is a global lock for the
list of ifnet structs to ensure that no devices are removed or added
while something may be using it.  There is one ifnet list in the system.

The lock in IF_PREPEND() (and more commonly used in drivers,
IF_DEQUE()) is per-ifq, to protect against multiple accesses 
to a single  ifq.  There are many ifqs in the system.

FWIW, I've been running my 3rd party Myrinet driver Giant-free and
have had no problems, and no lock order reversals.  I don't do bogus
locking in my attach routine, though :)

FWIW2: Running Giant-free brings -current TCP performance up to nearly
63% of -stable performance (from 39%), and udp xmit perf up to 87% of
-stable.  (testing w/o WITNESS).


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to