lkml.org 
[lkml]   [2021]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2021-06-08 17:35    [W:1.284 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site