Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Apr 2003 15:03:07 -0600 (MDT)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        jhb@FreeBSD.org
Cc:        shinra@j10n.org
Subject:   Re: panic: sleeping thread owns a mutex
Message-ID:  <20030428.150307.83622281.imp@bsdimp.com>
In-Reply-To: <XFMail.20030428164942.jhb@FreeBSD.org>
References:  <86znmdq3o7.wl@j10n.org> <XFMail.20030428164942.jhb@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <XFMail.20030428164942.jhb@FreeBSD.org>
            John Baldwin <jhb@FreeBSD.org> writes:
: 
: On 26-Apr-2003 AIDA Shinra wrote:
: > My kernel always panics when I remove my wi pccard (WLI-PCM-S11).
: > I am using OLDCARD and enabling hw.pcic.intr_path=1. With NEWCARD no
: > cards work. I reported this bug 2 weeks ago but even today's kernel
: > panics in exactly the same way. Anyone experiencing the same problem?
: > Or just my misconfiguration?
: 
: Can you try this patch:
: 
: Index: if_wi.c
: ===================================================================
: RCS file: /usr/cvs/src/sys/dev/wi/if_wi.c,v
: retrieving revision 1.137
: diff -u -r1.137 if_wi.c
: --- if_wi.c     10 Apr 2003 07:55:55 -0000      1.137
: +++ if_wi.c     28 Apr 2003 20:39:37 -0000
: @@ -486,10 +486,10 @@
:         ifmedia_removeall(&sc->sc_media);
:  
:         ieee80211_ifdetach(ifp);
: +       WI_UNLOCK(sc);
:         bus_teardown_intr(dev, sc->irq, sc->wi_intrhand);
:         wi_free(dev);
:  
: -       WI_UNLOCK(sc);
:  #if __FreeBSD_version >= 500000
:         mtx_destroy(&sc->sc_mtx);
:  #endif
: 
: It is not ok to hold a lock when calling bus_teardown_intr() or
: bus_setup_intr().

This brings up another problem.

If wi is on a shared interrupt, what happens if an interrupt comes in
while the device is being torn down?  Eg, as soon as you drop that
lock, the wi_intr gets the lock and bad things happen at the
mtx_destroy potentially.  How do we keep from racing?

Warner



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