Date: Mon, 28 Apr 2003 16:04:46 -0700 From: Jeffrey Hsu <hsu@FreeBSD.org> To: jhb@FreeBSD.org Cc: imp@bsdimp.com Subject: Re: panic: sleeping thread owns a mutex Message-ID: <200304282255.h3SMtuPi008021@mta4.rcsntx.swbell.net>
index | next in thread | raw e-mail
> Set a flag in your driver before you drop the wi lock that the
> wiintr() function can check and bail out immediately if it is set.
> For example:
> foo_detach()
> {
> ...
> sc->sc_dead = 1;
> FOO_UNLOCK(sc);
> bus_teardown_intr(...)
> ...
mtx_destroy(&sc->sc_mtx); <--- note this
> }
> foo_intr()
> {
> FOO_LOCK(sc);
> if (sc->sc_dead) {
> FOO_UNLOCK(sc);
> return;
> }
> ...
> }
The sc_dead flag doesn't protect against foo_intr() attempting to
lock a mutex that has been destroyed. fxp has the same problem
and is one of the reasons, among others, I wasn't too happy with
the fxp softc locks introduced there.
The solution I have in mind involves using the DEAD flag in the interrupt
handler to defer destroying the mutex if the interrupt handler is active.
Jeffrey
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304282255.h3SMtuPi008021>
