[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=whsAoXTR+7=SxHykUs3zYzjSkY8Up2MDpjJF_PK8yVYQg@mail.gmail.com>
Date: Wed, 26 Feb 2025 16:04:19 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Martin Uecker <uecker@...raz.at>, Ralf Jung <post@...fj.de>,
"Paul E. McKenney" <paulmck@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>,
Ventura Jack <venturajack85@...il.com>, Kent Overstreet <kent.overstreet@...ux.dev>,
Gary Guo <gary@...yguo.net>, airlied@...il.com, boqun.feng@...il.com,
david.laight.linux@...il.com, ej@...i.de, gregkh@...uxfoundation.org,
hch@...radead.org, hpa@...or.com, ksummit@...ts.linux.dev,
linux-kernel@...r.kernel.org, miguel.ojeda.sandonis@...il.com,
rust-for-linux@...r.kernel.org
Subject: Re: C aggregate passing (Rust kernel policy)
On Wed, 26 Feb 2025 at 15:27, Steven Rostedt <rostedt@...dmis.org> wrote:
>
> My point is that the compiler is free to turn that into:
>
> r = READ_ONCE(global);
> if (r > 1000)
> goto out;
> x = r;
>
> and not change the expected result.
Yes.
It is safe to *combine* reads - it's what the CPU will effectively do
anyway (modulo MMIO, which as mentioned is why volatile is so special
and so different).
It's just not safe to split them.
Linus
Powered by blists - more mailing lists