Re: [PATCH 0/24] make atomic_read() behave consistently across all architectures
From: Segher Boessenkool <hidden>
Date: 2007-08-16 19:38:32
Also in:
linux-arch, lkml
From: Segher Boessenkool <hidden>
Date: 2007-08-16 19:38:32
Also in:
linux-arch, lkml
quoted
quoted
quoted
Part of the motivation here is to fix heisenbugs. If I knew where theyBy 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?
It certainly is better than disabling all compiler optimisations!
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?
I look at it the other way: keeping the "volatile" semantics in atomic_XXX() (or adding them to it, whatever) helps _prevent_ bugs; certainly most people expect that behaviour, and also that behaviour is *needed* in some places and no other interface provides that functionality. [some confusion about barriers wrt atomics snipped] Segher