From owner-cvs-all Fri Dec 15 14:12:40 2000 From owner-cvs-all@FreeBSD.ORG Fri Dec 15 14:12:36 2000 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from pike.osd.bsdi.com (pike.osd.bsdi.com [204.216.28.222]) by hub.freebsd.org (Postfix) with ESMTP id E0CBF37B400; Fri, 15 Dec 2000 14:12:35 -0800 (PST) Received: from laptop.baldwin.cx (john@jhb-laptop.osd.bsdi.com [204.216.28.241]) by pike.osd.bsdi.com (8.11.1/8.9.3) with ESMTP id eBFMCLE30914; Fri, 15 Dec 2000 14:12:21 -0800 (PST) (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: <200012152123.eBFLNYF61141@freefall.freebsd.org> Date: Fri, 15 Dec 2000 14:12:39 -0800 (PST) From: John Baldwin To: cvs-committers@FreeBSD.org Subject: RE: cvs commit: src/sys/kern subr_log.c Cc: cvs-all@FreeBSD.org Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 15-Dec-00 John Baldwin wrote: > jhb 2000/12/15 13:23:33 PST > > Modified files: > sys/kern subr_log.c > Log: > Delay waking up processes select'ing on the log device directly from > the kernel console. Instead, change logwakeup() to set a flag in the > softc. A callout then wakes up every so often and wakes up any processes > selecting on /dev/log (such as syslogd) if the flag is set. By default > this callout fires 5 times a second, but that can be adjusted by the > sysctl kern.log_wakeups_per_second. > > Reviewed by: phk printf(9) always calls logwakeup() after displaying a message on the console. However, it's not always safe to be calling wakeup in this case. Specifically, the printf() in mi_switch() due to microuptime going backwards is called with sched_lock held. When logwakeup() attempted to call selwakeup() it ended up choking on pfind() since the process list is protected by a reader/writer lock backed by a lockmgr lock, which is in turn backed by a sleep mutex. This led to acquiring a sleep mutex when a spin mutex is held, which is bad. Sleep mutexes can never be obtained after a spin mutex. Since printf(9) is widely used (and is a viable debug tool in some cases), there likely are/will be other places where printf(9) is called but waking up syslogd can be dangerous. This disconnects the two operatiions making printf(9) a little more robust in more "sensitive" areas of the kernel. That and I wanted to get X to start up on my laptop w/o resetting the machine each time. :) -- 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 cvs-all" in the body of the message