Date: Thu, 12 Oct 2000 17:46:26 -0700 From: Jake Burkholder <jburkhol@home.com> To: mjacob@feral.com Cc: John Baldwin <jhb@FreeBSD.ORG>, arch@FreeBSD.ORG Subject: Re: when is it safe to call msleep? Message-ID: <20001013004626.978DFBA76@io.yi.org> In-Reply-To: Message from Matthew Jacob <mjacob@feral.com> of "Thu, 12 Oct 2000 10:34:41 PDT." <Pine.LNX.4.21.0010121032050.2654-100000@zeppo.feral.com>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a multipart MIME message. --==_Exmh_7696409280 Content-Type: text/plain; charset=us-ascii > > I've been fooling around with the new lock stuff and trying to convert things > over, and I called msleep with an initialized MTX_DEF lock held (on my > pc164) during probes, but I got a panic: > Hmm. I don't know about the panic, but the releasing of the mutex is probably in the wrong place if its going to be called early in boot, when cold is true. Could you try this: Jake --==_Exmh_7696409280 Content-Type: text/plain ; name="tsleep.diff"; charset=us-ascii Content-Description: tsleep.diff Content-Disposition: attachment; filename="tsleep.diff" Index: kern_synch.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_synch.c,v retrieving revision 1.101 diff -u -r1.101 kern_synch.c --- kern_synch.c 2000/10/06 02:20:20 1.101 +++ kern_synch.c 2000/10/13 00:20:30 @@ -436,15 +436,6 @@ WITNESS_SLEEP(0, mtx); mtx_enter(&sched_lock, MTX_SPIN); - if (mtx != NULL) { - KASSERT(mtx->mtx_recurse == 0, - ("sleeping on recursed mutex %s", mtx->mtx_description)); - WITNESS_SAVE(mtx, mtx); - mtx_exit(mtx, MTX_DEF | MTX_NOSWITCH); - if (priority & PDROP) - mtx = NULL; - } - s = splhigh(); if (cold || panicstr) { /* @@ -456,6 +447,15 @@ mtx_exit(&sched_lock, MTX_SPIN); splx(s); return (0); + } + + if (mtx != NULL) { + KASSERT(mtx->mtx_recurse == 0, + ("sleeping on recursed mutex %s", mtx->mtx_description)); + WITNESS_SAVE(mtx, mtx); + mtx_exit(mtx, MTX_DEF | MTX_NOSWITCH); + if (priority & PDROP) + mtx = NULL; } KASSERT(p != NULL, ("tsleep1")); --==_Exmh_7696409280-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001013004626.978DFBA76>