tech-kern archive

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

Re: Multiple interlocks on the same condvar(9)



GrÃgoire Sutre <gregoire.sutre%gmail.com@localhost> wrote:
> With condvar(9), is it possible to have different LWPs waiting on the 
> same cv, but with different interlocks?

Short answer: no, and that generally does not make sense.  Interlock
is supposed to protect the state and the condition.  You achieve the
exclusion (therefore, protection) by using the same lock.

I assumed by "possible" you mean "allowed", since it is possible, but
such case is a bug.

> I'm asking this because, with the LOCKDEBUG_WAKEUP checks re-enabled
> in kern_condvar.c (see attached diff and kernel configuration), I get
> a LOCK_DEBUG panic (when gdm is starting in case that matters):
> 
> Condition variable error: lockdebug_wakeup: interlocking mutex not
> held during wakeup

Code which does not hold the interlock around cv_signal/cv_broadcast()
should be fixed (although in theory, in certain cases, it may be safe to
signal without interlock held, but we enforce more strict interface in
the kernel).  Commit message, which commented out these checks, mentions
TTY code.  I guess it is not trivial.

-- 
Mindaugas


Home | Main Index | Thread Index | Old Index