[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251231-rwonce-v1-4-702a10b85278@google.com>
Date: Wed, 31 Dec 2025 12:22:28 +0000
From: Alice Ryhl <aliceryhl@...gle.com>
To: Boqun Feng <boqun.feng@...il.com>, Will Deacon <will@...nel.org>,
Peter Zijlstra <peterz@...radead.org>
Cc: Richard Henderson <richard.henderson@...aro.org>, Matt Turner <mattst88@...il.com>,
Magnus Lindholm <linmag7@...il.com>, Catalin Marinas <catalin.marinas@....com>,
Miguel Ojeda <ojeda@...nel.org>, Gary Guo <gary@...yguo.net>,
"Björn Roy Baron" <bjorn3_gh@...tonmail.com>, Benno Lossin <lossin@...nel.org>,
Andreas Hindborg <a.hindborg@...nel.org>, Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>, Mark Rutland <mark.rutland@....com>,
FUJITA Tomonori <fujita.tomonori@...il.com>, Frederic Weisbecker <frederic@...nel.org>,
Lyude Paul <lyude@...hat.com>, Thomas Gleixner <tglx@...utronix.de>,
Anna-Maria Behnsen <anna-maria@...utronix.de>, John Stultz <jstultz@...gle.com>,
Stephen Boyd <sboyd@...nel.org>, Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>, linux-kernel@...r.kernel.org,
linux-alpha@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
rust-for-linux@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Alice Ryhl <aliceryhl@...gle.com>
Subject: [PATCH 4/5] rust: hrtimer: use READ_ONCE instead of read_volatile
Using `READ_ONCE` is the correct way to read the `node.expires` field.
Signed-off-by: Alice Ryhl <aliceryhl@...gle.com>
---
rust/kernel/time/hrtimer.rs | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/rust/kernel/time/hrtimer.rs b/rust/kernel/time/hrtimer.rs
index 856d2d929a00892dc8eaec63cebdf547817953d3..e2b7a26f8aade972356c3eb5f6489bcda3e2e849 100644
--- a/rust/kernel/time/hrtimer.rs
+++ b/rust/kernel/time/hrtimer.rs
@@ -239,11 +239,9 @@ pub fn expires(&self) -> HrTimerInstant<T>
// - Timers cannot have negative ktime_t values as their expiration time.
// - There's no actual locking here, a racy read is fine and expected
unsafe {
- Instant::from_ktime(
- // This `read_volatile` is intended to correspond to a READ_ONCE call.
- // FIXME(read_once): Replace with `read_once` when available on the Rust side.
- core::ptr::read_volatile(&raw const ((*c_timer_ptr).node.expires)),
- )
+ Instant::from_ktime(kernel::sync::READ_ONCE(
+ &raw const (*c_timer_ptr).node.expires,
+ ))
}
}
}
--
2.52.0.351.gbe84eed79e-goog
Powered by blists - more mailing lists