From owner-freebsd-hackers@FreeBSD.ORG Tue Sep 9 12:53:59 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67E2E10656C5 for ; Tue, 9 Sep 2008 12:53:59 +0000 (UTC) (envelope-from kr.lekha@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.226]) by mx1.freebsd.org (Postfix) with ESMTP id 3ADD18FC1C for ; Tue, 9 Sep 2008 12:53:58 +0000 (UTC) (envelope-from kr.lekha@gmail.com) Received: by rv-out-0506.google.com with SMTP id b25so2690832rvf.43 for ; Tue, 09 Sep 2008 05:53:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type:references; bh=1h7QkLH9m7oKWQU4bbrAE90H0LKfCR8o9dPi12EaF1E=; b=sRd0BRKLhHk9SbNfAOwo/FLs0Q1M7x7tyZzCQdRwEulUnjAaAGuzf08400McjVrYpZ xb2Ztbmpc5Eh7m0mY34mmoVcyBxQgaOlejfB/Em7Ka0FJlp5YgdgwQp3YPyvVeQJqDPK ZNkBwNxodmaZcG0IAYkhlBgNV3CHA2Mwnwy5c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:references; b=FyQkHyIoDwuCZ2iRk+IqHR4xD5APiV36fLqtRzSq4IzBC02Lurt2DOFo4wU89p2bUI Zw+seRHg2MNSRDzcQ2DJGbzuVzYF5kTF4F2o60kvo2yZ3hbrNMbUXnyMyBjfg8Y25fQ9 kAYxF3G5Pn28sfvzH0twu7ixj3IzSUcjwoO8E= Received: by 10.141.37.16 with SMTP id p16mr211664rvj.67.1220964837676; Tue, 09 Sep 2008 05:53:57 -0700 (PDT) Received: by 10.141.212.11 with HTTP; Tue, 9 Sep 2008 05:53:57 -0700 (PDT) Message-ID: <96b2ec350809090553q3ba36125nd3da14129da0f2b3@mail.gmail.com> Date: Tue, 9 Sep 2008 13:53:57 +0100 From: "kr Lekha" To: "kr Lekha" , "Rui Paulo" , freebsd-hackers@freebsd.org In-Reply-To: <20080903211459.GA60350@zim.MIT.EDU> MIME-Version: 1.0 References: <96b2ec350809030134j73a61369m35395391a1218975@mail.gmail.com> <20080903095605.GB21178@alpha.local> <96b2ec350809030516y2d6f26d1h3cd7eb39231c4da0@mail.gmail.com> <20080903211459.GA60350@zim.MIT.EDU> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: Re: killing a kthread X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Sep 2008 12:53:59 -0000 Hi all, thanks very much for your valuable inputs. I found out the way to exit the thread. Problem was psignal(p, SIGKILL); , the p->p_siglist was being reset after propagating this signal to threads associated with this proc. Hence i could poll once in a way if any unhandled signals were in curthread->td_siglist. I am not sure if this is the optimal solution. Please do sugest if you have a better solution Why cant we have signal handlers for kernel threads? when i tried to register one, sigaction returned value 14 and signal handler didnt get registered. Thanks, lekha On Wed, Sep 3, 2008 at 10:14 PM, David Schultz wrote: > On Wed, Sep 03, 2008, kr Lekha wrote: > > I understand when thread finishes it should call kthread_exit(). > > but if this thread was suspended before it finished, it might not be able > to > > call kthread_exit(). > > > > Due to which we still see the thread suspended. I am unable to kill it > > even with killproc / psignal with in the kernel module. > > That's by design. Kernel threads can hold arbitrary kernel > resources, and there's no mechanism to clean up after them > automatically. They are expected to clean up after themselves and > exit gracefully. In your case, you'll need to wake up the > suspended thread and somehow notify it that you want it to > terminate. >