From owner-cvs-src@FreeBSD.ORG Fri Sep 24 01:35:31 2004 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BBADA16A4D4 for ; Fri, 24 Sep 2004 01:35:30 +0000 (GMT) Received: from mail1.speakeasy.net (mail1.speakeasy.net [216.254.0.201]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6E7D943D45 for ; Fri, 24 Sep 2004 01:35:30 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: (qmail 1949 invoked from network); 24 Sep 2004 01:35:29 -0000 Received: from dsl027-160-063.atl1.dsl.speakeasy.net (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) encrypted SMTP for ; 24 Sep 2004 01:35:29 -0000 Received: from [10.50.40.210] (gw1.twc.weather.com [216.133.140.1]) (authenticated bits=0) by server.baldwin.cx (8.12.11/8.12.11) with ESMTP id i8O1ZPVM013624; Thu, 23 Sep 2004 21:35:26 -0400 (EDT) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: "M. Warner Losh" Date: Thu, 23 Sep 2004 21:35:31 -0400 User-Agent: KMail/1.6.2 References: <20040923224739.GE959@green.homeunix.org> <200409231923.40285.jhb@FreeBSD.org> <20040923.191950.04529674.imp@bsdimp.com> In-Reply-To: <20040923.191950.04529674.imp@bsdimp.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200409232135.31918.jhb@FreeBSD.org> X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on server.baldwin.cx cc: green@FreeBSD.org cc: src-committers@FreeBSD.org cc: joerg@FreeBSD.org cc: cvs-src@FreeBSD.org cc: cvs-all@FreeBSD.org cc: nate@root.org Subject: Re: cvs commit: src/sys/dev/fdc fdc.c fdcvar.h X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2004 01:35:31 -0000 On Thursday 23 September 2004 09:19 pm, M. Warner Losh wrote: > In message: <200409231923.40285.jhb@FreeBSD.org> > > John Baldwin writes: > : Note that relying on a wakeup from your own code is not safe if you > : expect fdc to be a module since you could wakeup the thread doing the > : kldunload (and thus detach) and then be interrupted for an interrupt and > : it could unmap the memory backing that function before you get a chance > : to run again resulting in a panic. There is a special wakeup on the > : proc pointer in exit1() for kthreads to handle this case. > > Wouldn't simply unregistering your interrupt before killing the worker > thread handle this case? You are sleeping in the detach path then > until the worker thread goes away. Once it is gone, it is safe to > proceed to detach. cbb does this and I've not had any problems > unloading it. In fact, it was how you told me to write cbb a long > time ago. Once the bus_teardown_intr() returns, you are guaranteed > the interrupt won't get called. What about someone else's interrupt preempting you? > : I should > : likely move that into kthread_exit() however (which wouldn't be a > : functional change as far as you are concerned). > > I'm not sure I understand this part of your statement. I currently have a wakeup() buried in exit1() conditional on p_flag & P_KTHREAD. I should just move it to kthread_exit() so it happens sooner and is less obfuscated. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org