From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 11 15:02:56 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7852B37B401 for ; Mon, 11 Aug 2003 15:02:56 -0700 (PDT) Received: from mail.speakeasy.net (mail9.speakeasy.net [216.254.0.209]) by mx1.FreeBSD.org (Postfix) with ESMTP id D8CC843F93 for ; Mon, 11 Aug 2003 15:02:55 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 4088 invoked from network); 11 Aug 2003 22:02:55 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender )encrypted SMTP for ; 11 Aug 2003 22:02:55 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.9/8.12.9) with ESMTP id h7BM2q9s053160; Mon, 11 Aug 2003 18:02:52 -0400 (EDT) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.4 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: Date: Mon, 11 Aug 2003 18:03:15 -0400 (EDT) From: John Baldwin To: Ted Unangst cc: freebsd-hackers@freebsd.org Subject: Re: possible deadlocks? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Aug 2003 22:02:56 -0000 On 11-Aug-2003 Ted Unangst wrote: > one more. This falls into the very improbable category. Ordinarily, I > don't think this is possible because FreeBSD doesn't support hotplug PCI, > so sk attachment can't be raced. > > However, assuming I had some hot plug sk card, it seems like running > ifconfig sk0 at just the wrong point during sk1 attach will deadlock. If > it absolutely can not happen (for a reason other than sk is attached > before init runs) please explain. > > sk.c: > sk_attach_xmac() > SK_LOCK(sc); /* grabs */ > ether_ifattach() > ifattach() > IFNET_WLOCK() /* waits for 2 */ > > in6_ifattach.c: > in6_nigroup_attach() > IFNET_RLOCK() /* grabs */ > in6_addmulti() > if_addmulti() > sk_ioctl() > SK_IF_LOCK(); /* waits for 1 */ You can't ifconfig sk0 until after it attaches. sk0 and sk1 don't share locks, so you don't have to worry about the interaction there. Also, SK_LOCK != SK_IF_LOCK, or is that a typo? If it is a typo, then the lock order should still be fixed in some fashion. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/