Re: [RFC] LKMM: Add volatile_if()

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
2021-06-06 19:23:27
Also in
linux-toolchains, lkml
Reply to
Jakub Jelinek, 2021-06-06
On Sun, Jun 6, 2021 at 11:59 AM Jakub Jelinek [off-list ref] wrote:
I think just
#define barrier() __asm__ __volatile__("" : : "i" (__COUNTER__) : "memory")
should be enough
Oh, I like that. Much better.

It avoids all the issues with comments etc, and because it's not using
__COUNTER__ as a string, it doesn't need the preprocessor games with
double expansion either.

So yeah, that seems like a nice solution to the issue, and should make
the barriers all unique to the compiler.

             Linus
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