Port-amd64 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Why does membar_consumer() do anything on x86_64?

On Mon, Jul 12, 2010 at 09:14:10AM -0700, Dennis Ferguson wrote:
> That's out of date, both Intel and AMD clarified this and changed their
> manuals in 2007.  Here's what "Intel 64 and IA-32 Architectures Software
> Developer's Manual" volume 3A (order number 253668) now says:
>   Neither Loads Nor Stores Are Reordered with Like Operations
>     The Intel-64 memory-ordering model allows neither loads nor stores to be
>     reordered with the same kind of operation. That is, it ensures that loads
>     are seen in program order and that stores are seen in program order.

Actually, that's not what I observed while working on Xen rings.
loads *can* be reordered (because of speculative loads). I noticed this
on various, post-ppro CPUs.

Also, this doesn't match the amd64 manual I have (revision 3.13, july 2007):
in volume 2 ("system programming"), 7.1 ("single-processor memory access
ordering"), 7.1.1 ("read ordering"):
- out of order reads are allowed ...
- speculative reads are allowed ...
- reads can be reordered ahead of writes
- a read cannot be reordered ahead of a prior write if the read is from
  the same location as the prior write

7.2 "multiprocessor memory access ordering" says more or less the same
thing ("loads may pass store"). The first point ("all load, store and I/O
operations from a single processor appear in program order") is confusing,
but it means nothing more but "the code running on a CPU sees its own
data in order". When accessing shared memory, access may appear reordered to
another CPU (this is coherent with what is said in 7.1.1) as shown in
examples following in 7.2

Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference

Home | Main Index | Thread Index | Old Index