From owner-svn-src-all@FreeBSD.ORG Wed Feb 13 20:04:25 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2841DAA8; Wed, 13 Feb 2013 20:04:25 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 032DECB7; Wed, 13 Feb 2013 20:04:25 +0000 (UTC) Received: from pakbsde14.localnet (unknown [38.105.238.108]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 44BF4B9A4; Wed, 13 Feb 2013 15:04:24 -0500 (EST) From: John Baldwin To: Hans Petter Selasky Subject: Re: svn commit: r246614 - head/sys/dev/usb/wlan Date: Wed, 13 Feb 2013 11:45:18 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p25; KDE/4.5.5; amd64; ; ) References: <201302101036.r1AAaHs1022034@svn.freebsd.org> <201302131053.02740.jhb@freebsd.org> <201302131704.58911.hselasky@c2i.net> In-Reply-To: <201302131704.58911.hselasky@c2i.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201302131145.18556.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 13 Feb 2013 15:04:24 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Feb 2013 20:04:25 -0000 On Wednesday, February 13, 2013 11:04:58 am Hans Petter Selasky wrote: > Hi, > > On Wednesday 13 February 2013 16:53:02 John Baldwin wrote: > > You shouldn't call routines that can drain like if_detach() or > > destroy_dev() or the like while holding any mutexes period. I think you > > need a 0) step which is "detach external consumers" including cdev's > > (destroy_dev()) and ifnet's (if_detach). Once both of those routines have > > finished, you can then proceed with actually stopping device operation, > > and 2) is not needed as it can't happen once 0) has finished. > > > > Right. > > > When a device has both an ifnet and a cdev you may need something to > > handle the case of one part being dead but not the other. For now you > > can call if_detach() first as it doesn't sleep (though that is a > > bug). The real fix for this case (and things like tun(4) can need this as > > well) is to have a way to call just the non-blocking parts of things like > > if_detach() and destroy_dev() first to mark the relevant portions as dead > > and then follow those with blocking calls that do the drain. This is all > > part of step 0 though. > > I feel this is out of my area. Can you push the right people to make such a > change in the IFNET code and I can update the USB part. For now because if_detach() is broken I think you can just call ether_ifdetach() and then destroy_dev(). -- John Baldwin