From owner-cvs-all Mon Nov 25 10:19:53 2002 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2760237B401 for ; Mon, 25 Nov 2002 10:19:47 -0800 (PST) Received: from mail.speakeasy.net (mail12.speakeasy.net [216.254.0.212]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9C0D643EAA for ; Mon, 25 Nov 2002 10:19:46 -0800 (PST) (envelope-from jhb@FreeBSD.org) Received: (qmail 22747 invoked from network); 25 Nov 2002 18:19:49 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) by mail12.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 25 Nov 2002 18:19:49 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.6/8.12.6) with ESMTP id gAPIJguH009527; Mon, 25 Nov 2002 13:19:43 -0500 (EST) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.2 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: Date: Mon, 25 Nov 2002 13:19:47 -0500 (EST) From: John Baldwin To: Julian Elischer Subject: Re: cvs commit: src/sys/kern kern_thread.c src/sys/sys proc.h sr Cc: "cvs-all@FreeBSD.org" Cc: "cvs-all@FreeBSD.org" , "cvs-committers@FreeBSD.org" , Maxime Henrion , David Xu Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 23-Nov-2002 Julian Elischer wrote: > > > On Sat, 23 Nov 2002, David Xu wrote: > >> This commit cause kernel panic when run threaded program. >> try /usr/src/tools/KSE/ksetest > > Maxime.. > > The extended PCB fields need to be freed for every > thread_exit(), not just when we eventually free the thread_structure > (which may never happen) Well, cpu_exit() isn't called for every thread_exit() so that isn't going to work, and cpu_thread_exit() is too early/late. In fact, anywhere in thread_exit() is really too early/late. So when is the case that it breaks, when a thread structure gets recycled? Perhaps it is the bit where we free the spare thread and make this thread the spare thread? Ugh. Hmm, why not use a per-cpu thread pointer that you put the curthread into and then have fork_exit() and mi_switch() check for a thread in that pointer and stick it in the zombie thread list if it finds one? Then the thread will get free()'d. With this you wouldn't bother with free'ing the current spare thread. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message