By: Wilco (Wilco.Dijkstra.delete@this.ntlworld.com), July 15, 2015 2:43 pm
Room: Moderated Discussions
Linus Torvalds (torvalds.delete@this.linux-foundation.org) on July 15, 2015 2:17 pm wrote:
> anon (anon.delete@this.anon.com) on July 14, 2015 9:37 pm wrote:
> >
> > At it's most general, looking at system-wide state, this is untrue. Forwarding from the store
> > queue means that a write can be seen (from one CPU) and then not be seen (from another).
>
> Hmm. Yes and no.
>
> To some independent observer looking from the outside, what you say is obviously
> true: the CPU that does a write can do a read and see the value of that write,
> while another CPU that does a read slightly later still sees the old value.
>
> But that's not that different from relativity, where "before" and "after" sometimes don't have meaning.
> Two independent observers may not agree on what happened before, and what happened after.
>
> But what does have meaning is causality. In physics, everybody still agrees about the order of two
> causally related events, even if they might not agree on the order of two non-causally related (independent)
> events. So within the "light cone" of the events, ordering matters and is well-defined.
>
> And as in physics, so in x86 memory ordering. "before" and "after" are kind of ambiguous
> things for two events that don't have anything in common. But causality is not.
>
> And the x86 memory ordering is explicitly causal. I'm pretty sure it's one
> of the documented litmus tests, although I didn't look that up again.
So is this reordering causal according to you? I bet most people don't find it intuitive either as this kind of reordering is exactly what is expected on weak memory models.
Wilco
> anon (anon.delete@this.anon.com) on July 14, 2015 9:37 pm wrote:
> >
> > At it's most general, looking at system-wide state, this is untrue. Forwarding from the store
> > queue means that a write can be seen (from one CPU) and then not be seen (from another).
>
> Hmm. Yes and no.
>
> To some independent observer looking from the outside, what you say is obviously
> true: the CPU that does a write can do a read and see the value of that write,
> while another CPU that does a read slightly later still sees the old value.
>
> But that's not that different from relativity, where "before" and "after" sometimes don't have meaning.
> Two independent observers may not agree on what happened before, and what happened after.
>
> But what does have meaning is causality. In physics, everybody still agrees about the order of two
> causally related events, even if they might not agree on the order of two non-causally related (independent)
> events. So within the "light cone" of the events, ordering matters and is well-defined.
>
> And as in physics, so in x86 memory ordering. "before" and "after" are kind of ambiguous
> things for two events that don't have anything in common. But causality is not.
>
> And the x86 memory ordering is explicitly causal. I'm pretty sure it's one
> of the documented litmus tests, although I didn't look that up again.
So is this reordering causal according to you? I bet most people don't find it intuitive either as this kind of reordering is exactly what is expected on weak memory models.
Wilco