From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp104.mail.mud.yahoo.com ([209.191.85.214]:33904 "HELO smtp104.mail.mud.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751945AbXHQH00 (ORCPT ); Fri, 17 Aug 2007 03:26:26 -0400 Message-ID: <46C54D94.5080803@yahoo.com.au> Date: Fri, 17 Aug 2007 17:26:12 +1000 From: Nick Piggin MIME-Version: 1.0 Subject: Re: [PATCH 0/24] make atomic_read() behave consistently across all architectures References: <46C32618.2080108@redhat.com> <20070815234021.GA28775@gondor.apana.org.au> <3694fb2e4ed1e4d9bf873c0d050c911e@kernel.crashing.org> <46C3B50E.7010702@yahoo.com.au> <194369f4c96ea0e24decf8f9197d5bad@kernel.crashing.org> <46C505B2.6030704@yahoo.com.au> <18117.4848.695269.72976@cargo.ozlabs.ibm.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-arch-owner@vger.kernel.org To: Satyam Sharma Cc: Linus Torvalds , Paul Mackerras , Segher Boessenkool , heiko.carstens@de.ibm.com, horms@verge.net.au, Linux Kernel Mailing List , rpjday@mindspring.com, ak@suse.de, netdev@vger.kernel.org, cfriesen@nortel.com, Andrew Morton , jesper.juhl@gmail.com, linux-arch@vger.kernel.org, zlynx@acm.org, clameter@sgi.com, schwidefsky@de.ibm.com, Chris Snook , Herbert Xu , davem@davemloft.net, wensong@linux-vs.org, wjiang@resilience.com List-ID: Satyam Sharma wrote: > #define atomic_read_volatile(v) \ > ({ \ > forget((v)->counter); \ > ((v)->counter); \ > }) > > where: *vomit* :) Not only do I hate the keyword volatile, but the barrier is only a one-sided affair so its probable this is going to have slightly different allowed reorderings than a real volatile access. Also, why would you want to make these insane accessors for atomic_t types? Just make sure everybody knows the basics of barriers, and they can apply that knowledge to atomic_t and all other lockless memory accesses as well. > #define forget(a) __asm__ __volatile__ ("" :"=m" (a) :"m" (a)) I like order(x) better, but it's not the most perfect name either. -- SUSE Labs, Novell Inc.