From owner-freebsd-net Mon Jan 6 1:58:31 2003 Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9D07737B401; Mon, 6 Jan 2003 01:58:30 -0800 (PST) Received: from mailhub.fokus.gmd.de (mailhub.fokus.gmd.de [193.174.154.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7A9C543EB2; Mon, 6 Jan 2003 01:58:29 -0800 (PST) (envelope-from brandt@fokus.gmd.de) Received: from beagle (beagle [193.175.132.100]) by mailhub.fokus.gmd.de (8.11.6/8.11.6) with ESMTP id h069wPJ15725; Mon, 6 Jan 2003 10:58:25 +0100 (MET) Date: Mon, 6 Jan 2003 10:58:25 +0100 (CET) From: Harti Brandt To: Nate Lawson Cc: current@FreeBSD.ORG, Subject: Re: Proper -current if_attach locking? In-Reply-To: Message-ID: <20030106105529.C12568-100000@beagle.fokus.gmd.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Fri, 3 Jan 2003, Nate Lawson wrote: NL>I was looking into some "could sleep messages" and found some bogus NL>locking in the attach routine of many drivers. Several init a mtx in NL>their softc and then lock/unlock it in their attach routine. This, of NL>course, does nothing to provide exclusive access to a device. I assume NL>there is going to be a global IF_LOCK or something to be used in attach NL>routines. Can someone fill me in on the intended design? Probably not. I asked the same question a couple of month ago and got 0 answers. I think, there is no way, the driver itself can assure exclusive access to the device it is attaching. It *must* assume, that there is some kind of locking around the call to the attach routine. Getting the lock in the softc inside the attach routine may be neccessary, because the routine may call other functions that assume they have the lock. harti -- harti brandt, http://www.fokus.gmd.de/research/cc/cats/employees/hartmut.brandt/private brandt@fokus.gmd.de, brandt@fokus.fhg.de To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message