It certainly is better than disabling all compiler optimisations!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?
It's easy to be better than something really stupid :)
So i386 and x86-64 don't have volatiles there, and it saves them a
few K of kernel text.
What you need to justify is why it is a good
tradeoff to make them volatile (which btw, is much harder to go
the other way after we let people make those assumptions).
I also think that just adding things to APIs in the hope it might fixI look at it the other way: keeping the "volatile" semantics in
up some bugs isn't really a good road to go down. Where do you stop?
atomic_XXX() (or adding them to it, whatever) helps _prevent_ bugs;
Yeah, but we could add lots of things to help prevent bugs and
would never be included. I would also contend that it helps _hide_
bugs and encourages people to be lazy when thinking about these
things.
Also, you dismiss the fact that we'd actually be *adding* volatile
semantics back to the 2 most widely tested architectures (in terms
of test time, number of testers, variety of configurations, and
coverage of driver code).
This is a very important different from
just keeping volatile semantics because it is basically a one-way
API change.
certainly most people expect that behaviour, and also that behaviour
is *needed* in some places and no other interface provides that
functionality.
I don't know that most people would expect that behaviour.
Is there any documentation anywhere that would suggest this?
[some confusion about barriers wrt atomics snipped]
What were you confused about?