From owner-freebsd-current@FreeBSD.ORG Wed Jul 21 09:27:41 2010 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 03476106567D for ; Wed, 21 Jul 2010 09:27:41 +0000 (UTC) (envelope-from moonlightakkiy@yahoo.ca) Received: from web51803.mail.re2.yahoo.com (web51803.mail.re2.yahoo.com [206.190.38.234]) by mx1.freebsd.org (Postfix) with SMTP id 9DC4F8FC23 for ; Wed, 21 Jul 2010 09:27:40 +0000 (UTC) Received: (qmail 78930 invoked by uid 60001); 21 Jul 2010 09:27:40 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.ca; s=s1024; t=1279704460; bh=t2bPSKJVM76DLSF2Ecb5PmytcQnRnzMFS/S5Esiflto=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type; b=DtTlE5jiRAi4hzOOcnNvJmm5FuVvAmURbcVkwIbLCDcH3Dxj1uZBhjlBCcYrkQYoGixy2fzUbqA3QvLbGY91OpEWLEl3ZezolOiaxavr4ELlqPKEES60lKmVGJVitaedx+TBa7CB9Dd61VXBCho8Ou/f8eg3Z/WOKsRXwamyyoY= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.ca; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type; b=MfHo59sZtt3ZlFGOVSQKk9GlNJlc9ZmuXMvMYILLmkJrmyaCen4j762ugKP30PlAhsXKHbQnanilaJRLMJXN45tF5MKx85owzZIlQA7pcdDQ9PnRxuuJAcPO38o0LXxumMUrJ1mfUfBuiRU0bRS21apgoYyPDYRxAut1QXhm4h8=; Message-ID: <105354.78909.qm@web51803.mail.re2.yahoo.com> X-YMail-OSG: 1f3OuQ4VM1kMGTQLXkioJpvFFG8eroo4G5Vi4cS3DBgBAlr fiCSjNmjZCxi19x7w_Wr5c4iEt0V4lmcXo.imez1woO7Ew4ZvIqheJOwlnTE jfbiLO0qaH7haO6Ebs6zhP5n3kElLYmYnCnJBgpQGTHt5Q9hSBpZ2Bsp_X50 PteL.5.JbABoe57Dxi6SaqB5ZnBbP5suQ7BgiuirvI4FB0qLfPjIBTKD9odu aKS3EogxXbDKWZdUS91uhNKNX_DEfSl7IkwP0INetxLJ4963xEfREMYfVJ9W FpB3pk32brAcDdejD36T2tm1KSKbWOIEuuk6o1ufogDo- Received: from [173.183.132.20] by web51803.mail.re2.yahoo.com via HTTP; Wed, 21 Jul 2010 02:27:40 PDT X-Mailer: YahooMailRC/420.4 YahooMailWebService/0.8.105.277674 References: <201007141511.46190.hselasky@c2i.net> <201007192117.05034.hselasky@c2i.net> <504334.98385.qm@web51801.mail.re2.yahoo.com> <201007201246.34654.hselasky@c2i.net> Date: Wed, 21 Jul 2010 02:27:40 -0700 (PDT) From: PseudoCylon To: Hans Petter Selasky In-Reply-To: <201007201246.34654.hselasky@c2i.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Sam Leffler , freebsd-current@freebsd.org, freebsd-usb@freebsd.org Subject: Re: [panic] Race in IEEE802.11 layer towards device drivers X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Jul 2010 09:27:41 -0000 ----- Original Message ---- > From: Hans Petter Selasky > To: PseudoCylon > Cc: freebsd-current@freebsd.org; Sam Leffler ; >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 > > > To: freebsd-current@freebsd.org > > > Cc: PseudoCylon ; Sam Leffler ; > > > > > >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 --