Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Aug 2003 15:20:02 -0700 (PDT)
From:      Ted Unangst <tedu@stanford.edu>
To:        freebsd-hackers@freebsd.org
Subject:   possible deadlocks?
Message-ID:  <Pine.GSO.4.44.0308061506120.29218-100000@saga0.Stanford.EDU>

next in thread | raw e-mail | index | archive | help
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 */

second one in bpf, between bpfif_lock and bpfd_lock.

thread 1:
bpf_tap() /* or bpf_mtap */
  BPFIF_LOCK(bp); /* gets this lock */
  for (d = bp->bif_dlist; d != 0; d = d->bd_next) {
	BPFD_LOCK(d); /* waits for thread 2 */

thread 2:
bpf_setdlt()
  BPFD_LOCK(d); /* gets lock */
  bpf_detachd(d); /* or bpf_attachd */
    BPFIF_LOCK(bp); /* waits for thread 1 */





-- 
"The brave men who died in Vietnam, more than 100% of which were
black, were the ultimate sacrifice."
      - M. Barry, Mayor of Washington, DC





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.44.0308061506120.29218-100000>