An atomic instruction is a full barrier to everything?
An atomic instruction is a full barrier to everything?
Posted Jun 5, 2024 10:46 UTC (Wed) by farnz (subscriber, #17727)In reply to: An atomic instruction is a full barrier to everything? by epa
Parent article: An instruction-level BPF memory model
There are CPUs that are ultra-strict like that (all x86 CPUs, I believe, meet this requirement); in your example, though, the detail you're missing is that if no other code uses r9 or address 123, there's no way to tell if the swap instruction was executed.
And it's a one-way condition; if the swap instruction was executed, then you know that all instructions before the swap instruction were executed. But if you do not know whether or not the swap instruction was executed, you do not know if the instructions before it are visible or not - and if you neither look at r9, nor inspect address 123, how do you know it executed?