From owner-freebsd-current Tue Jan 7 10: 9:15 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A400D37B401; Tue, 7 Jan 2003 10:09:13 -0800 (PST) Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id E3BF543E4A; Tue, 7 Jan 2003 10:09:08 -0800 (PST) (envelope-from gallatin@cs.duke.edu) Received: from grasshopper.cs.duke.edu (grasshopper.cs.duke.edu [152.3.145.30]) by duke.cs.duke.edu (8.12.6/8.12.6) with ESMTP id h07I96ro018987 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Tue, 7 Jan 2003 13:09:06 -0500 (EST) Received: (from gallatin@localhost) by grasshopper.cs.duke.edu (8.11.6/8.9.1) id h07I91S59743; Tue, 7 Jan 2003 13:09:01 -0500 (EST) (envelope-from gallatin@cs.duke.edu) From: Andrew Gallatin MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15899.6077.710661.497492@grasshopper.cs.duke.edu> Date: Tue, 7 Jan 2003 13:09:01 -0500 (EST) To: "M. Warner Losh" Cc: tlambert2@mindspring.com, nate@root.org, current@FreeBSD.ORG, net@FreeBSD.ORG Subject: Re: Proper -current if_attach locking? In-Reply-To: <20030107.105933.19259527.imp@bsdimp.com> References: <20030107.021428.126452776.imp@bsdimp.com> <20030107.022617.23700606.imp@bsdimp.com> <15898.60467.681434.927797@grasshopper.cs.duke.edu> <20030107.105933.19259527.imp@bsdimp.com> X-Mailer: VM 6.75 under 21.1 (patch 12) "Channel Islands" XEmacs Lucid Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG M. Warner Losh writes: > In message: <15898.60467.681434.927797@grasshopper.cs.duke.edu> > Andrew Gallatin writes: > : The IFNET_RLOCK() called in if_slowtimo() is a global lock for the > : list of ifnet structs to ensure that no devices are removed or added > : while something may be using it. There is one ifnet list in the system. > > So this means that only the locking in attach is bogus, and similar > locking in detach is also bogus because they produce lock order > reversals as the global lock is held to insert/remove if interfaces. Yes. Though I haven't looked at if_dc myself, there may be other locking problems. I've only been commenting on the ones that you brought up. But back to an earlier point. Somebody (you?) validly pointed out that the driver should not be callable and should not generate interrupts until its finished attaching. The lock in its attach was probably a somewhat misguided attempt at that. The first point can be accomplished by doing the ether_ifattach() last, but the second may be harder. I do that by poking a bit on my card which prevents it from generating interrupts while the device is being setup. Not sure if a similar bit exists on tulip cards. Drew To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message