From owner-freebsd-hackers@FreeBSD.ORG Tue Apr 26 14:31:06 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 344DE106564A; Tue, 26 Apr 2011 14:31:06 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id E722A8FC1D; Tue, 26 Apr 2011 14:31:05 +0000 (UTC) Received: from [10.0.0.63] (63.imp.bsdimp.com [10.0.0.63]) (authenticated bits=0) by harmony.bsdimp.com (8.14.4/8.14.3) with ESMTP id p3QERE61034182 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Tue, 26 Apr 2011 08:27:14 -0600 (MDT) (envelope-from imp@bsdimp.com) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: <201104260942.03543.jhb@freebsd.org> Date: Tue, 26 Apr 2011 08:27:14 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <5627117D-499B-4FD7-BF84-BE4BE6F583D7@bsdimp.com> References: <4DB695DB.1080505@chillt.de> <201104260942.03543.jhb@freebsd.org> To: John Baldwin X-Mailer: Apple Mail (2.1084) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (harmony.bsdimp.com [10.0.0.6]); Tue, 26 Apr 2011 08:27:14 -0600 (MDT) Cc: freebsd-hackers@freebsd.org, Bartosz Fabianowski Subject: Re: Is there some implicit locking of device methods? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2011 14:31:06 -0000 On Apr 26, 2011, at 7:42 AM, John Baldwin wrote: > - The Giant protection for new-bus should prevent attach/detach from = running > concurrently I believe (either that or the USB bus itself should = ensure > that the two instances of your device have seperate device_t = instances with > separate softc's, so current attach/detach should not matter except = that > they may both try to talk to the same hardware perhaps? In that = case that > is something the USB bus driver should fix by prevent a device from > attaching at an existing address until any existing device at that = address > is fully detached). I thought that if we held Giant when we're about to go to sleep that we = drop it as a special case. So if any newbus-releated function sleeps, = we can have a situation where attach is running and detach gets called. = There is (or was) some code to cope with this in CardBus, iirc. I'm = surprised there isn't any in USB, since Hans was the one that alerted me = to this issue. Warner