From owner-freebsd-current Tue Jan 7 10: 6:57 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 7C83A37B406; Tue, 7 Jan 2003 10:06:52 -0800 (PST) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id E62D644322; Tue, 7 Jan 2003 10:01:22 -0800 (PST) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.6/8.12.3) with ESMTP id h07I0N1e069426; Tue, 7 Jan 2003 11:00:23 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Tue, 07 Jan 2003 10:59:33 -0700 (MST) Message-Id: <20030107.105933.19259527.imp@bsdimp.com> To: gallatin@cs.duke.edu Cc: tlambert2@mindspring.com, nate@root.org, current@FreeBSD.ORG, net@FreeBSD.ORG Subject: Re: Proper -current if_attach locking? From: "M. Warner Losh" In-Reply-To: <15898.60467.681434.927797@grasshopper.cs.duke.edu> References: <20030107.021428.126452776.imp@bsdimp.com> <20030107.022617.23700606.imp@bsdimp.com> <15898.60467.681434.927797@grasshopper.cs.duke.edu> X-Mailer: Mew version 2.1 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 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. : The lock in IF_PREPEND() (and more commonly used in drivers, : IF_DEQUE()) is per-ifq, to protect against multiple accesses : to a single ifq. There are many ifqs in the system. I knew I must have been missing something really fundamental last night. Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message