Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756674AbXHQLJS (ORCPT ); Fri, 17 Aug 2007 07:09:18 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1760179AbXHQLIf (ORCPT ); Fri, 17 Aug 2007 07:08:35 -0400 Received: from hp3.statik.tu-cottbus.de ([141.43.120.68]:45182 "EHLO hp3.statik.tu-cottbus.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758915AbXHQLI2 (ORCPT ); Fri, 17 Aug 2007 07:08:28 -0400 Message-ID: <46C581AA.7020807@s5r6.in-berlin.de> Date: Fri, 17 Aug 2007 13:08:26 +0200 From: Stefan Richter User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.1.6) Gecko/20070802 SeaMonkey/1.1.4 MIME-Version: 1.0 To: Nick Piggin CC: Satyam Sharma , Herbert Xu , Paul Mackerras , Linus Torvalds , Christoph Lameter , Chris Snook , Ilpo Jarvinen , "Paul E. McKenney" , 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: <46C55E90.7010407@yahoo.com.au> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1961 Lines: 44 Nick Piggin wrote: > Satyam Sharma wrote: >> And we have driver / subsystem maintainers such as Stefan >> coming up and admitting that often a lot of code that's written to use >> atomic_read() does assume the read will not be elided by the compiler. > > So these are broken on i386 and x86-64? The ieee1394 and firewire subsystems have open, undiagnosed bugs, also on i386 and x86-64. But whether there is any bug because of wrong assumptions about atomic_read among them, I don't know. I don't know which assumptions the authors made, I only know that I wasn't aware of all the properties of atomic_read until now. > Are they definitely safe on SMP and weakly ordered machines with > just a simple compiler barrier there? Because I would not be > surprised if there are a lot of developers who don't really know > what to assume when it comes to memory ordering issues. > > This is not a dig at driver writers: we still have memory ordering > problems in the VM too (and probably most of the subtle bugs in > lockless VM code are memory ordering ones). Let's not make up a > false sense of security and hope that sprinkling volatile around > will allow people to write bug-free lockless code. If a writer > can't be bothered reading API documentation ...or, if there is none, the implementation specification (as in case of the atomic ops), or, if there is none, the implementation (as in case of a some infrastructure code here and there)... > and learning the Linux memory model, they can still be productive > writing safely locked code. Provided they are aware that they might not have the full picture of the lockless primitives. :-) -- Stefan Richter -=====-=-=== =--- =---= http://arcgraph.de/sr/ - 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/