Messages in this thread | | | Date | Tue, 2 Feb 2016 09:56:14 -0800 | Subject | Re: [RFC][PATCH] mips: Fix arch_spin_unlock() | From | Linus Torvalds <> |
| |
On Tue, Feb 2, 2016 at 4:02 AM, Paul E. McKenney <paulmck@linux.vnet.ibm.com> wrote: > > The sorts of things I am really worried about are abominations like this > (and far worse):
That one doesn't have any causal chain that I can see, so I agree that it's an abomination, but it also doesn't act as an argument.
> r1 == 1 && r2 == 1 && c == 2 && r3 == 0 ???
What do you see as the problem here? The above can happen in a strictly ordered situation: thread2 runs first (c == 2, r3 = 0), then thread3 runs (d = 1, a = 1) then thread0 runs (r1 = 1) and then thread1 starts running but the store to c doesn't complete (now r2 = 1).
So there's no reason for your case to not happen, but the real issue is that there is no causal relationship that your example describes, so it's not even interesting.
Causality breaking is what really screws with peoples minds. The reason transitivity is important (and why smp_read_barrier_depends() is so annoying) is because causal breaks make peoples minds twist in bad ways.
Sadly, memory orderings are very seldom described as honoring causality, and instead people have the crazy litmus tests.
Linus
| |