From owner-freebsd-stable@FreeBSD.ORG Wed Nov 24 04:59:46 2004 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A28DF16A4CE for ; Wed, 24 Nov 2004 04:59:46 +0000 (GMT) Received: from duchess.speedfactory.net (duchess.speedfactory.net [66.23.201.84]) by mx1.FreeBSD.org (Postfix) with SMTP id 41B4143D41 for ; Wed, 24 Nov 2004 04:59:46 +0000 (GMT) (envelope-from ups@tree.com) Received: (qmail 4344 invoked by uid 89); 24 Nov 2004 04:59:45 -0000 Received: from duchess.speedfactory.net (66.23.201.84) by duchess.speedfactory.net with SMTP; 24 Nov 2004 04:59:45 -0000 Received: (qmail 4335 invoked by uid 89); 24 Nov 2004 04:59:45 -0000 Received: from unknown (HELO palm.tree.com) (66.23.216.49) by duchess.speedfactory.net with SMTP; 24 Nov 2004 04:59:45 -0000 Received: from [127.0.0.1] (localhost.tree.com [127.0.0.1]) by palm.tree.com (8.12.10/8.12.10) with ESMTP id iAO4xi5R049251; Tue, 23 Nov 2004 23:59:44 -0500 (EST) (envelope-from ups@tree.com) From: Stephan Uphoff To: Mark Gooderum In-Reply-To: <41A3FE4E.30007@verniernetworks.com> References: <41A3FE4E.30007@verniernetworks.com> Content-Type: text/plain Message-Id: <1101272384.48967.45.camel@palm.tree.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Tue, 23 Nov 2004 23:59:44 -0500 Content-Transfer-Encoding: 7bit cc: freebsd-stable@freebsd.org Subject: Re: propagate_priority KASSERT X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2004 04:59:46 -0000 On Tue, 2004-11-23 at 22:21, Mark Gooderum wrote: > We're currently tripping accross the following KASSERT in > subr_turnstile.c (in 5.3.0 RELEASE): > > /* > * XXX: The owner of a turnstile can be stale if it is the > * first thread to grab a slock of a sx lock. In that case > * it is possible for us to be at SSLEEP or some other > * weird state. We should probably just return if the state > * isn't SRUN or SLOCK. > */ > KASSERT(!TD_IS_SLEEPING(td), > ("sleeping thread %p (pid %d) owns non-sleepable lock %p", > td, td->td_proc->p_pid, ts)) > > This is in propagate_priority(). > > However, propagate_priority() is only called in one place, by > turnstile_wait(), and turnstile_wait() in turn is only called by > _mtx_lock_sleep() which in turn is only used for sleep mutexes. > > TD_IS_SLEEPING() really means the SLEEPING inhibitor is set which in > turn seems to mean that thread is in fact on a sleepq - which is used > for various wait channels and timeouts. > > So I'm just trying to understand why it's a 100% assertion for any > holder of the turnstile for a sleep mutex sleeping. Priority inheritance is needed to avoid blocking interrupt threads for a long time. A thread sleeping while holding a mutex would break priority inheritance. Another reason is that this would add a hidden dependency to the wakeup thread - this can easily lead to deadlocks. Can you find out where the owner of the mutex is sleeping? Stephan