On Sat, Apr 04, 2009 at 09:04:36PM +0900, Masao Uebayashi wrote: > I think you have to take softnet_lock, since bridge_forward() is called from > softint where not lock is held.
There is a minor problem with this. If you look elsewhere in the networking code softints and callouts are usually created with flag SOFTINT_MPSAFE, and if required the handler takes kernel_lock directly. The main reason for this is as follows. In the socket layer and pretty much eveywhere else we take these locks in the order softnet_lock -> kernel_lock. It is permissible to mix ordering between adaptive mutexes/rwlocks and kernel_lock. So you can also safely go kernel_lock -> softnet_lock. However, this causes the deadlock detection code in mutex_onproc() to fire when there is lock contention, leading to a context switch storm. > > - src_if = m->m_pkthdr.rcvif; > > + if ((sc->sc_if.if_flags & IFF_RUNNING) == 0) > > + return; > > > > - sc->sc_if.if_ipackets++; > > - sc->sc_if.if_ibytes += m->m_pkthdr.len; > > + s = splbio(); > > + while (1) { > > + IFQ_POLL(&sc->sc_if.if_snd, m); > > + if (m == NULL) > > + break; > > + IFQ_DEQUEUE(&sc->sc_if.if_snd, m); > > > > Why splbio(), not splnet()??? splbio, splnet, spltty etc are aliases for splvm.