Date: Wed, 30 Jul 2008 20:22:21 +0000 (UTC) From: Ed Maste <emaste@FreeBSD.org> To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/kern kern_timeout.c Message-ID: <200807302022.m6UKMTf4017190@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
emaste 2008-07-30 20:22:21 UTC FreeBSD src repository Modified files: (Branch: RELENG_6) sys/kern kern_timeout.c Log: SVN rev 181012 on 2008-07-30 20:22:21Z by emaste MFC improved and simplified callout_drain logic and improved ktr(4) logging. r155957: Use the recently added msleep_spin() function to simplify the callout_drain() logic. We no longer need a separate non-spin mutex to do sleep/wakeup with, instead we can now just use the one spin mutex to manage all the callout functionality. r163246: Improve ktr(4) logging for callout(9) subsystem. Log all inserts and removals, including failures, into the callwheel. r171053: Fix an old standing LOR between callout_lock and sleepqueues chain (which could lead to a deadlock). - sleepq_set_timeout acquires callout_lock (via callout_reset()) only with sleepq chain lock held - msleep_spin in _callout_stop_safe lock the sleepqueue chain with callout_lock held In order to solve this don't use msleep_spin in _callout_stop_safe() but use directly sleepqueues as inline msleep_spin code. Rearrange the wakeup path in order to have it consistent too. r172025: Close a race that snuck in with the recent changes to fix a LOR between the callout_lock spin lock and the sleepqueue spin locks. In the fix, callout_drain() has to drop the callout_lock so it can acquire the sleepqueue lock. The state of the callout can change while the callout_lock is held however (for example, it can be rescheduled via callout_reset()). The previous code assumed that the only state change that could happen is that the callout could finish executing. This change alters callout_drain() to effectively restart and recheck everything after it acquires the sleepqueue lock thus handling all the possible states that the callout could be in after any changes while callout_lock was dropped. Revision Changes Path 1.97.2.3 +106 -60 src/sys/kern/kern_timeout.c
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807302022.m6UKMTf4017190>