From owner-cvs-src@FreeBSD.ORG Fri Oct 26 19:28:00 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 E8F3716A469; Fri, 26 Oct 2007 19:28:00 +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 2A6EC13C4C3; Fri, 26 Oct 2007 19:27:59 +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 216261318-1834499 for multiple; Fri, 26 Oct 2007 15:30:18 -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 l9QJRbVC038559; Fri, 26 Oct 2007 15:27:38 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: Julian Elischer Date: Fri, 26 Oct 2007 15:24:51 -0400 User-Agent: KMail/1.9.6 References: <200710261703.l9QH3Nmt061137@repoman.freebsd.org> <200710261420.34168.jhb@freebsd.org> <4722399E.3090209@elischer.org> In-Reply-To: <4722399E.3090209@elischer.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200710261524.51945.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 15:27:38 -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, Julian Elischer , 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 19:28:01 -0000 On Friday 26 October 2007 03:01:50 pm Julian Elischer wrote: > John Baldwin wrote: > > 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); > > the kproc_exit still does.. > > I didn't see any users of it in the code that I've switched to kthreads > so far so I haven't added it to the kthread_exit() yet. Ok. That needs to happen at some point so that more kprocs can be kthreads. For example, ipmi(4) creates a kthread/kproc, so does random(4), fdc(4), and I think ndis(4). -- John Baldwin