Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 07 Aug 2003 10:23:00 -0400 (EDT)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Ted Unangst <tedu@stanford.edu>
Cc:        freebsd-hackers@freebsd.org
Subject:   RE: possible deadlocks?
Message-ID:  <XFMail.20030807102300.jhb@FreeBSD.org>
In-Reply-To: <Pine.GSO.4.44.0308061506120.29218-100000@saga0.Stanford.EDU>

next in thread | previous in thread | raw e-mail | index | archive | help

On 06-Aug-2003 Ted Unangst wrote:
> My advisor Dawson Engler has written a deadlock detector, and we'd like
> some verification. They look like bugs, unless there is some other reason
> why two call chains cannot happen at the same time.
> 
> deadlock between ktrace_mtx and sema_mtx.  is it possible to call
> sema_timewait on ktrace_sema?  call chain below.
> 
> thread 1:
> _sema_timedwait(sema, ...)
>   mtx_lock(&sema->sema_mtx) /* gets this lock */
>     cv_timewait()
>       ktrcsw()
>         ktr_getrequest()
>           mtx_lock(&ktrace_mtx) /* waits for thread 2 */
> 
> thread 2:
> ktr_submitrequest
>   mtx_lock(&ktrace_mtx) /* gets this lock */
>     _sema_post(&ktrace_sema)
>       mtx_lock(&sema->sema_mtx) /* waits for thread 1 */

Yes, the lock isn't needed around the post anyways.  Fixed.

-- 

John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20030807102300.jhb>