From owner-freebsd-smp Fri Oct 6 9:52:45 2000 Delivered-To: freebsd-smp@freebsd.org Received: from berserker.bsdi.com (berserker.twistedbit.com [199.79.183.1]) by hub.freebsd.org (Postfix) with ESMTP id 180D937B502 for ; Fri, 6 Oct 2000 09:52:43 -0700 (PDT) Received: from berserker.bsdi.com (cp@localhost [127.0.0.1]) by berserker.bsdi.com (8.9.3/8.9.3) with ESMTP id KAA14529 for ; Fri, 6 Oct 2000 10:52:38 -0600 (MDT) Message-Id: <200010061652.KAA14529@berserker.bsdi.com> To: freebsd-smp@freebsd.org Subject: Kernel printf Was: Problems with kthread_exit() and SMPng In-reply-to: Your message of "Fri, 06 Oct 2000 12:30:53 +0200." <20001006123053.A42012@cicely5.cicely.de> From: Chuck Paterson Date: Fri, 06 Oct 2000 10:52:38 -0600 Sender: owner-freebsd-smp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org There is no single mutex you can grab and be safe. If the printf is coming from some place with a spin lock you can't grab a sleep lock to protect. You can't hold a spin lock while you call into the output routines. Furthermore you really don't know that you won't introduce a lock ordering problem. Just grabbing Giant isn't even safe in the short term because there can be lock ordering problems. If you queue and then do the output with a soft interrupt you should get output immediately. The cases were you don't is from the bottom half, when a mutex is held someplace else that prevents the output from occurring, or the current thread has its effective priority raised for some reason, such as holding a spin lock. This would seem to meet all the real needs and is only a minor PITA to implement. Chuck To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the message