lkml.org 
[lkml]   [2021]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] LKMM: Add volatile_if()
On Fri, Jun 04, 2021 at 09:17:56PM +0200, Peter Zijlstra wrote:
> On Fri, Jun 04, 2021 at 12:24:07PM -0500, Segher Boessenkool wrote:
> > On Fri, Jun 04, 2021 at 10:10:29AM -0700, Linus Torvalds wrote:
> > > The compiler *cannot* just say "oh, I'll do that 'volatile asm
> > > barrier' whether the condition is true or not". That would be a
> > > fundamental compiler bug.
> >
> > Yes.
>
> So we can all agree on something like this?
>
> #define volatile_if(x) \
> if (({ _Bool __x = (x); BUILD_BUG_ON(__builtin_constant_p(__x)); __x; }) && \
> ({ barrier(); 1; }))

As long as this prevents compilers from causing trouble with things like
conditional-move instructions, I am good. I don't know that this trouble
actually exists, but I never have been able to get official confirmation
one way or the other. :-/

> Do we keep volatile_if() or do we like ctrl_dep_if() better?

I like ctrl_dep_if() because that is what it does, but I don't feel all
that strongly about it.

Thanx, Paul

\
 
 \ /
  Last update: 2021-06-04 22:44    [W:0.186 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site