From owner-freebsd-arch@FreeBSD.ORG Wed Sep 29 20:26:19 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 96B5B16A4CE for ; Wed, 29 Sep 2004 20:26:19 +0000 (GMT) Received: from duchess.speedfactory.net (duchess.speedfactory.net [66.23.201.84]) by mx1.FreeBSD.org (Postfix) with SMTP id 2D3A443D2F for ; Wed, 29 Sep 2004 20:26:19 +0000 (GMT) (envelope-from ups@tree.com) Received: (qmail 10052 invoked by uid 89); 29 Sep 2004 20:26:18 -0000 Received: from duchess.speedfactory.net (66.23.201.84) by duchess.speedfactory.net with SMTP; 29 Sep 2004 20:26:18 -0000 Received: (qmail 10028 invoked by uid 89); 29 Sep 2004 20:26:17 -0000 Received: from unknown (HELO palm.tree.com) (66.23.216.49) by duchess.speedfactory.net with SMTP; 29 Sep 2004 20:26:17 -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 i8TKQGmt017003; Wed, 29 Sep 2004 16:26:16 -0400 (EDT) (envelope-from ups@tree.com) From: Stephan Uphoff To: Peter Holm In-Reply-To: <1096477932.3733.1471.camel@palm.tree.com> References: <1095468747.31297.241.camel@palm.tree.com> <1095529353.31297.1192.camel@palm.tree.com> <1096135220.53798.17754.camel@palm.tree.com> <20040926075218.GA85983@peter.osted.lan> <1096339936.3733.279.camel@palm.tree.com> <20040928074926.GA99957@peter.osted.lan> <1096383103.3733.312.camel@palm.tree.com> <20040929085748.GA19695@peter.osted.lan> <1096467843.3733.1145.camel@palm.tree.com> <1096477932.3733.1471.camel@palm.tree.com> Content-Type: multipart/mixed; boundary="=-MHoXvfgwm/AM79gvF4x9" Message-Id: <1096489576.3733.1868.camel@palm.tree.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Wed, 29 Sep 2004 16:26:16 -0400 cc: Julian Elischer cc: "freebsd-arch@freebsd.org" Subject: Re: scheduler (sched_4bsd) questions X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2004 20:26:19 -0000 --=-MHoXvfgwm/AM79gvF4x9 Content-Type: text/plain Content-Transfer-Encoding: 7bit Forgot to attach the patch ... Stephan On Wed, 2004-09-29 at 13:12, Stephan Uphoff wrote: > On Wed, 2004-09-29 at 10:24, Stephan Uphoff wrote: > > On Wed, 2004-09-29 at 04:57, Peter Holm wrote: > > > It's hard for me to tell if your patch has made any difference. > > > The freeze is still there. I'll try to make the same test once more > > > without your patches to see if I get the same pattern in freezes. > > > > I found some problems yesterday with mutex priority inheritance that > > could potentially cause your freeze patterns. > > > > I will try to roll a preliminary patch as soon as the caffeine does its > > magic. > > OK - here is a crude patch to fix some problems with mutex priority > inheritance. My theory is that the clock thread gets stuck waiting on > GIANT. > > During release/acquisition of a contested sleep mutex there are a few > windows where a task can be preempted when actions (waking up blocked > threads, ownership of the mutex, ..) need to be atomic as far as > scheduling is concerned. Otherwise priority inheritance may fail. The > patch uses critical_enter/critical_exit to protect these regions against > preemption. > > It would be great if could run this in addition to the other patches. > > Stephan --=-MHoXvfgwm/AM79gvF4x9 Content-Disposition: attachment; filename=mutex_patch Content-Type: text/x-patch; name=mutex_patch; charset=ASCII Content-Transfer-Encoding: 7bit Index: kern_mutex.c =================================================================== RCS file: /cvsroot/src/sys/kern/kern_mutex.c,v retrieving revision 1.149 diff -u -r1.149 kern_mutex.c --- kern_mutex.c 2 Sep 2004 18:59:15 -0000 1.149 +++ kern_mutex.c 29 Sep 2004 16:50:36 -0000 @@ -492,7 +492,9 @@ if (v == MTX_CONTESTED) { MPASS(ts != NULL); m->mtx_lock = (uintptr_t)td | MTX_CONTESTED; + critical_enter(); turnstile_claim(ts); + critical_exit(); break; } #endif @@ -651,6 +653,9 @@ #else MPASS(ts != NULL); #endif + + critical_enter(); + #ifndef PREEMPTION /* XXX */ td1 = turnstile_head(ts); @@ -671,6 +676,7 @@ } #endif turnstile_unpend(ts); + critical_exit(); #ifndef PREEMPTION /* --=-MHoXvfgwm/AM79gvF4x9--