From owner-freebsd-hackers Wed Jun 19 11:55:41 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id 7FFAD37B405 for ; Wed, 19 Jun 2002 11:55:35 -0700 (PDT) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 19 Jun 2002 19:55:31 +0100 (BST) To: Andy Sporner Cc: freebsd-hackers Subject: Re: Kernel Panic using kproc_exit() on FreeBSD 5.0-20020302-PREVIEW In-Reply-To: Your message of "Mon, 17 Jun 2002 11:47:13 +0200." <3D0DB021.4080102@nentec.de> Date: Wed, 19 Jun 2002 19:55:30 +0100 From: Ian Dowse Message-ID: <200206191955.aa29511@salmon.maths.tcd.ie> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In message <3D0DB021.4080102@nentec.de>, Andy Sporner writes: >SYSINIT(modtcpd, SI_SUB_KTHREAD_BUF, SI_ORDER_FIRST, kproc_start, &kp) >static void modtcpd(void) >{ > tsleep(0x0dead0001, 0, "General Wait", 400); > kthread_exit(0); >} ... >panic: mutex Giant not owned at ../../../kern/kern_exit.c"131 If you haven't guessed already by looking at other kernel threads, you need to "mtx_lock(&Giant);" before calling kthread_exit(). Most kthreads acquire Giant at the start and hold it throughout their execution (it it implicitly dropped when the thread is sleeping). You should do this too unless you are sure that all operations that the thread is performing are safe to do without Giant. Ian To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message