Re: why do I have to grab Giant before call to kthread_exit() ?

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Wed, 4 Feb 2004 13:37:17 -0500
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_at_FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org
Received on Wed Feb 04 2004 - 09:45:45 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:41 UTC