Port-amd64 archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
membar_producer
Why does membar_producer need to issue a store at all?
According to my reading of the AMD64 Architecture Programmer's Manual,
Volume 1, Sec. 3.9.1 `Accessing Memory', p. 94, stores are issued to
main memory and become visible to on all CPUs in program order -- no
out-of-order stores, no speculative stores. Loads may be reordered,
but stores may not be.
There are two exceptions: write-combining regions of memory and
non-temporal stores (MOVNTI &c.). But I don't think membar_producer
is intended to cover these architecture-specific exceptional cases:
ordinary MI code does not encounter them, and since membar_producer
_doesn't_ currently use SFENCE on x86 anyway, it obviously doesn't
order non-temporal stores or stores to write-combining regions as is.
So it's not clear to me why issuing a store is necessary. Back before
we had membar_producer, the old definition of mb_write didn't issue a
store (although it did issue a NOP), in rev. 1.11 of i386/lock_stubs.S
and rev. 1.10 of amd64/lock_stubs.S.
Can we just compile away membar_producer on x86 altogether like we do
with membar_datadep_consumer? (Obviously the symbol will have to
remain but it can just do RET and nothing else.)
Home |
Main Index |
Thread Index |
Old Index