tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

locking order between softnet_lock and the kernel lock

Here at BBN, we are getting a hang with heavy use of networking code and 
looking for possible deadlocks.  We've made modifications to the kernel.  I'm 
trying to understand the lock order invariants to make sure we have applied it 
correctly to our code.

I see a number of instances of code that look like this:

<do something>
<maybe do something else>

Am I correct to infer that the kernel lock should always be taken (if taken at 
all) AFTER softnet_lock is taken, and released before softnet_lock is released?

In in_pcbdetach (and the equivalent function in ip6), there is the following 
sofree(so);                     /* drops the socket's lock */
mutex_enter(softnet_lock);      /* reacquire the softnet_lock */

I'm curious if a deadlock could occur between sofree and mutex_enter because 
the kernel lock may be held when this is called.

What are the rules for locking order with softnet_lock and the kernel lock?

Bev Schwartz <>
BBN Technologies

Home | Main Index | Thread Index | Old Index