On Wed, 14 Jul 2004, Jeff Garzik wrote:
quoted
The weaker ordering constraint is called "read_barrier_depends()", and
should be a no-op on all but alpha. Would you want to use that to fix the
alpha case too?
What would the proper fix be?
rmb();
read_barrier_depends();
No, just a
index = *indexpointer;
read_barrier_depends();
data = dataptr[index];
which on most architectures is a no-op, but in case the hardware might do
data or address speculation, and needs a dependent load barrier, it will
do the right thing.
For stuff that isn't data dependent, you have to use the full rmb(), which
obviously isn't a no-op on most setups.
Linus