tools/memory-model: Add extra ordering for locks and remove it for ordinary release/acquire
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 11 lines · David Laight
Quoted 11 lines
From: Alan Stern
Sent: 10 July 2018 19:18
More than one kernel developer has expressed the opinion that the LKMM should enforce ordering of writes by locking. In other words, given the following code:
WRITE_ONCE(x, 1);spin_unlock(&s):spin_lock(&s);WRITE_ONCE(y, 1);
Quoted 7 lines
Quoted 3 lines
the stores to x and y should be propagated in order to all other CPUs, even though those other CPUs might not access the lock s. In terms of the memory model, this means expanding the cumul-fence relation.
The usual 'elephant in the room' is Alpha.
I don't claim to understand the alpha memory model but it wouldn't surprise me if the above is impossible to implement on alpha.
It's not impossible, since Alpha does have a full memory barrier instruction (and the implementation uses it).
Alan