Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760185AbXHQWM1 (ORCPT ); Fri, 17 Aug 2007 18:12:27 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752932AbXHQWMP (ORCPT ); Fri, 17 Aug 2007 18:12:15 -0400 Received: from gate.crashing.org ([63.228.1.57]:47882 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751479AbXHQWMN (ORCPT ); Fri, 17 Aug 2007 18:12:13 -0400 In-Reply-To: References: <20070816003948.GY9645@linux.vnet.ibm.com> <18115.44462.622801.683446@cargo.ozlabs.ibm.com> <20070816020042.GA30650@gondor.apana.org.au> <18115.45316.702491.681906@cargo.ozlabs.ibm.com> <18115.52863.638655.658466@cargo.ozlabs.ibm.com> <20070816053945.GB32442@gondor.apana.org.au> <18115.62741.807704.969977@cargo.ozlabs.ibm.com> <20070816070907.GA964@gondor.apana.org.au> <46C4ABA5.9010804@redhat.com> <18117.1287.779351.836552@cargo.ozlabs.ibm.com> Mime-Version: 1.0 (Apple Message framework v623) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <784250b50ba166650cbbb4de29b5559b@kernel.crashing.org> Content-Transfer-Encoding: 7bit Cc: Christoph Lameter , Paul Mackerras , heiko.carstens@de.ibm.com, horms@verge.net.au, Stefan Richter , Satyam Sharma , Ilpo J?rvinen , Linux Kernel Mailing List , David Miller , "Paul E. McKenney" , ak@suse.de, Netdev , cfriesen@nortel.com, rpjday@mindspring.com, jesper.juhl@gmail.com, linux-arch@vger.kernel.org, Andrew Morton , zlynx@acm.org, schwidefsky@de.ibm.com, Chris Snook , Herbert Xu , wensong@linux-vs.org, wjiang@resilience.com From: Segher Boessenkool Subject: Re: [PATCH 0/24] make atomic_read() behave consistently across all architectures Date: Sat, 18 Aug 2007 00:09:45 +0200 To: Linus Torvalds X-Mailer: Apple Mail (2.623) Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1321 Lines: 32 > Of course, since *normal* accesses aren't necessarily limited wrt > re-ordering, the question then becomes one of "with regard to *what* > does > it limit re-ordering?". > > A C compiler that re-orders two different volatile accesses that have a > sequence point in between them is pretty clearly a buggy compiler. So > at a > minimum, it limits re-ordering wrt other volatiles (assuming sequence > points exists). It also means that the compiler cannot move it > speculatively across conditionals, but other than that it's starting to > get fuzzy. This is actually really well-defined in C, not fuzzy at all. "Volatile accesses" are a side effect, and no side effects can be reordered with respect to sequence points. The side effects that matter in the kernel environment are: 1) accessing a volatile object; 2) modifying an object; 3) volatile asm(); 4) calling a function that does any of these. We certainly should avoid volatile whenever possible, but "because it's fuzzy wrt reordering" is not a reason -- all alternatives have exactly the same issues. Segher - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/