From owner-p4-projects@FreeBSD.ORG Sun Jan 14 06:34:16 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C26ED16A5A7; Sun, 14 Jan 2007 06:34:15 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 83FDF16A5A2 for ; Sun, 14 Jan 2007 06:34:15 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 3400613C457 for ; Sun, 14 Jan 2007 06:34:15 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id l0E6XiWf012900; Sat, 13 Jan 2007 23:33:44 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Sat, 13 Jan 2007 23:34:01 -0700 (MST) Message-Id: <20070113.233401.228973006.imp@bsdimp.com> To: hselasky@c2i.net From: "M. Warner Losh" In-Reply-To: <200701140225.05299.hselasky@c2i.net> References: <200701122132.l0CLWuAG096027@repoman.freebsd.org> <20070113.122940.420518338.imp@bsdimp.com> <200701140225.05299.hselasky@c2i.net> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.bsdimp.com [127.0.0.1]); Sat, 13 Jan 2007 23:33:44 -0700 (MST) Cc: perforce@freebsd.org Subject: Re: PERFORCE change 112835 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Jan 2007 06:34:16 -0000 In message: <200701140225.05299.hselasky@c2i.net> Hans Petter Selasky writes: : On Saturday 13 January 2007 20:29, M. Warner Losh wrote: : > In message: <200701122132.l0CLWuAG096027@repoman.freebsd.org> : > : > Hans Petter Selasky writes: : > : http://perforce.freebsd.org/chv.cgi?CH=112835 : > : : > : Change 112835 by hselasky@hselasky_mini_itx on 2007/01/12 21:32:24 : > : : > : ether_ifattach() must be called without any mutexes held, hence : > : it can sleep. Use generated typedef's for prototypes for exported : > : device methods. This prevents invalid parameter passing and return. : > : > Why do the attach methods even have locked mutexes to drop? That was : > a common error in the early locking efforts that too many network : > drivers inherited. Maybe the right fix is to just remove the : > lock/unlock pairs in attach entirely... : > : : The attach code in question is run from a separate config thread, which by : default locks "sc->sc_mtx" before calling the callback function. Therefore : the code unlocks that lock, to avoid sleeping with mutex locked errors. I understand why mtx can't be held, but there's nothing to contend with... : Probably all of the attach code can run without "sc->sc_mtx" locked, but will : require Giant locked, when changing the device tree, for example when adding : new child devices like MII-bus instances. Giant will be locked when attach is called, but not in the deferred attach. So long as attach returns, this shouldn't be a problem. Adding children does need Giant held at the moment. Warner