From owner-svn-src-all@FreeBSD.ORG Mon Jan 25 19:56:46 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA62E10656C5; Mon, 25 Jan 2010 19:56:46 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 8B8F88FC0C; Mon, 25 Jan 2010 19:56:46 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 3B8C346B89; Mon, 25 Jan 2010 14:56:46 -0500 (EST) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 72E748A026; Mon, 25 Jan 2010 14:56:45 -0500 (EST) From: John Baldwin To: Attilio Rao Date: Mon, 25 Jan 2010 14:56:32 -0500 User-Agent: KMail/1.12.1 (FreeBSD/7.2-CBSD-20100120; KDE/4.3.1; amd64; ; ) References: <201001231554.o0NFsMbx049837@svn.freebsd.org> In-Reply-To: <201001231554.o0NFsMbx049837@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201001251456.32459.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 25 Jan 2010 14:56:45 -0500 (EST) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r202889 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jan 2010 19:56:46 -0000 On Saturday 23 January 2010 10:54:22 am Attilio Rao wrote: > Author: attilio > Date: Sat Jan 23 15:54:21 2010 > New Revision: 202889 > URL: http://svn.freebsd.org/changeset/base/202889 > > Log: > - Fix a race in sched_switch() of sched_4bsd. > In the case of the thread being on a sleepqueue or a turnstile, the > sched_lock was acquired (without the aid of the td_lock interface) and > the td_lock was dropped. This was going to break locking rules on other > threads willing to access to the thread (via the td_lock interface) and > modify his flags (allowed as long as the container lock was different > by the one used in sched_switch). > In order to prevent this situation, while sched_lock is acquired there > the td_lock gets blocked. [0] > - Merge the ULE's internal function thread_block_switch() into the global > thread_lock_block() and make the former semantic as the default for > thread_lock_block(). This means that thread_lock_block() will not > disable interrupts when called (and consequently thread_unlock_block() > will not re-enabled them when called). This should be done manually > when necessary. > Note, however, that ULE's thread_unblock_switch() is not reaped > because it does reflect a difference in semantic due in ULE (the > td_lock may not be necessarilly still blocked_lock when calling this). > While asymmetric, it does describe a remarkable difference in semantic > that is good to keep in mind. Does this affect the various #ifdef's for handling the third argument to cpu_switch()? E.g. does 4BSD need to spin if td_lock is &blocked_lock? Also, BLOCK_SPIN() on x86 is non-optimal. It should not do cmpxchg in a loop. Instead, it should do cmp in a loop, and if the cmp succeeds, then try cmpxchg. -- John Baldwin