From owner-freebsd-smp Thu Oct 5 13:37:22 2000 Delivered-To: freebsd-smp@freebsd.org Received: from mail.du.gtn.com (mail.du.gtn.com [194.77.9.57]) by hub.freebsd.org (Postfix) with ESMTP id 6A7F637B66D; Thu, 5 Oct 2000 13:37:18 -0700 (PDT) Received: from mail.cicely.de (cicely.de [194.231.9.142]) by mail.du.gtn.com (8.11.0.Beta3/8.11.0.Beta3) with ESMTP id e95KbDC19120 (using TLSv1/SSLv3 with cipher EDH-RSA-DES-CBC3-SHA (168 bits) verified OK); Thu, 5 Oct 2000 22:37:16 +0200 (MET DST) Received: from cicely5.cicely.de (cicely5.cicely.de [fec0::104:200:92ff:fe9b:20e7]) by mail.cicely.de (8.11.0.Beta1/8.11.0.Beta1) with ESMTP id e95KbjT63205; Thu, 5 Oct 2000 22:37:45 +0200 (CEST) Received: (from ticso@localhost) by cicely5.cicely.de (8.11.0/8.9.2) id e95KbYC40750; Thu, 5 Oct 2000 22:37:34 +0200 (CEST) (envelope-from ticso) Date: Thu, 5 Oct 2000 22:37:33 +0200 From: Bernd Walter To: John Baldwin Cc: Mark Murray , freebsd-smp@FreeBSD.ORG, Boris Popov , Jake Burkholder Subject: Re: Problems with kthread_exit() and SMPng Message-ID: <20001005223733.A40689@cicely5.cicely.de> References: <200010051826.e95IQfJ12260@grimreaper.grondar.za> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i In-Reply-To: ; from jhb@FreeBSD.ORG on Thu, Oct 05, 2000 at 11:53:53AM -0700 Sender: owner-freebsd-smp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Thu, Oct 05, 2000 at 11:53:53AM -0700, John Baldwin wrote: > > On 05-Oct-00 Mark Murray wrote: > > Hmm. I'll try that. Will the (kthread_)exit release Giant? > > Yes. cpu_exit() (called by exit1()) releases Giant as its > final act before calling cpu_switch() (should be cpu_throw()) > to run the next process. > > > My thread does a lot of work; if it holds Giant, then it can't be > > preempted. That would be a problem. > > Errr, it can be pre-empted, but your thread doesn't need Giant except > for kthread_exit(). > > > There is another problem; printf's inside a kthread corrupt like > > crazy. They look very unthreadsafe. > > printf() is not MP safe. :-P You probably want to grab Giant before > calling printf(). Isn't it better to just fetch Giant inside of kthread_exit() and printf()? Giant is recursive so it shouldn't hurt much if we allocate it while already owning it but we don't need to rechange thread safe code after these restrictions fall. -- B.Walter COSMO-Project http://www.cosmo-project.de ticso@cicely.de Usergroup info@cosmo-project.de To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the message