[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210608152851.GX18427@gate.crashing.org>
Date: Tue, 8 Jun 2021 10:28:51 -0500
From: Segher Boessenkool <segher@...nel.crashing.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Marco Elver <elver@...gle.com>,
"Paul E. McKenney" <paulmck@...nel.org>,
Alexander Monakov <amonakov@...ras.ru>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Jakub Jelinek <jakub@...hat.com>,
Alan Stern <stern@...land.harvard.edu>,
Will Deacon <will@...nel.org>,
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 Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-toolchains@...r.kernel.org,
linux-arch <linux-arch@...r.kernel.org>
Subject: Re: [RFC] LKMM: Add volatile_if()
On Tue, Jun 08, 2021 at 01:22:58PM +0200, Peter Zijlstra wrote:
> Works for me; and note how it mirrors how we implemented volatile_if()
> in the first place, by doing an expression wrapper.
>
> __builtin_ctrl_depends(expr) would have to:
>
> - ensure !__builtin_const_p(expr) (A)
Why would it be an error if __builtin_constant_p(expr)? In many
programs the compiler can figure out some expression does never change.
Having a control dependency on sometthing like that is not erroneous.
> - imply an acquire compiler fence (B)
> - ensure cond-branch is emitted (C)
(C) is almost impossible to do. This should be reformulated to talk
about the effect of the generated code, instead.
> *OR*
>
> - ensure !__builtin_const_p(expr); (A)
> - upgrade the load in @expr to load-acquire (D)
So that will only work if there is exactly one read from memory in expr?
That is problematic.
This needs some work.
Segher
Powered by blists - more mailing lists