[PATCH] Document Linux's memory barriers [try #2]

Ivan Kokshaysky ink at jurassic.park.msu.ru
Thu Mar 9 10:08:51 EST 2006


On Thu, Mar 09, 2006 at 09:10:49AM +1100, Paul Mackerras wrote:
> David Howells writes:
> 
> > > # define smp_read_barrier_depends()     do { } while(0)
> > 
> > What's this one meant to do?
> 
> On most CPUs, if you load one value and use the value you get to
> compute the address for a second load, there is an implicit read
> barrier between the two loads because of the dependency.  That's not
> true on alpha, apparently, because of the way their caches are
> structured.

Who said?! ;-)

> The smp_read_barrier_depends is a read barrier that you
> use between two loads when there is already a dependency between the
> loads, and it is a no-op on everything except alpha (IIRC).

My "Compiler Writer's Guide for the Alpha 21264" says that if the
result of the first load contributes to the address calculation
of the second load, then the second load cannot issue until the data
from the first load is available.

Obviously, we don't care about earlier alphas as they are executing
strictly in program order.

Ivan.



More information about the Linuxppc64-dev mailing list