From: Linus Torvalds <torvalds@linux-foundation.org>
To: Jerry Jiang <wjiang@resilience.com>
Cc: 7eggert@gmx.de, Chris Snook <csnook@redhat.com>,
akpm@linux-foundation.org, ak@suse.de, heiko.carstens@de.ibm.com,
davem@davemloft.net, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, schwidefsky@de.ibm.com,
wensong@linux-vs.org, horms@verge.net.au, cfriesen@nortel.com,
zlynx@acm.org
Subject: Re: [PATCH] make atomic_t volatile on all architectures
Date: Thu, 9 Aug 2007 08:00:41 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.0.999.0708090751560.25146@woody.linux-foundation.org> (raw)
In-Reply-To: <20070809171832.1568864b.wjiang@resilience.com>
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
next prev parent reply other threads:[~2007-08-09 15:02 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <8Q2Pg-8uV-23@gated-at.bofh.it>
[not found] ` <8Q7Fa-7rJ-1@gated-at.bofh.it>
[not found] ` <8Q8rD-hh-7@gated-at.bofh.it>
2007-08-09 9:10 ` Bodo Eggert
2007-08-09 9:18 ` Jerry Jiang
2007-08-09 15:00 ` Linus Torvalds [this message]
2007-08-08 23:07 Chris Snook
2007-08-08 23:18 ` Jesper Juhl
2007-08-08 23:31 ` Chris Snook
2007-08-08 23:51 ` Jesper Juhl
2007-08-08 23:25 ` Lennert Buytenhek
2007-08-08 23:35 ` Chris Snook
2007-08-09 1:03 ` Herbert Xu
2007-08-09 1:48 ` David Miller
2007-08-09 3:47 ` Paul E. McKenney
2007-08-09 7:47 ` Chris Snook
2007-08-09 8:30 ` Herbert Xu
2007-08-09 11:44 ` Chris Snook
2007-08-09 4:18 ` Linus Torvalds
2007-08-09 4:59 ` Jerry Jiang
2007-08-09 7:31 ` Chris Snook
2007-08-09 8:14 ` Heiko Carstens
2007-08-09 17:36 ` Chuck Ebbert
2007-08-09 17:55 ` Linus Torvalds
2007-08-09 18:20 ` Martin Schwidefsky
2007-08-12 5:53 ` Segher Boessenkool
2007-08-12 6:09 ` Linus Torvalds
2007-08-12 9:48 ` Martin Schwidefsky
2007-08-12 9:54 ` Linus Torvalds
2007-08-12 16:30 ` Segher Boessenkool
2007-08-12 18:11 ` Linus Torvalds
2007-08-12 19:13 ` Segher Boessenkool
2007-08-12 10:27 ` Segher Boessenkool
2007-08-12 17:59 ` Linus Torvalds
2007-08-12 9:47 ` Martin Schwidefsky
2007-08-12 10:35 ` Segher Boessenkool
2007-08-09 17:57 ` Martin Schwidefsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LFD.0.999.0708090751560.25146@woody.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=7eggert@gmx.de \
--cc=ak@suse.de \
--cc=akpm@linux-foundation.org \
--cc=cfriesen@nortel.com \
--cc=csnook@redhat.com \
--cc=davem@davemloft.net \
--cc=heiko.carstens@de.ibm.com \
--cc=horms@verge.net.au \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=schwidefsky@de.ibm.com \
--cc=wensong@linux-vs.org \
--cc=wjiang@resilience.com \
--cc=zlynx@acm.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®