[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <46C3B50E.7010702@yahoo.com.au>
Date: Thu, 16 Aug 2007 12:23:10 +1000
From: Nick Piggin <nickpiggin@...oo.com.au>
To: Segher Boessenkool <segher@...nel.crashing.org>
CC: Herbert Xu <herbert.xu@...hat.com>, heiko.carstens@...ibm.com,
horms@...ge.net.au, linux-kernel@...r.kernel.org,
rpjday@...dspring.com, ak@...e.de, netdev@...r.kernel.org,
cfriesen@...tel.com, akpm@...ux-foundation.org,
torvalds@...ux-foundation.org, jesper.juhl@...il.com,
linux-arch@...r.kernel.org, zlynx@....org, satyam@...radead.org,
clameter@....com, schwidefsky@...ibm.com,
Chris Snook <csnook@...hat.com>, davem@...emloft.net,
wensong@...ux-vs.org, wjiang@...ilience.com
Subject: Re: [PATCH 0/24] make atomic_read() behave consistently across all
architectures
Segher Boessenkool wrote:
>>> Part of the motivation here is to fix heisenbugs. If I knew where they
>>
>>
>> By the same token we should probably disable optimisations
>> altogether since that too can create heisenbugs.
>
>
> Almost everything is a tradeoff; and so is this. I don't
> believe most people would find disabling all compiler
> optimisations an acceptable price to pay for some peace
> of mind.
So why is this a good tradeoff?
I also think that just adding things to APIs in the hope it might fix
up some bugs isn't really a good road to go down. Where do you stop?
On the actual proposal to make atomic_operators volatile: I think the
better approach in the long term, for both maintainability of the
code and education of coders, is to make the use of barriers _more_
explicit rather than sprinkling these "just in case" ones around.
You may get rid of a few atomic_read heisenbugs (in noise when
compared to all bugs), but if the coder was using a regular atomic
load, or a test_bit (which is also atomic), etc. then they're going
to have problems.
It would be better for Linux if everyone was to have better awareness
of barriers than to hide some of the cases where they're required.
A pretty large number of bugs I see in lock free code in the VM is
due to memory ordering problems. It's hard to find those bugs, or
even be aware when you're writing buggy code if you don't have some
feel for barriers.
--
SUSE Labs, Novell Inc.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists