From owner-cvs-all@FreeBSD.ORG Wed Apr 30 10:52:38 2003 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D5E8837B404 for ; Wed, 30 Apr 2003 10:52:38 -0700 (PDT) Received: from mail.speakeasy.net (mail16.speakeasy.net [216.254.0.216]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3B50143FAF for ; Wed, 30 Apr 2003 10:52:37 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 6442 invoked from network); 30 Apr 2003 17:52:42 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender )encrypted SMTP for ; 30 Apr 2003 17:52:42 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.8/8.12.8) with ESMTP id h3UHqYOv022275; Wed, 30 Apr 2003 13:52:34 -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: <20030430.091421.81670921.imp@bsdimp.com> Date: Wed, 30 Apr 2003 13:52:39 -0400 (EDT) From: John Baldwin To: "M. Warner Losh" cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: brandt@fokus.fraunhofer.de cc: cvs-all@FreeBSD.org cc: nate@root.org Subject: Re: cvs commit: src/sys/dev/fxp if_fxp.c if_fxpvar.h X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Apr 2003 17:52:39 -0000 On 30-Apr-2003 M. Warner Losh wrote: > In message: <20030430093448.U31027@beagle.fokus.fraunhofer.de> > Harti Brandt writes: >: On Tue, 29 Apr 2003, Nate Lawson wrote: >: >: NL>On Mon, 28 Apr 2003, Warner Losh wrote: >: >: NL>> 2) Call FXP_UNLOCK() before calling bus_teardown_intr to avoid >: NL>> a possible deadlock reported by jhb. >: NL> >: NL>This adds a race since fxp_intr could occur after the unlock but before >: NL>the bus_teardown_intr call. The reason why I tore down the intr while >: NL>holding the lock is so fxp_intr would be prevented from accessing the >: NL>device until it has been disabled. Then the normal checks in fxp_intr >: NL>(IFF_OACTIVE or whatever) would show the card is gone and return without >: NL>accessing it. I guess this is ok since ether_ifdetach is still called >: NL>with the lock held (since it is what clears IFF_OACTIVE) but I'm >: NL>interested in your thoughts. >: >: For what I know, you should not call ether_ifdetach with the card lock >: held. ether_ifdetach calls if_detach which in turn may lock the radix node >: head to remove routes. The lock order should be 1) radix node head, 2) >: interface not the other way around. > > Right now there's no safe way to use driver locks. Sometimes, we have > to acquire the locks NET, DRIVER. Other times you do the reverse. > There are other times you do need to call ether_ifdetach with the lock > held. This is a real mess. I'm contemplating a strawman proposal to > help address these issues. This is why I think driver locks should be added last after the infrastructure is finished. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/