Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1763653AbXHPUwe (ORCPT ); Thu, 16 Aug 2007 16:52:34 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756593AbXHPUwY (ORCPT ); Thu, 16 Aug 2007 16:52:24 -0400 Received: from gate.crashing.org ([63.228.1.57]:45386 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756370AbXHPUwW (ORCPT ); Thu, 16 Aug 2007 16:52:22 -0400 In-Reply-To: References: <20070809131423.GA9927@shell.boston.redhat.com> <46C2D6F3.3070707@s5r6.in-berlin.de> <20070815233721.91032366.billfink@mindspring.com> Mime-Version: 1.0 (Apple Message framework v623) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <4952d3f536060c186f40c277dfc74194@kernel.crashing.org> Content-Transfer-Encoding: 7bit Cc: Christoph Lameter , heiko.carstens@de.ibm.com, horms@verge.net.au, Stefan Richter , Bill Fink , Linux Kernel Mailing List , "Paul E. McKenney" , netdev@vger.kernel.org, ak@suse.de, 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 , davem@davemloft.net, Linus Torvalds , wensong@linux-vs.org, wjiang@resilience.com From: Segher Boessenkool Subject: Re: [PATCH 0/24] make atomic_read() behave consistently across all architectures Date: Thu, 16 Aug 2007 22:50:38 +0200 To: Satyam Sharma X-Mailer: Apple Mail (2.623) Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1281 Lines: 36 > Note that "volatile" > is a type-qualifier, not a type itself, so a cast of the _object_ > itself > to a qualified-type i.e. (volatile int) would not make the access > itself > volatile-qualified. There is no such thing as "volatile-qualified access" defined anywhere; there only is the concept of a "volatile-qualified *object*". > To serve our purposes, it is necessary for us to take the address of > this > (non-volatile) object, cast the resulting _pointer_ to the > corresponding > volatile-qualified pointer-type, and then dereference it. This makes > that > particular _access_ be volatile-qualified, without the object itself > being > such. Also note that the (dereferenced) result is also a valid lvalue > and > hence can be used in "*(volatile int *)&a = b;" kind of construction > (which we use for the atomic_set case). There is a quite convincing argument that such an access _is_ an access to a volatile object; see GCC PR21568 comment #9. This probably isn't the last word on the matter though... 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/