On Thu, 9 Aug 2007, Jerry Jiang wrote:
>
> and still not to said "Why the *volatile-accesses-in-code* is
> acceptable"
I don't think volatile is necessarily wonderful in code _either_. So I
think the "atomic_read()" issue would be even better off if we just made
sure everybody behaves well and has the right barriers.
So the difference between "volatile in code" and "volatile on data
structures" is that the latter is *always* wrong (and wrong for very
fundamental reasons).
But "volatile in code" can be perfectly fine. If you hide the volatile in
an accessor function, and just specify that the rules for that function is
that it always loads from memory but doesn't imply any memory barriers,
than that is fine. And I think those kinds of semantics may well be
perfectly sane for "atomic_read()".
So I think a volatile access inside "atomic_read()" at least has
well-defined semantics. Are they the best possible semantics? I dunno. I
can imagine that it's perfectly fine, but on the other hand, it would be
interesting to see any code for which it matters - it's entirely possible
that the code itself is the problem, and should instead have a
"cpu_relax()" or similar that implies a barrier.
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]