From owner-svn-src-head@FreeBSD.ORG Mon Oct 29 05:02:31 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4A96A797; Mon, 29 Oct 2012 05:02:31 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.64.117]) by mx1.freebsd.org (Postfix) with ESMTP id B80418FC0A; Mon, 29 Oct 2012 05:02:30 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id q9T52Lk5027223; Mon, 29 Oct 2012 09:02:21 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q9T52LRb027222; Mon, 29 Oct 2012 09:02:21 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Mon, 29 Oct 2012 09:02:21 +0400 From: Gleb Smirnoff To: Attilio Rao Subject: Re: svn commit: r242274 - head/sys/sys Message-ID: <20121029050221.GM70741@FreeBSD.org> References: <201210290135.q9T1ZHUJ047280@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201210290135.q9T1ZHUJ047280@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Oct 2012 05:02:31 -0000 On Mon, Oct 29, 2012 at 01:35:17AM +0000, Attilio Rao wrote: A> Author: attilio A> Date: Mon Oct 29 01:35:17 2012 A> New Revision: 242274 A> URL: http://svn.freebsd.org/changeset/base/242274 A> A> Log: A> Compiler have a precise knowledge of the content of sched_pin() and A> sched_unpin() as they are functions static and inline. This way it A> can do two dangerous things: A> - Reorder instructions around both of them, taking out from the safe A> path operations that are supposed to be (ie. per-cpu accesses) A> - Cache the value of td_pinned in CPU registers not making visible A> in kernel context to the scheduler once it is scanning the runqueue, A> as td_pinned is not marked volatile. A> A> In order to avoid both possible bugs explicitly, protect the safe path A> with compiler memory barriers. This will prevent reordering and caching A> by the compiler about td_pinned operations. A> A> Generally this could lead to suboptimal code traversing the pinnings A> but this is not the case as can be easilly verified: A> http://lists.freebsd.org/pipermail/svn-src-projects/2012-October/005797.html Now __compiler_membar() can be removed from kern_rmlock.c:360 -- Totus tuus, Glebius.