From owner-freebsd-smp Thu Oct 5 14:42:48 2000 Delivered-To: freebsd-smp@freebsd.org Received: from smtp05.primenet.com (smtp05.primenet.com [206.165.6.135]) by hub.freebsd.org (Postfix) with ESMTP id C2DEC37B502 for ; Thu, 5 Oct 2000 14:42:46 -0700 (PDT) Received: (from daemon@localhost) by smtp05.primenet.com (8.9.3/8.9.3) id OAA26992; Thu, 5 Oct 2000 14:43:03 -0700 (MST) Received: from usr05.primenet.com(206.165.6.205) via SMTP by smtp05.primenet.com, id smtpdAAAdbaWL0; Thu Oct 5 14:42:55 2000 Received: (from tlambert@localhost) by usr05.primenet.com (8.8.5/8.8.5) id OAA15421; Thu, 5 Oct 2000 14:42:29 -0700 (MST) From: Terry Lambert Message-Id: <200010052142.OAA15421@usr05.primenet.com> Subject: Re: Problems with kthread_exit() and SMPng To: bright@wintelcom.net (Alfred Perlstein) Date: Thu, 5 Oct 2000 21:42:28 +0000 (GMT) Cc: mark@grondar.za (Mark Murray), jburkhol@home.com (Jake Burkholder), bp@butya.kz (Boris Popov), freebsd-smp@FreeBSD.ORG In-Reply-To: <20001005113139.C27736@fw.wintelcom.net> from "Alfred Perlstein" at Oct 05, 2000 11:31:39 AM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-smp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > > There is another problem; printf's inside a kthread corrupt like > > crazy. They look very unthreadsafe. > > do NOT use printf without Giant. This strikes me as being rather inane. If printf won't work without holging the lock, then it damn well should acquire the lock if it isn't already held, and release it if it acquired it, before returning. This is not something that a programmer should have to worry about when they use a service; unless you are doing threads IPC, perhaps in some vainglorious attempt to make SMP systems stall their little butts off with interprocessor synchrnization, this should never be an issue. In other words, I don't give a damn, as a programmer, whether a service is reentrant or not, so long as it works when I call it. Having the lock fairy sprinkle lock primitives before and after every service call is not my idea of a Good Thing. This appears to be a very good point to note that having an owner or recursing on this lock would both end up being Very Bad Things, since it would make the obvious and intuitive (and therefore least astonishing) behaviour impossible. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the message