Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Feb 2004 13:37:17 -0500
From:      John Baldwin <jhb@FreeBSD.org>
To:        Poul-Henning Kamp <phk@phk.freebsd.dk>, current@freebsd.org
Subject:   Re: why do I have to grab Giant before call to kthread_exit() ?
Message-ID:  <200402041337.17384.jhb@FreeBSD.org>
In-Reply-To: <28193.1075883194@critter.freebsd.dk>
References:  <28193.1075883194@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200402041337.17384.jhb>