Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Jul 2010 02:27:40 -0700 (PDT)
From:      PseudoCylon <moonlightakkiy@yahoo.ca>
To:        Hans Petter Selasky <hselasky@c2i.net>
Cc:        Sam Leffler <sam@freebsd.org>, freebsd-current@freebsd.org, freebsd-usb@freebsd.org
Subject:   Re: [panic] Race in IEEE802.11 layer towards device drivers
Message-ID:  <105354.78909.qm@web51803.mail.re2.yahoo.com>
In-Reply-To: <201007201246.34654.hselasky@c2i.net>
References:  <201007141511.46190.hselasky@c2i.net> <201007192117.05034.hselasky@c2i.net> <504334.98385.qm@web51801.mail.re2.yahoo.com> <201007201246.34654.hselasky@c2i.net>

next in thread | previous in thread | raw e-mail | index | archive | help
----- Original Message ----
> From: Hans Petter Selasky <hselasky@c2i.net>
> To: PseudoCylon <moonlightakkiy@yahoo.ca>
> Cc: freebsd-current@freebsd.org; Sam Leffler <sam@freebsd.org>; 
>freebsd-usb@freebsd.org
> Sent: Tue, July 20, 2010 4:46:34 AM
> Subject: Re: [panic] Race in IEEE802.11 layer towards device drivers
> 
> On Tuesday 20 July 2010 12:03:22 PseudoCylon wrote:
> > ----- Original  Message ----
> > 
> > > From: Hans Petter Selasky <hselasky@c2i.net>
> > > To: freebsd-current@freebsd.org
> >  > Cc: PseudoCylon <moonlightakkiy@yahoo.ca>; Sam  Leffler 
<sam@freebsd.org>;
> > >
> >  >freebsd-usb@freebsd.org
> >  >
> > > Sent: Mon, July 19, 2010 1:17:04 PM
> > > Subject: Re:  [panic] Race in IEEE802.11 layer towards device drivers
> > > 
> >  > Hi AK,
> > > 
> > > I've committed your patches to USB P4.  I've made some additional 
> > > patches.
> > > 
> > > Can  you check and verify everything?
> > > 
> > > http://p4web.freebsd.org/@@181189?ac=10
> > 
> > Hi
> > 
> > If we change sc->cmdq_run = RUN_CMDQ_ABORT,
> > 
> > --  begin excerpt --
> > 
> > 
> > @@ -4890,7 +4877,10 @@ run_stop(void  *arg)
> >  ifp->if_drv_flags &= ~(IFF_DRV_RUNNING |  IFF_DRV_OACTIVE);
> > 
> >  sc->ratectl_run =  RUN_RATECTL_OFF;
> > -sc->cmdq_run = RUN_CMDQ_ABORT;
> > +
> >  +RUN_CMDQ_LOCK(sc);
> > +sc->cmdq_run = sc->cmdq_key_set =  RUN_CMDQ_ABORT;
> > +RUN_CMDQ_UNLOCK(sc);
> > 
> > -- end excerpt  --
> > 
> > 
> > we also need to change this, otherwise key will be  cleared.
> 
> Ok.
> 
> Try to give the second mutex a different name, and  see how many warnings go 
> away.
> 
> --HPS
> 

Giving different name makes all of "duplicate lock" warnings away.

Here is the patch includes all changes

-- begin patch --

diff --git a/dev/usb/wlan/if_run.c b/dev/usb/wlan/if_run.c
index 017e4b0..da22077 100644
--- a/dev/usb/wlan/if_run.c
+++ b/dev/usb/wlan/if_run.c
@@ -549,7 +549,7 @@ run_attach(device_t self)
 mtx_init(&sc->sc_mtx, device_get_nameunit(sc->sc_dev),
     MTX_NETWORK_LOCK, MTX_DEF);
 mtx_init(&sc->sc_cmdq_mtx, device_get_nameunit(sc->sc_dev),
-    MTX_NETWORK_LOCK, MTX_DEF);
+    "command queue", MTX_DEF);
 
 iface_index = RT2860_IFACE_INDEX;
 
@@ -4670,8 +4670,6 @@ run_init_locked(struct run_softc *sc)
 if(ic->ic_nrunning > 1)
 return;
 
-run_stop(sc);
-
 for (ntries = 0; ntries < 100; ntries++) {
 if (run_read(sc, RT2860_ASIC_VER_ID, &tmp) != 0)
 goto fail;

-- end patch --





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