Re: [PATCH 0/5] Add READ_ONCE and WRITE_ONCE to Rust
From: Peter Zijlstra
Date: Tue Jan 06 2026 - 09:56:32 EST
On Tue, Jan 06, 2026 at 09:09:37PM +0800, Boqun Feng wrote:
> Some C code believes a plain write to a properly aligned location is
> atomic (see KCSAN_ASSUME_PLAIN_WRITES_ATOMIC, and no, this doesn't mean
> it's recommended to assume such), and I guess that's the case for
> hrtimer, if it's not much a trouble you can replace the plain write with
> WRITE_ONCE() on C side ;-)
GCC used to provide this guarantee, some of the older code was written
on that. GCC no longer provides that guarantee (there are known cases
where it breaks and all that) and newer code should not rely on this.
All such places *SHOULD* be updated to use READ_ONCE/WRITE_ONCE.