Memory barriers and Linux kernel spinlock on TILE-Gx

Viewed 1202

In the Linux kernel spinlock implementation for the TILE-Gx architecture, it looks like they don't issue any memory barriers when locking (only when unlocking):

https://github.com/torvalds/linux/blob/master/arch/tile/include/asm/spinlock_64.h

Then I don't understand why instructions cannot be reordered above the locking, which would cause instructions believed by the programmer to be executed while holding the lock, to actually execute before the lock is taken?

Other architectures seem to have at least a compiler barrier:

Why is TILE-Gx different? I thought its memory model was as weak as ARM's memory model. And why don't they even have a compiler barrier?

1 Answers
Related