Memory barriers and spin_unlock safety

David Howells dhowells at redhat.com
Sat Mar 4 03:45:46 EST 2006


David Howells <dhowells at redhat.com> wrote:

> 	WRITE mtx
> 	--> implies SFENCE

Actually, I'm not sure this is true. The AMD64 Instruction Manual's writeup of
SFENCE implies that writes can be reordered, which sort of contradicts what
the AMD64 System Programming Manual says.

If this isn't true, then x86_64 at least should do MFENCE before the store in
spin_unlock() or change the store to be LOCK'ed. The same may also apply for
Pentium3+ class CPUs with the i386 arch.

David



More information about the Linuxppc64-dev mailing list