From owner-cvs-src@FreeBSD.ORG Fri Oct 26 18:21:12 2007 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 08F0216A41A; Fri, 26 Oct 2007 18:21:12 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from speedfactory.net (mail6.speedfactory.net [66.23.216.219]) by mx1.freebsd.org (Postfix) with ESMTP id 6731B13C481; Fri, 26 Oct 2007 18:21:11 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (unverified [66.23.211.162]) by speedfactory.net (SurgeMail 3.8p) with ESMTP id 216251107-1834499 for multiple; Fri, 26 Oct 2007 14:23:44 -0400 Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.8/8.13.8) with ESMTP id l9QIKdC5037881; Fri, 26 Oct 2007 14:21:04 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: Julian Elischer Date: Fri, 26 Oct 2007 14:20:33 -0400 User-Agent: KMail/1.9.6 References: <200710261703.l9QH3Nmt061137@repoman.freebsd.org> In-Reply-To: <200710261703.l9QH3Nmt061137@repoman.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200710261420.34168.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Fri, 26 Oct 2007 14:21:04 -0400 (EDT) X-Virus-Scanned: ClamAV 0.91.2/4600/Fri Oct 26 10:02:30 2007 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/sys kthread.h src/sys/kern kern_kthread.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Oct 2007 18:21:12 -0000 On Friday 26 October 2007 01:03:22 pm Julian Elischer wrote: > julian 2007-10-26 17:03:22 UTC > > FreeBSD src repository > > Modified files: > sys/sys kthread.h > sys/kern kern_kthread.c > Log: > kthread_exit needs no stinkin argument. So an important property of the old kthread_exit() (now kproc_exit()) was that a kernel module could safely ensure that a kthread it created was out of the kernel module's text segment before returning from a module unload hook to prevent kernel panics by sleeping on the proc pointer with the proc lock like so: mtx_lock(&mylock); PROC_LOCK(p); signal_death = 1; mtx_unlock(&mylock); msleep(p, &p->p_mtx, ...); PROC_UNLOCK(p); And have the main thread do this: ... mtx_lock(&mylock); while (!signal_death) { ... fetch work, may drop mylock... } mtx_unlock(&mylock); kthread_exit(0); ... That was the purpose of the 'wakeup(curthread->td_proc)' in the old kthread_exit(). How is this race handled now since the new kthread_exit() doesn't have any wakeups, etc.? -- John Baldwin