On Wed, Sep 29, 2021 at 12:27 PM Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx> wrote: > > If we go for only using ctrl_dep() for scenarios which require it for > documented reasons, then we would need to leave in place all the > caveats details in Documentation/memory-barriers.txt, and document > that in those scenarios ctrl_dep() should be used. This would be a > starting point I guess. So to me, it's really that starting point that I feel needs to truly explain the whole concept. I'm ok with people adding more cases later (but would still want to see a comment about exactly why that ctrl_dep() is needed), but the initial commit is the one that I want to hold up to much higher standards. Those higher standards being: "there's an actual bug here" along with documenting what exactly is going on in that particular case. Because I do *not* want to introduce this as "ctrl_dep() documents the control dependency". If it's _only_ documentation, then a pure comment will do. So to me, the only reason to actually have a ctrl_dep() macro is that we have an actual and existing real true bug. If the only reason for ctrl_dep() is made-up code that doesn't actually exist, ie if (READ_ONCE(x)) WRITE_ONCE(y,1); else WRITE_ONCE(y,1); and the "READ_ONCE()" and "WRITE_ONCE()" being ordered in the face of made-up examples like this, then ctrl_dep() shouldn't exist. (The alternative being some "if the compiler can statically know the direction of the 'if()'" which is I think _equally_ made up, since the whole point of a control dependency is that it's dynamic, and no compiler can ever statiaclly determine the direction). See? This is why I want to have a real actual live example for that first commit. If we then in *other* cases add a "ctrl_dep()" for documentation reasons, and because somebody is unsure about what the "if/else" sides can contain and wants to make sure they cannot be merged, that's a separate thing. But if we can't find a single case where this truly matters and the particular actual present bug can be shown, then it really makes me go "is this just all theoretical for purely made up examples that aren't realistic"? I mean - just look at the above example of "could be done without the 'if()', and then re-ordered by the hardware". It really isn't very realistic. Linus