Beverly Schwartz
2012-03-26 18:38:44 UTC
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:
mutex_enter(softnet_lock);
KERNEL_LOCK(1, NULL);
<do something>
KERNEL_UNLOCK_ONE(NULL);
<maybe do something else>
mutex_exit(softnet_lock);
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 code:
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.com>
BBN Technologies
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
I see a number of instances of code that look like this:
mutex_enter(softnet_lock);
KERNEL_LOCK(1, NULL);
<do something>
KERNEL_UNLOCK_ONE(NULL);
<maybe do something else>
mutex_exit(softnet_lock);
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 code:
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.com>
BBN Technologies
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de