From owner-cvs-src@FreeBSD.ORG Wed Jul 30 20:22:30 2008 Return-Path: Delivered-To: cvs-src@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B75781065755; Wed, 30 Jul 2008 20:22:29 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id B28158FC1D; Wed, 30 Jul 2008 20:22:29 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.2/8.14.2) with ESMTP id m6UKMTVE017191; Wed, 30 Jul 2008 20:22:29 GMT (envelope-from emaste@repoman.freebsd.org) Received: (from svn2cvs@localhost) by repoman.freebsd.org (8.14.2/8.14.1/Submit) id m6UKMTf4017190; Wed, 30 Jul 2008 20:22:29 GMT (envelope-from emaste@repoman.freebsd.org) Message-Id: <200807302022.m6UKMTf4017190@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: svn2cvs set sender to emaste@repoman.freebsd.org using -f From: Ed Maste Date: Wed, 30 Jul 2008 20:22:21 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: RELENG_6 Cc: Subject: cvs commit: src/sys/kern kern_timeout.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2008 20:22:31 -0000 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