Thread (121 messages) 121 messages, 13 authors, 2021-09-24

Re: [RFC] LKMM: Add volatile_if()

From: Segher Boessenkool <hidden>
Date: 2021-06-08 15:34:34
Also in: linux-arch, lkml

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help