From owner-freebsd-arch@FreeBSD.ORG Mon Oct 4 17:24:12 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 C7FB916A4CE for ; Mon, 4 Oct 2004 17:24:12 +0000 (GMT) Received: from mail6.speakeasy.net (mail6.speakeasy.net [216.254.0.206]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9CD0543D49 for ; Mon, 4 Oct 2004 17:24:12 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: (qmail 14629 invoked from network); 4 Oct 2004 17:24:12 -0000 Received: from dsl027-160-063.atl1.dsl.speakeasy.net (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) encrypted SMTP for ; 4 Oct 2004 17:24:11 -0000 Received: from [10.50.40.210] (gw1.twc.weather.com [216.133.140.1]) (authenticated bits=0) by server.baldwin.cx (8.12.11/8.12.11) with ESMTP id i94HNxY2057634; Mon, 4 Oct 2004 13:24:08 -0400 (EDT) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: Stephan Uphoff Date: Mon, 4 Oct 2004 13:21:45 -0400 User-Agent: KMail/1.6.2 References: <1096610130.21577.219.camel@palm.tree.com> In-Reply-To: <1096610130.21577.219.camel@palm.tree.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200410041321.45142.jhb@FreeBSD.org> X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on server.baldwin.cx cc: Peter Holm cc: Julian Elischer cc: "freebsd-arch@freebsd.org" Subject: Re: sched_switch (sched_4bsd) may be preempted 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: Mon, 04 Oct 2004 17:24:12 -0000 On Friday 01 October 2004 01:55 am, Stephan Uphoff wrote: > sched_switch (sched_4bsd) may be preempted in setrunqueue or slot_fill. > This could be ugly. > Wrapping it into a critical section and resetting TDP_OWEPREEMPT should > work. > > Hand trimmed patch: > > RCS file: /cvsroot/src/sys/kern/sched_4bsd.c,v > retrieving revision 1.65 > diff -u -r1.65 sched_4bsd.c > --- sys/kern/sched_4bsd.c 16 Sep 2004 07:12:59 -0000 1.65 > +++ sys/kern/sched_4bsd.c 1 Oct 2004 05:35:28 -0000 > @@ -823,6 +823,7 @@ > TD_SET_CAN_RUN(td); > else { > td->td_ksegrp->kg_avail_opennings++; > + critical_enter(); > if (TD_IS_RUNNING(td)) { > /* Put us back on the run queue (kse and all). > */ > setrunqueue(td, SRQ_OURSELF|SRQ_YIELDING); > @@ -834,6 +835,8 @@ > */ > slot_fill(td->td_ksegrp); > } > + critical_exit(); > + td->td_pflags &= ~TDP_OWEPREEMPT; > } > if (newtd == NULL) > newtd = choosethread(); I thought that SRQ_YIELDING turned preempting off already. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org