From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Paul E. McKenney" Subject: Re: [RFC][PATCH 0/5] arch: atomic rework Date: Thu, 20 Feb 2014 01:20:49 -0800 Message-ID: <20140220092049.GA22688@linux.vnet.ibm.com> References: <20140218030002.GA15857@linux.vnet.ibm.com> <1392740258.18779.7732.camel@triegel.csb> <1392752867.18779.8120.camel@triegel.csb> <20140220040102.GM4250@linux.vnet.ibm.com> <20140220083032.GN4250@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from e33.co.us.ibm.com ([32.97.110.151]:43400 "EHLO e33.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751002AbaBTJUz (ORCPT ); Thu, 20 Feb 2014 04:20:55 -0500 Received: from /spool/local by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 20 Feb 2014 02:20:55 -0700 Content-Disposition: inline In-Reply-To: <20140220083032.GN4250@linux.vnet.ibm.com> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Linus Torvalds Cc: Torvald Riegel , Will Deacon , Peter Zijlstra , 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" On Thu, Feb 20, 2014 at 12:30:32AM -0800, Paul E. McKenney wrote: > On Wed, Feb 19, 2014 at 08:43:14PM -0800, Linus Torvalds wrote: [ . . . ] > So, if you make one of two changes to your example, then I will agree > with you. The first change is to have a real data dependency between > the read of "a" and the second read: > > - Initial state: > > a = &c, b = 0; c = 0; > > - Thread 1 ("consumer"): > > if (atomic_read(&a, consume)) And the above should be "if (atomic_read(&a, consume) != &c)". Sigh!!! Thanx, Paul > return *a; > /* not yet initialized */ > return -1; > > - Thread 2 ("initializer"): > > b = some_value_lets_say_42; > /* We are now ready to party */ > atomic_write(&a, &b, release);