From owner-cvs-all@FreeBSD.ORG Fri Oct 26 19:37:10 2007 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4977816A476 for ; Fri, 26 Oct 2007 19:37:10 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outC.internet-mail-service.net (outC.internet-mail-service.net [216.240.47.226]) by mx1.freebsd.org (Postfix) with ESMTP id 293F113C4A7 for ; Fri, 26 Oct 2007 19:37:09 +0000 (UTC) (envelope-from julian@elischer.org) Received: from mx0.idiom.com (HELO idiom.com) (216.240.32.160) by out.internet-mail-service.net (qpsmtpd/0.40) with ESMTP; Fri, 26 Oct 2007 12:37:04 -0700 X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (nat.ironport.com [63.251.108.100]) by idiom.com (Postfix) with ESMTP id F353212681F; Fri, 26 Oct 2007 12:37:03 -0700 (PDT) Message-ID: <472241FD.1080502@elischer.org> Date: Fri, 26 Oct 2007 12:37:33 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.6 (Macintosh/20070728) MIME-Version: 1.0 To: John Baldwin References: <200710261703.l9QH3Nmt061137@repoman.freebsd.org> <200710261420.34168.jhb@freebsd.org> <4722399E.3090209@elischer.org> <200710261524.51945.jhb@freebsd.org> In-Reply-To: <200710261524.51945.jhb@freebsd.org> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit 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-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Oct 2007 19:37:10 -0000 John Baldwin wrote: > 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). I'll check them out and see what the best solution is.. >