Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762173AbXHQJbf (ORCPT ); Fri, 17 Aug 2007 05:31:35 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752268AbXHQJbW (ORCPT ); Fri, 17 Aug 2007 05:31:22 -0400 Received: from webmail.icp-qv1-irony2.iinet.net.au ([203.59.1.107]:4839 "EHLO webmail.icp-qv1-irony2.iinet.net.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750991AbXHQJbT (ORCPT ); Fri, 17 Aug 2007 05:31:19 -0400 X-Greylist: delayed 952 seconds by postgrey-1.27 at vger.kernel.org; Fri, 17 Aug 2007 05:31:18 EDT X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CAIQGxUbLrQKa/2dsb2JhbAA X-IronPort-AV: i="4.19,274,1183305600"; d="scan'208"; a="184745831:sNHT8622942" Message-ID: <46C56ADF.8010501@cyberone.com.au> Date: Fri, 17 Aug 2007 19:31:11 +1000 From: Nick Piggin User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20051007 Debian/1.7.12-1 X-Accept-Language: en MIME-Version: 1.0 To: Satyam Sharma CC: Herbert Xu , Paul Mackerras , Linus Torvalds , Christoph Lameter , Chris Snook , Ilpo Jarvinen , "Paul E. McKenney" , Stefan Richter , Linux Kernel Mailing List , linux-arch@vger.kernel.org, Netdev , Andrew Morton , ak@suse.de, heiko.carstens@de.ibm.com, David Miller , schwidefsky@de.ibm.com, wensong@linux-vs.org, horms@verge.net.au, wjiang@resilience.com, cfriesen@nortel.com, zlynx@acm.org, rpjday@mindspring.com, jesper.juhl@gmail.com, segher@kernel.crashing.org Subject: Re: [PATCH 0/24] make atomic_read() behave consistently across all architectures References: <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> <18117.6495.397597.582736@cargo.ozlabs.ibm.com> <20070817035342.GA14744@gondor.apana.org.au> <46C55E90.7010407@yahoo.com.au> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1819 Lines: 48 Satyam Sharma wrote: > > On Fri, 17 Aug 2007, Nick Piggin wrote: > > >>Satyam Sharma wrote: >>[...] >> >>>Granted, the above IS buggy code. But, the stated objective is to avoid >>>heisenbugs. > > ^^^^^^^^^^ > > >>Anyway, why are you making up code snippets that are buggy in other >>ways in order to support this assertion being made that lots of kernel >>code supposedly depends on volatile semantics. Just reference the >>actual code. > > > Because the point is *not* about existing bugs in kernel code. At some > point Chris Snook (who started this thread) did write that "If I knew > of the existing bugs in the kernel, I would be sending patches for them, > not this series" or something to that effect. > > The point is about *author expecations*. If people do expect atomic_read() > (or a variant thereof) to have volatile semantics, why not give them such > a variant? Because they should be thinking about them in terms of barriers, over which the compiler / CPU is not to reorder accesses or cache memory operations, rather than "special" "volatile" accesses. Linux's whole memory ordering and locking model is completely geared around the former. > And by the way, the point is *also* about the fact that cpu_relax(), as > of today, implies a full memory clobber, which is not what a lot of such > loops want. (due to stuff mentioned elsewhere, summarized in that summary) That's not the point, because as I also mentioned, the logical extention to Linux's barrier API to handle this is the order(x) macro. Again, not special volatile accessors. - 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/