From: Keith Owens <kaos@ocs.com.au>
To: Jesse Barnes <jbarnes@sgi.com>
Cc: David Mosberger <davidm@hpl.hp.com>, Dan Maas <dmaas@dcine.com>,
linux-kernel@vger.kernel.org,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Ben Collins <bcollins@debian.org>
Subject: Re: readl/writel and memory barriers
Date: Wed, 20 Feb 2002 09:05:37 +1100 [thread overview]
Message-ID: <13997.1014156337@ocs3.intra.ocs.com.au> (raw)
In-Reply-To: Your message of "Tue, 19 Feb 2002 10:35:06 -0800." <20020219103506.A1511175@sgi.com>
On Tue, 19 Feb 2002 10:35:06 -0800,
Jesse Barnes <jbarnes@sgi.com> wrote:
>Making a variable volatile doesn't guarantee that the compiler won't
>reorder references to it, AFAIK. And on some platforms, even uncached
>I/O references aren't necessarily ordered.
Ignoring the issue of hardware that reorders I/O, volatile accesses
must not be reordered by the compiler. From a C9X draft (1999, anybody
have the current C standard online?) :-
5.1.2.3 [#2]
Accessing a volatile object, modifying an object, modifying a file,
or calling a function that does any of those operations are all side
effects which are changes in the state of the execution environment.
Evaluation of an expression may produce side effects. At certain
specified points in the execution sequence called sequence points,
all side effects of previous evaluations shall be complete and no
side effects of subsequent evaluations shall have taken place.
5.1.2.3 [#6]
The least requirements on a conforming implementation are:
-- At sequence points, volatile objects are stable in the sense
that previous accesses are complete and subsequent accesses have
not yet occurred.
The compiler may not reorder volatile accesses across sequence points.
volatile int *a, *b;
int c;
c = *a + *b; // no sequence point, access order to a, b is undefined
c = *a; // compiler must not convert to the above format, it
c += *b; // must access a then b
next prev parent reply other threads:[~2002-02-19 22:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-02-19 1:45 Dan Maas
2002-02-19 9:31 ` Alan Cox
2002-02-19 17:10 ` David Mosberger
2002-02-19 18:35 ` Jesse Barnes
2002-02-19 20:11 ` Dan Maas
2002-02-19 20:23 ` Jesse Barnes
2002-02-19 22:05 ` Keith Owens [this message]
2002-02-19 22:17 ` Jesse Barnes
2002-02-21 0:29 ` Randy.Dunlap
2002-02-23 4:48 ` Daniel Phillips
2002-02-25 16:19 ` Randy.Dunlap
2002-02-19 19:33 ` David Mosberger
2002-02-19 19:42 ` Jesse Barnes
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=13997.1014156337@ocs3.intra.ocs.com.au \
--to=kaos@ocs.com.au \
--cc=bcollins@debian.org \
--cc=benh@kernel.crashing.org \
--cc=davidm@hpl.hp.com \
--cc=dmaas@dcine.com \
--cc=jbarnes@sgi.com \
--cc=linux-kernel@vger.kernel.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®