From owner-svn-src-user@FreeBSD.ORG Mon Feb 2 14:56:23 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CFB6E106564A; Mon, 2 Feb 2009 14:56:23 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 9E30E8FC2D; Mon, 2 Feb 2009 14:56:23 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (pool-98-109-39-197.nwrknj.fios.verizon.net [98.109.39.197]) by cyrus.watson.org (Postfix) with ESMTPSA id 412E546B03; Mon, 2 Feb 2009 09:56:23 -0500 (EST) Received: from localhost (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id n12EuHRr040398; Mon, 2 Feb 2009 09:56:17 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: "M. Warner Losh" Date: Mon, 2 Feb 2009 08:36:28 -0500 User-Agent: KMail/1.9.7 References: <200902010650.n116obU1045871@svn.freebsd.org> <20090201213749.GJ32503@citylink.fud.org.nz> <20090201.203618.1640016624.imp@bsdimp.com> In-Reply-To: <20090201.203618.1640016624.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200902020836.28882.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Mon, 02 Feb 2009 09:56:17 -0500 (EST) X-Virus-Scanned: ClamAV 0.94.2/8940/Mon Feb 2 07:31:54 2009 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: src-committers@freebsd.org, thompsa@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r187978 - user/thompsa/usb/sys/dev/usb2/ethernet X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Feb 2009 14:56:24 -0000 On Sunday 01 February 2009 10:36:18 pm M. Warner Losh wrote: > In message: <20090201213749.GJ32503@citylink.fud.org.nz> > Andrew Thompson writes: > : On Sun, Feb 01, 2009 at 02:28:08PM -0700, M. Warner Losh wrote: > : > In message: <200902010650.n116obU1045871@svn.freebsd.org> > : > Andrew Thompson writes: > : > : + locked = mtx_owned(&sc->sc_mtx); > : > : + if (!locked) > : > : + AUE_LOCK(sc); > : > > : > You do know this is racy, right? Err, no it's not. Individual threads are always "single-threaded", so whether or not a given thread holds a lock is actually deterministic. This is perfectly fine, and is actually how recursive locks work. > : Yea... It only get called unlocked during mii probe+attach so its fine. > : I havnt actaully checked if its ok to hold a mutex during > : mii_phy_probe() which would make this go away. > > You hold GIANT when probe+attach, which means I think you can't > acquire any other locks... That's completely backwards. :) You can definitely acquire other locks while holding Giant. What you can't do is acquire Giant while holding another mutex. -- John Baldwin