Re: spin_unlock optimization(i386)

Linus Torvalds (torvalds@transmeta.com)
Wed, 24 Nov 1999 21:32:11 -0800 (PST)


On Wed, 24 Nov 1999, Erich Boleyn wrote:
>
> IA32 SMP is Processor Ordered for WB memory (why would you use WT for
> normal RAM anyway?), which essentially means the same thing as strong
> ordering with the following caveat:
>
> Stores from one processor may not all be seen by other processors
> yet, though if any one store is observed by processor A on
> processor B, any earlier stores (in program order) from processor
> A are guaranteed to be observed by processor B.

There is a philosophical question here:

"if a store happens and there is nobody to listen, does it make a sound?"

What I'm alluding to is that the Intel memory ordering essentially says

CPU 1: CPU 2

a = 1
b = 2

read b, see 2: we know that a must be 1.

HOWEVER, we have a slightly different situation here:

CPU 1 CPU 2

read b
a = 0
read a, see 0
write b

Note how both CPU's only did ONE write. That one write does not have any
real "order", and really write ordering is not an issue AT ALL.

In physics, this issue is called "causality" rather than "order", and I
don't think the issue has really been clarified.

Basically, everybody agrees on ordering of writes. Intel keeps them in
order.

What I still find to be the weak point of all the arguments both ways is
that I still have NOT seen any real proof that CPU#1 could not see the
"future" write of "b". In short, without a synchronizing instruction I
don't trust causality - even though I trust order.

(There is no question of "order" in the above, as nothing I have so far
seen defines the ordering of reads vs writes, and THAT is the basic
problem above)

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/