Re: [RFC] LKMM: Add volatile_if()

From
Peter Zijlstra <peterz@infradead.org>
Date
2021-06-04 19:18:12
Also in
linux-arch, lkml
Reply to
Segher Boessenkool, 2021-06-04
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:
quoted
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; }))

Do we keep volatile_if() or do we like ctrl_dep_if() better?
Thread (121 messages) 121 messages, 13 authors, last reply 2021-09-24
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help