Date: Fri, 15 Dec 2000 14:12:39 -0800 (PST) From: John Baldwin <jhb@FreeBSD.org> To: cvs-committers@FreeBSD.org Cc: cvs-all@FreeBSD.org Subject: RE: cvs commit: src/sys/kern subr_log.c Message-ID: <XFMail.001215141239.jhb@FreeBSD.org> In-Reply-To: <200012152123.eBFLNYF61141@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <jhb@FreeBSD.org> -- 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.001215141239.jhb>