Re: C aggregate passing (Rust kernel policy)
From: Steven Rostedt
Date: Wed Feb 26 2025 - 16:55:52 EST
On Wed, 26 Feb 2025 13:42:29 -0800
Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Wed, 26 Feb 2025 at 13:26, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> >
> > As a bystander here, I just want to ask, do you mean basically to treat all
> > reads as READ_ONCE() and all writes as WRITE_ONCE()?
>
> Absolutely not.
>
> I thought I made that clear:
Sorry, I didn't make myself clear. I shouldn't have said "all reads". What
I meant was the the "initial read".
Basically:
r = READ_ONCE(*p);
and use what 'r' is from then on.
Where the compiler reads the source once and works with what it got.
To keep it from changing:
r = *p;
if (r > 1000)
goto out;
x = r;
to:
if (*p > 1000)
goto out;
x = *p;
-- Steve