public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] Add READ_ONCE and WRITE_ONCE to Rust
@ 2025-12-31 12:22 Alice Ryhl
  2025-12-31 12:22 ` [PATCH 1/5] arch: add CONFIG_ARCH_USE_CUSTOM_READ_ONCE for arm64/alpha Alice Ryhl
                   ` (5 more replies)
  0 siblings, 6 replies; 45+ messages in thread
From: Alice Ryhl @ 2025-12-31 12:22 UTC (permalink / raw)
  To: Boqun Feng, Will Deacon, Peter Zijlstra
  Cc: Richard Henderson, Matt Turner, Magnus Lindholm, Catalin Marinas,
	Miguel Ojeda, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Danilo Krummrich, Mark Rutland,
	FUJITA Tomonori, Frederic Weisbecker, Lyude Paul, Thomas Gleixner,
	Anna-Maria Behnsen, John Stultz, Stephen Boyd, Alexander Viro,
	Christian Brauner, Jan Kara, linux-kernel, linux-alpha,
	linux-arm-kernel, rust-for-linux, linux-fsdevel, Alice Ryhl

There are currently a few places in the kernel where we use volatile
reads when we really should be using `READ_ONCE`. To make it possible to
replace these with proper `READ_ONCE` calls, introduce a Rust version of
`READ_ONCE`.

A new config option CONFIG_ARCH_USE_CUSTOM_READ_ONCE is introduced so
that Rust is able to use conditional compilation to implement READ_ONCE
in terms of either a volatile read, or by calling into a C helper
function, depending on the architecture.

This series is intended to be merged through ATOMIC INFRASTRUCTURE.

Signed-off-by: Alice Ryhl <aliceryhl@google.com>
---
Alice Ryhl (5):
      arch: add CONFIG_ARCH_USE_CUSTOM_READ_ONCE for arm64/alpha
      rust: sync: add READ_ONCE and WRITE_ONCE
      rust: sync: support using bool with READ_ONCE
      rust: hrtimer: use READ_ONCE instead of read_volatile
      rust: fs: use READ_ONCE instead of read_volatile

 MAINTAINERS                     |   2 +
 arch/Kconfig                    |  11 +++
 arch/alpha/Kconfig              |   1 +
 arch/alpha/include/asm/rwonce.h |   4 +-
 arch/arm64/Kconfig              |   1 +
 arch/arm64/include/asm/rwonce.h |   4 +-
 rust/helpers/helpers.c          |   1 +
 rust/helpers/rwonce.c           |  34 +++++++
 rust/kernel/fs/file.rs          |   8 +-
 rust/kernel/sync.rs             |   2 +
 rust/kernel/sync/rwonce.rs      | 207 ++++++++++++++++++++++++++++++++++++++++
 rust/kernel/time/hrtimer.rs     |   8 +-
 12 files changed, 268 insertions(+), 15 deletions(-)
---
base-commit: f8f9c1f4d0c7a64600e2ca312dec824a0bc2f1da
change-id: 20251230-rwonce-1e8d2ee0bcf9

Best regards,
-- 
Alice Ryhl <aliceryhl@google.com>


^ permalink raw reply	[flat|nested] 45+ messages in thread
* Re: [PATCH 3/5] rust: sync: support using bool with READ_ONCE
@ 2026-01-06 18:10 Jubilee Young
  0 siblings, 0 replies; 45+ messages in thread
From: Jubilee Young @ 2026-01-06 18:10 UTC (permalink / raw)
  To: peterz
  Cc: a.hindborg, Alice Ryhl, anna-maria, Björn Roy Baron,
	Boqun Feng, brauner, catalin.marinas, dakr, frederic,
	fujita.tomonori, Gary Guo, jack, jstultz, linmag7, linux-alpha,
	linux-arm-kernel, linux-fsdevel, linux-kernel, lossin, lyude,
	mark.rutland, Matt Turner, Miguel Ojeda, richard.henderson,
	rust-for-linux, sboyd, tglx, tmgross, viro, will

Hello,

Can you cite a practical, real-world example of a target where this is the case?
And is this a target that the Linux community has a strong consensus
it should support?
Would it be able to boot with the existing Linux codebase? Could it
then run software?
For example, plug in a USB device and pull images that were written by
another machine?

Jubilee
Rust compiler team member

^ permalink raw reply	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2026-01-21  2:35 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-31 12:22 [PATCH 0/5] Add READ_ONCE and WRITE_ONCE to Rust Alice Ryhl
2025-12-31 12:22 ` [PATCH 1/5] arch: add CONFIG_ARCH_USE_CUSTOM_READ_ONCE for arm64/alpha Alice Ryhl
2025-12-31 12:22 ` [PATCH 2/5] rust: sync: add READ_ONCE and WRITE_ONCE Alice Ryhl
2026-01-06 12:29   ` Andreas Hindborg
2026-01-06 12:53     ` Boqun Feng
2025-12-31 12:22 ` [PATCH 3/5] rust: sync: support using bool with READ_ONCE Alice Ryhl
2025-12-31 15:25   ` Gary Guo
2026-01-06 12:43   ` Peter Zijlstra
2026-01-06 12:51     ` Alice Ryhl
2026-01-06 18:12     ` Gary Guo
2026-01-07  8:33       ` Peter Zijlstra
2026-01-07 18:12         ` Gary Guo
2025-12-31 12:22 ` [PATCH 4/5] rust: hrtimer: use READ_ONCE instead of read_volatile Alice Ryhl
2026-01-01  2:11   ` FUJITA Tomonori
2026-01-01  4:00     ` FUJITA Tomonori
2026-01-06 12:37       ` Andreas Hindborg
2026-01-06 13:28         ` FUJITA Tomonori
2026-01-07 10:11           ` Andreas Hindborg
2026-01-07 11:22             ` FUJITA Tomonori
2026-01-07 18:21               ` Andreas Hindborg
2026-01-09  2:10                 ` FUJITA Tomonori
2026-01-09 10:42                   ` Andreas Hindborg
2026-01-07 11:51             ` Boqun Feng
2026-01-07 12:48               ` Andreas Hindborg
2026-01-06 15:23         ` Gary Guo
2026-01-06 18:43           ` Alice Ryhl
2026-01-07  0:47             ` John Hubbard
2026-01-07  1:08               ` Boqun Feng
2026-01-07  2:59                 ` John Hubbard
2026-01-07  1:18             ` Boqun Feng
2025-12-31 12:22 ` [PATCH 5/5] rust: fs: " Alice Ryhl
2026-01-21  0:47   ` Boqun Feng
2025-12-31 15:12 ` [PATCH 0/5] Add READ_ONCE and WRITE_ONCE to Rust Gary Guo
2026-01-01  0:53   ` Alice Ryhl
2026-01-01  1:13     ` Boqun Feng
2026-01-06 12:41       ` Andreas Hindborg
2026-01-06 13:09         ` Boqun Feng
2026-01-06 14:56           ` Peter Zijlstra
2026-01-06 18:18             ` Paul E. McKenney
2026-01-06 19:28               ` Marco Elver
2026-01-09  2:09                 ` Paul E. McKenney
2026-01-09 12:00                   ` Marco Elver
2026-01-07  8:43               ` Peter Zijlstra
2026-01-07 19:17                 ` Paul E. McKenney
  -- strict thread matches above, loose matches on Subject: below --
2026-01-06 18:10 [PATCH 3/5] rust: sync: support using bool with READ_ONCE Jubilee Young

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox