From owner-freebsd-current@FreeBSD.ORG Thu Apr 10 06:12:47 2003 Return-Path: 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 0175B37B404; Thu, 10 Apr 2003 06:12:47 -0700 (PDT) Received: from mailhub.fokus.fraunhofer.de (mailhub.fokus.fraunhofer.de [193.174.154.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8BDE443FB1; Thu, 10 Apr 2003 06:12:45 -0700 (PDT) (envelope-from brandt@fokus.fraunhofer.de) Received: from beagle (beagle [193.175.132.100])h3ADCiE10670; Thu, 10 Apr 2003 15:12:44 +0200 (MEST) Date: Thu, 10 Apr 2003 15:12:43 +0200 (CEST) From: Harti Brandt To: Jeffrey Hsu In-Reply-To: <200304101251.h3ACphHo021011@mta7.pltn13.pbi.net> Message-ID: <20030410150609.U1863@beagle.fokus.fraunhofer.de> References: <200304101251.h3ACphHo021011@mta7.pltn13.pbi.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-current@FreeBSD.org Subject: Re: LOR in if_detach X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: harti@FreeBSD.org List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Apr 2003 13:12:47 -0000 On Thu, 10 Apr 2003, Jeffrey Hsu wrote: JH> > I must stop the interface before calling if_detach. JH> JH>The midway driver doesn't do that now anyways, so there's no reason to JH>start now. I have rewritten the midway driver for busdma, to use (more or less correct) locking and build as a module. You must stop the interface in that case to free resource and to ensure, that it has stopped dma-ing. JH> > If I unlock after stoping before detaching, I get a race window JH> > where somebody could just UP the interface. JH> JH>This race is outside the scope of the network driver lock. So what mechanism ensures, that my exported functions (ioctl, start, init) are not called while I'm detaching? Is there such a mechanism or not? JH> > While thinking about, it seems, that having a lock in struct ifnet would JH> > make sense in the long run. How can we otherwise ensure, that nobody is JH> > calling if_ioctl while we are detaching the interface? JH> JH>That's what I had planned. What would that lock do? I mean, which, if any, of the exported driver functions would be called with that lock held? harti -- harti brandt, http://www.fokus.fraunhofer.de/research/cc/cats/employees/hartmut.brandt/private brandt@fokus.fraunhofer.de, harti@freebsd.org