More on memory barriers
Paul Koning
pkoning@equallogic.com
Wed Sep 15 15:43:00 GMT 2004
>>>>> "Richard" == Richard Henderson <rth@redhat.com> writes:
Richard> We do still need a write_memory_barrier here. For that,
Richard> __sync_synchronize is still the best implementation
Richard> available.
For which processor?
On some processors that have the notion of "sync" (for example, the
SB-1) there are many shared memory scenarios where it is serious
overkill. It would be good to define a primitive specifically for the
required semantics, and map that onto the instructions (if any)
needed.
In this case, you need serialization of memory changes between two
CPUs, in one case from the writer's point of view, in the other from
the reader's point of view. I put it so verbosely because changing
any of those words may change the instruction(s) you need on a
particular target. (SB-1 again as an example: so long as the code
generation doesn't reorder stuff across this primitive, no additional
instructions are needed here, but if the memory sharing was CPU to I/O
device, the answer might change depending on the I/O device.)
paul
More information about the Gcc
mailing list