[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wg23CqjGWjjxDQ7yxrb+eF5at2KFU03GZa18Znx=+Xvow@mail.gmail.com>
Date: Wed, 29 Sep 2021 07:47:22 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Cc: Will Deacon <will@...nel.org>,
"Paul E. McKenney" <paulmck@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Segher Boessenkool <segher@...nel.crashing.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Alan Stern <stern@...land.harvard.edu>,
Andrea Parri <parri.andrea@...il.com>,
Boqun Feng <boqun.feng@...il.com>,
Nick Piggin <npiggin@...il.com>,
David Howells <dhowells@...hat.com>,
Jade Alglave <j.alglave@....ac.uk>,
Luc Maranget <luc.maranget@...ia.fr>,
Akira Yokosawa <akiyks@...il.com>,
linux-toolchains@...r.kernel.org,
linux-arch <linux-arch@...r.kernel.org>
Subject: Re: [RFC PATCH] LKMM: Add ctrl_dep() macro for control dependency
On Tue, Sep 28, 2021 at 2:15 PM Mathieu Desnoyers
<mathieu.desnoyers@...icios.com> wrote:
>
> Introduce the ctrl_dep macro in the generic headers, and use it
> everywhere it appears relevant.
The control dependency is so subtle - just see our discussions - that
I really think every single use of it needs to have a comment about
why it's needed.
Right now, that patch seems to just sprinkle them more or less
randomly. That's absolutely not what I want. It will just mean that
other people start sprinkling them randomly even more, and nobody will
dare remove them.
So I'd literally want a comment about "this needs a control
dependency, because otherwise the compiler could merge the two
identical stores X and Y".
When you have a READ_ONCE() in the conditional, and a WRITE_ONCE() in
the statement protected by the conditional, there is *no* need to
randomly sprinkle noise that doesn't matter.
And if there *is* need ("look, we have that same store in both the if-
and the else-statement" or whatever), then say so, and state that
thing.
Linus
Powered by blists - more mailing lists