From owner-freebsd-current@FreeBSD.ORG Wed Feb 4 10:45:45 2004 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 4876216A4CE for ; Wed, 4 Feb 2004 10:45:45 -0800 (PST) Received: from mail3.speakeasy.net (mail3.speakeasy.net [216.254.0.203]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1A9AE43D3F for ; Wed, 4 Feb 2004 10:45:43 -0800 (PST) (envelope-from jhb@FreeBSD.org) Received: (qmail 3173 invoked from network); 4 Feb 2004 18:45:41 -0000 Received: from dsl027-160-063.atl1.dsl.speakeasy.net (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) encrypted SMTP for ; 4 Feb 2004 18:45:41 -0000 Received: from 10.50.40.205 (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.10/8.12.10) with ESMTP id i14IjQM0007838; Wed, 4 Feb 2004 13:45:28 -0500 (EST) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: Poul-Henning Kamp , current@freebsd.org Date: Wed, 4 Feb 2004 13:37:17 -0500 User-Agent: KMail/1.5.4 References: <28193.1075883194@critter.freebsd.dk> In-Reply-To: <28193.1075883194@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200402041337.17384.jhb@FreeBSD.org> X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) Subject: Re: why do I have to grab Giant before call to kthread_exit() ? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Feb 2004 18:45:45 -0000 On Wednesday 04 February 2004 03:26 am, Poul-Henning Kamp wrote: > It seems somewhat bogus to me that I can create and run a kthread > without Giant but I need to grab Giant before it exits... > > panic: mutex Giant not owned at ../../../kern/kern_exit.c:123 > at line 719 in file ../../../kern/kern_mutex.c > cpuid = 0; > Debugger("panic") > Stopped at 0xc06a7cf5 = Debugger+0x55: xchgl %ebx,0xc07bab24 = > in_Debugger.0 db> trace > Debugger(c0712b15,0,2cf,c0711f91,100) at 0xc06a7cf5 = Debugger+0x55 > __panic(c0711f91,2cf,c07120f9,c0712234,c0710532) at 0xc0532782 = > __panic+0x172 _mtx_assert(c076b460,1,c0710532,7b,c05398e3) at 0xc0528dec = > _mtx_assert+0x11c exit1(c18ebd20,0,88,87,0) at 0xc0519e43 = exit1+0x33 > kthread_exit(0,0,c070d581,29e,64) at 0xc0520126 = kthread_exit+0xb6 > g_bde_worker(c1a0fc80,c54b3d48,c0710609,317,c194adc0) at 0xc04f6db5 = > g_bde_worker+0x4a5 fork_exit(c04f6910,c1a0fc80,c54b3d48) at 0xc051d065 = > fork_exit+0xc5 fork_trampoline() at 0xc06a94bc = fork_trampoline+0x8 > --- trap 0x1, eip = 0, esp = 0xc54b3d7c, ebp = 0 --- Because kthread_exit() isn't safe. :) However, it can probably just grab Giant itself. Peter wants me to look at pushing Giant down into fork/wait/ exit as much as I can, so I'll fix kthread_exit() to get Giant if needed as part of that. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org