From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31951 invoked by alias); 17 Feb 2014 18:18:23 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 31939 invoked by uid 89); 17 Feb 2014 18:18:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e38.co.us.ibm.com Received: from e38.co.us.ibm.com (HELO e38.co.us.ibm.com) (32.97.110.159) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 17 Feb 2014 18:18:21 +0000 Received: from /spool/local by e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 17 Feb 2014 11:18:20 -0700 Received: from d03dlp01.boulder.ibm.com (9.17.202.177) by e38.co.us.ibm.com (192.168.1.138) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 17 Feb 2014 11:18:17 -0700 Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id 7CAFC1FF0043 for ; Mon, 17 Feb 2014 11:18:16 -0700 (MST) Received: from d03av06.boulder.ibm.com (d03av06.boulder.ibm.com [9.17.195.245]) by b03cxnp08026.gho.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s1HIHr5a10092952 for ; Mon, 17 Feb 2014 19:17:53 +0100 Received: from d03av06.boulder.ibm.com (loopback [127.0.0.1]) by d03av06.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id s1HILeJ2005798 for ; Mon, 17 Feb 2014 11:21:40 -0700 Received: from paulmck-ThinkPad-W500 ([9.70.82.174]) by d03av06.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id s1HILeFV005788; Mon, 17 Feb 2014 11:21:40 -0700 Received: by paulmck-ThinkPad-W500 (Postfix, from userid 1000) id 6A35F387808; Mon, 17 Feb 2014 10:18:15 -0800 (PST) Date: Mon, 17 Feb 2014 18:18:00 -0000 From: "Paul E. McKenney" To: Peter Zijlstra Cc: Torvald Riegel , Linus Torvalds , Will Deacon , Ramana Radhakrishnan , David Howells , "linux-arch@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "akpm@linux-foundation.org" , "mingo@kernel.org" , "gcc@gcc.gnu.org" Subject: Re: [RFC][PATCH 0/5] arch: atomic rework Message-ID: <20140217181815.GA1934@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com References: <20140207165028.GO4250@linux.vnet.ibm.com> <20140207165548.GR5976@mudshark.cambridge.arm.com> <20140207180216.GP4250@linux.vnet.ibm.com> <1391992071.18779.99.camel@triegel.csb> <20140211155941.GU4250@linux.vnet.ibm.com> <1392185194.18779.2239.camel@triegel.csb> <20140212091907.GA3545@laptop.programming.kicks-ass.net> <20140212174209.GA4250@linux.vnet.ibm.com> <20140212181205.GD27965@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140212181205.GD27965@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14021718-1344-0000-0000-000005D2C359 X-SW-Source: 2014-02/txt/msg00259.txt.bz2 On Wed, Feb 12, 2014 at 07:12:05PM +0100, Peter Zijlstra wrote: > On Wed, Feb 12, 2014 at 09:42:09AM -0800, Paul E. McKenney wrote: > > You need volatile semantics to force the compiler to ignore any proofs > > it might otherwise attempt to construct. Hence all the ACCESS_ONCE() > > calls in my email to Torvald. (Hopefully I translated your example > > reasonably.) > > My brain gave out for today; but it did appear to have the right > structure. I can relate. ;-) > I would prefer it C11 would not require the volatile casts. It should > simply _never_ speculate with atomic writes, volatile or not. I agree with not needing volatiles to prevent speculated writes. However, they will sometimes be needed to prevent excessive load/store combining. The compiler doesn't have the runtime feedback mechanisms that the hardware has, and thus will need help from the developer from time to time. Or maybe the Linux kernel simply waits to transition to C11 relaxed atomics until the compiler has learned to be sufficiently conservative in its load-store combining decisions. Thanx, Paul