[Sorry for the slow response time]

Garrett D'Amore wrote:

I'm not talking about consuming cycles. I'm not talking about wall clock time considerations. I'm talking about potential deadlocks due to cv_wait.

You must -not- under any conditions cv_wait while in ip_input's path. Because you don't know anything about what locks or PIL the calling context is coming from.

I don't think there is a hard and fast rule on this.

It is true that *typically* a mutex is used with a short or bounded hold time, and that a condition variable might be used when the hold time is unbounded.

But there might be subsystems that use a mutex (or rwlock) where the hold time is unbounded. And one can use condition variables to create mutual exclusion primitives that have bounded hold time.

The 'interrupts as threads' support in the Solaris kernel can deal with all combinations; a mutex_enter on an adaptive mutex will sleep if the thread holding the mutex is not running.

Thus cv vs. mutex/rwlock is a red herring. What matters is whether the hold time is bounded or not.

   Erik


_______________________________________________
networking-discuss mailing list
[email protected]

Reply via email to