From owner-freebsd-smp Thu Oct 5 14:31:10 2000 Delivered-To: freebsd-smp@freebsd.org Received: from pike.osd.bsdi.com (pike.osd.bsdi.com [204.216.28.222]) by hub.freebsd.org (Postfix) with ESMTP id 62CBA37B502 for ; Thu, 5 Oct 2000 14:31:07 -0700 (PDT) Received: from laptop.baldwin.cx (john@dhcp248.osd.bsdi.com [204.216.28.248]) by pike.osd.bsdi.com (8.11.0/8.9.3) with ESMTP id e95LURi15463; Thu, 5 Oct 2000 14:30:27 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <20001005223733.A40689@cicely5.cicely.de> Date: Thu, 05 Oct 2000 14:30:39 -0700 (PDT) From: John Baldwin To: Bernd Walter Subject: Re: Problems with kthread_exit() and SMPng Cc: Jake Burkholder , Boris Popov , freebsd-smp@FreeBSD.org, Mark Murray Sender: owner-freebsd-smp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On 05-Oct-00 Bernd Walter wrote: > 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. Ugh. If I'm going to go stick mutexes in code, I want to put the right ones in. :-P > -- > B.Walter COSMO-Project http://www.cosmo-project.de > ticso@cicely.de Usergroup info@cosmo-project.de -- John Baldwin -- http://www.FreeBSD.org/~jhb/ PGP Key: http://www.baldwin.cx/~john/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the message