possible deadlocks?
John Baldwin
jhb at FreeBSD.org
Thu Aug 7 07:22:42 PDT 2003
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 at FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!" - http://www.FreeBSD.org/
More information about the freebsd-hackers
mailing list