Date: Tue, 29 Apr 2014 14:07:21 -0700 From: Rui Paulo <rpaulo@felyko.com> To: Kevin Lo <kevlo@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r264864 - head/sys/dev/usb/wlan Message-ID: <1D92F901-019B-436A-9926-7D7AB4F4C858@felyko.com> In-Reply-To: <201404240316.s3O3GlUl093950@svn.freebsd.org> References: <201404240316.s3O3GlUl093950@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Apr 23, 2014, at 20:16, Kevin Lo <kevlo@freebsd.org> wrote: > Author: kevlo > Date: Thu Apr 24 03:16:47 2014 > New Revision: 264864 > URL: http://svnweb.freebsd.org/changeset/base/264864 > > Log: > Fix panic by adding mtx_assert() to urtwn_init_locked() and > urtwn_stop_locked(). This was not a panic, but a LOR. > Modified: > head/sys/dev/usb/wlan/if_urtwn.c > > Modified: head/sys/dev/usb/wlan/if_urtwn.c > ============================================================================== > --- head/sys/dev/usb/wlan/if_urtwn.c Thu Apr 24 02:16:23 2014 (r264863) > +++ head/sys/dev/usb/wlan/if_urtwn.c Thu Apr 24 03:16:47 2014 (r264864) > @@ -2054,6 +2054,7 @@ urtwn_load_firmware(struct urtwn_softc * > uint32_t reg; > int mlen, ntries, page, error; > > + URTWN_UNLOCK(sc); You didn't need to unlock this early. The problem was in firmware_get(). > /* Read firmware image from the filesystem. */ > if ((sc->chip & (URTWN_CHIP_UMC_A_CUT | URTWN_CHIP_92C)) == > URTWN_CHIP_UMC_A_CUT) > @@ -2062,6 +2063,7 @@ urtwn_load_firmware(struct urtwn_softc * > imagename = "urtwn-rtl8192cfwT"; > > fw = firmware_get(imagename); > + URTWN_LOCK(sc); > if (fw == NULL) { > device_printf(sc->sc_dev, > "failed loadfirmware of file %s\n", imagename); > @@ -2816,6 +2818,8 @@ urtwn_init_locked(void *arg) > uint32_t reg; > int error; > > + URTWN_ASSERT_LOCKED(sc); > + > if (ifp->if_drv_flags & IFF_DRV_RUNNING) > urtwn_stop_locked(ifp); > > @@ -2979,6 +2983,8 @@ urtwn_stop_locked(struct ifnet *ifp) > { > struct urtwn_softc *sc = ifp->if_softc; > > + URTWN_ASSERT_LOCKED(sc); > + > ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); > > callout_stop(&sc->sc_watchdog_ch); This is fine, but I wonder if the firmware API should be changed. The problem with this approach, and all USB WiFi drivers, is that by unlocking the mutex, the mutual exclusion protection is lost... -- Rui Paulo
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1D92F901-019B-436A-9926-7D7AB4F4C858>
