Re: [RFC PATCH] tools/memory-model: Remove (dep ; rfi) from ppo
From: Alan Stern
Date: Wed Feb 20 2019 - 10:30:34 EST
On Wed, 20 Feb 2019, Will Deacon wrote:
> Whilst I completely agree that relying on the ordering provided by "dep ;
> rfi" is subtle and error prone, having it forbid the outcome above appeals
> to a hardware-based mindset of how memory ordering works. In the kernel
> community, I would posit that the majority of developers are writing code
> with the underlying hardware in mind and so allowing behaviours in the
> memory model which are counter to how a real machine operates is likely to
> make things more confusing, rather than simplifying them!
>
> IIRC, herd has a feature where you can "flag" the result of a litmus test
> to highlight certain internal constraint violations (e.g. warning that a
> data race is present in a concurrent C11 program). How about we preserve
> the existing semantics, but flag any use of "dep; rfi" to indicate that
> the ordering guarantees being relied upon are subtle and error-prone, and
> therefore should only be considered for fast-path code?
Unfortunately, herd can't really tell whether a particular ordering is
being _used_; it can only tell when the ordering is present. Therefore
such a flag would be prone to false positives.
Alan