Re: [RFC] LKMM: Add volatile_if()

From: Segher Boessenkool
Date: Mon Jun 07 2021 - 18:59:03 EST


On Mon, Jun 07, 2021 at 01:31:24PM -0700, Linus Torvalds wrote:
> > Is it useful in general for the kernel to have separate "read" and
> > "write" clobbers in asm expressions? And for other applications?
>
> See above. It's actually not all that uncommon that you have a "this
> doesn't modify memory, but you can't move writes around it". It's
> usually very much about cache handling or memory ordering operations,
> and that bit test example was probably a bad example exactly because
> it made it look like it's about some controlled range.
>
> The "write memory barroer" is likely the best and simplest example,
> but it's in not the only one.

Thanks for the examples! I opened <https://gcc.gnu.org/PR100953> so
that we can easily track it.


Segher