lkmm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 0/9] LKMM generic atomics in Rust
@ 2025-07-10  6:00 Boqun Feng
  2025-07-10  6:00 ` [PATCH v6 1/9] rust: Introduce atomic API helpers Boqun Feng
                   ` (8 more replies)
  0 siblings, 9 replies; 65+ messages in thread
From: Boqun Feng @ 2025-07-10  6:00 UTC (permalink / raw)
  To: linux-kernel, rust-for-linux, lkmm, linux-arch
  Cc: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Trevor Gross, Danilo Krummrich, Will Deacon, Peter Zijlstra,
	Mark Rutland, Wedson Almeida Filho, Viresh Kumar, Lyude Paul,
	Ingo Molnar, Mitchell Levy, Paul E. McKenney, Greg Kroah-Hartman,
	Linus Torvalds, Thomas Gleixner, Alan Stern

Hi all,

This is the v6 of LKMM atomics in Rust, you can find the previous
versions at:

v5: https://lore.kernel.org/rust-for-linux/20250618164934.19817-1-boqun.feng@gmail.com/
v4: https://lore.kernel.org/rust-for-linux/20250609224615.27061-1-boqun.feng@gmail.com/
v3: https://lore.kernel.org/rust-for-linux/20250421164221.1121805-1-boqun.feng@gmail.com/
v2: https://lore.kernel.org/rust-for-linux/20241101060237.1185533-1-boqun.feng@gmail.com/
v1: https://lore.kernel.org/rust-for-linux/20240612223025.1158537-1-boqun.feng@gmail.com/
wip: https://lore.kernel.org/rust-for-linux/20240322233838.868874-1-boqun.feng@gmail.com/

I dropped the support for atomic pointers for now
(Atomic<{isize,usize}> still exists), because further more work is
needed to ensure the implementation could preserve provenance [1]. And
we already other series depending on atomics [2], so it makes sense to
get some basic support in-tree.

Peter & Ingo, I take it that it's OK for me to send a PR to tip later
this week or early next week if things went well? Of course, any
feedback is welcome!

Changes since v5:

* Replace `as` cast with `ptr.cast()` in atomic/ops.rs per the
  suggestion of Andreas.
* Explicitly document `Acquire` and `Release` ordering definition per
  the suggestion of Peter.
* Rename `All` to `Any` for ordering accept traits per the suggestion of
  Andreas.
* Remove unnecessary fields in `AcquireOrRelaxed` and `ReleaseOrRelaxed`
  per the suggestion of Gary.
* Add round-trip transmutability (thanks Benno) as the safety
  requirement of `AllowAtomic` per discussion with Gary and Benno.
* Add doc alias for xchg() and cmpxchg() per the suggestion of Benno.
* Examples and documentation improvement.
* Applied Reviewed-by tags from Alice and Andreas.

[1]: https://lore.kernel.org/rust-for-linux/aGg4sIORQiG02IoD@Mac.home/
[2]: https://lore.kernel.org/rust-for-linux/20250709-module-params-v3-v16-1-4f926bcccb50@kernel.org/

Regards,
Boqun

Boqun Feng (9):
  rust: Introduce atomic API helpers
  rust: sync: Add basic atomic operation mapping framework
  rust: sync: atomic: Add ordering annotation types
  rust: sync: atomic: Add generic atomics
  rust: sync: atomic: Add atomic {cmp,}xchg operations
  rust: sync: atomic: Add the framework of arithmetic operations
  rust: sync: atomic: Add Atomic<u{32,64}>
  rust: sync: Add memory barriers
  rust: sync: atomic: Add Atomic<{usize,isize}>

 MAINTAINERS                               |    4 +-
 rust/helpers/atomic.c                     | 1040 +++++++++++++++++++++
 rust/helpers/barrier.c                    |   18 +
 rust/helpers/helpers.c                    |    2 +
 rust/kernel/sync.rs                       |    2 +
 rust/kernel/sync/atomic.rs                |  193 ++++
 rust/kernel/sync/atomic/generic.rs        |  567 +++++++++++
 rust/kernel/sync/atomic/ops.rs            |  195 ++++
 rust/kernel/sync/atomic/ordering.rs       |   97 ++
 rust/kernel/sync/barrier.rs               |   65 ++
 scripts/atomic/gen-atomics.sh             |    1 +
 scripts/atomic/gen-rust-atomic-helpers.sh |   67 ++
 12 files changed, 2250 insertions(+), 1 deletion(-)
 create mode 100644 rust/helpers/atomic.c
 create mode 100644 rust/helpers/barrier.c
 create mode 100644 rust/kernel/sync/atomic.rs
 create mode 100644 rust/kernel/sync/atomic/generic.rs
 create mode 100644 rust/kernel/sync/atomic/ops.rs
 create mode 100644 rust/kernel/sync/atomic/ordering.rs
 create mode 100644 rust/kernel/sync/barrier.rs
 create mode 100755 scripts/atomic/gen-rust-atomic-helpers.sh

-- 
2.39.5 (Apple Git-154)


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

end of thread, other threads:[~2025-07-16 19:42 UTC | newest]

Thread overview: 65+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-10  6:00 [PATCH v6 0/9] LKMM generic atomics in Rust Boqun Feng
2025-07-10  6:00 ` [PATCH v6 1/9] rust: Introduce atomic API helpers Boqun Feng
2025-07-10  6:00 ` [PATCH v6 2/9] rust: sync: Add basic atomic operation mapping framework Boqun Feng
2025-07-10 11:04   ` Benno Lossin
2025-07-10 15:12     ` Boqun Feng
2025-07-10 15:46       ` Benno Lossin
2025-07-10 16:16         ` Boqun Feng
2025-07-10 19:21           ` Benno Lossin
2025-07-10 20:29             ` Boqun Feng
2025-07-11  8:15               ` Benno Lossin
2025-07-10  6:00 ` [PATCH v6 3/9] rust: sync: atomic: Add ordering annotation types Boqun Feng
2025-07-10 11:08   ` Benno Lossin
2025-07-10 12:00     ` Andreas Hindborg
2025-07-10 14:42       ` Boqun Feng
2025-07-10 15:05         ` Benno Lossin
2025-07-10 15:57           ` Boqun Feng
2025-07-10 19:19             ` Benno Lossin
2025-07-10 18:32           ` Miguel Ojeda
2025-07-10 19:06             ` Miguel Ojeda
2025-07-10  6:00 ` [PATCH v6 4/9] rust: sync: atomic: Add generic atomics Boqun Feng
2025-07-11  8:03   ` Benno Lossin
2025-07-11 13:22     ` Boqun Feng
2025-07-11 13:34       ` Benno Lossin
2025-07-11 13:51         ` Boqun Feng
2025-07-11 18:34           ` Benno Lossin
2025-07-11 21:25             ` Boqun Feng
2025-07-11 13:58     ` Boqun Feng
2025-07-11 18:35       ` Benno Lossin
2025-07-14  7:08         ` Boqun Feng
2025-07-13 19:51     ` Boqun Feng
2025-07-10  6:00 ` [PATCH v6 5/9] rust: sync: atomic: Add atomic {cmp,}xchg operations Boqun Feng
2025-07-11  8:42   ` Benno Lossin
2025-07-10  6:00 ` [PATCH v6 6/9] rust: sync: atomic: Add the framework of arithmetic operations Boqun Feng
2025-07-11  8:53   ` Benno Lossin
2025-07-11 14:39     ` Boqun Feng
2025-07-11 17:41       ` Boqun Feng
2025-07-11 19:07         ` Benno Lossin
2025-07-11 18:55       ` Benno Lossin
2025-07-11 19:51         ` Boqun Feng
2025-07-11 21:03           ` Benno Lossin
2025-07-11 21:22             ` Boqun Feng
2025-07-14  4:20               ` Boqun Feng
2025-07-10  6:00 ` [PATCH v6 7/9] rust: sync: atomic: Add Atomic<u{32,64}> Boqun Feng
2025-07-11  8:54   ` Benno Lossin
2025-07-10  6:00 ` [PATCH v6 8/9] rust: sync: Add memory barriers Boqun Feng
2025-07-11  8:57   ` Benno Lossin
2025-07-11 13:32     ` Boqun Feng
2025-07-11 18:57       ` Benno Lossin
2025-07-11 19:26         ` Boqun Feng
2025-07-11 21:04           ` Benno Lossin
2025-07-11 21:34             ` Boqun Feng
2025-07-11 18:20     ` Boqun Feng
2025-07-14 15:42       ` Ralf Jung
2025-07-15 15:21         ` Boqun Feng
2025-07-15 15:35           ` Ralf Jung
2025-07-15 15:56             ` Boqun Feng
2025-07-16 19:42               ` Ralf Jung
2025-07-10  6:00 ` [PATCH v6 9/9] rust: sync: atomic: Add Atomic<{usize,isize}> Boqun Feng
2025-07-11  9:00   ` Benno Lossin
2025-07-11 13:45     ` Miguel Ojeda
2025-07-11 14:07       ` Boqun Feng
2025-07-11 14:40         ` Miguel Ojeda
2025-07-11 15:46           ` Boqun Feng
2025-07-11 18:35             ` Miguel Ojeda
2025-07-11 19:05       ` Benno Lossin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).