[GIT PULL] [PATCH 00/14] Rust atomic changes for v6.18

Boqun Feng
2025-09-05T04:41:52Z

Hi Will, Peter and Mark,

I'm sending this pull request containing Rust atomic changes to tip
tree. You can find the technical details below, but most importantly we
got a new reviewer for ATOMIC INFRASTRUCTURE that can help maintaining
the code. Welcome Gary!

Similar to other pull requests of myself to the tip tree, this pull
request is sent in form as patch series as well, in case that I missed
something and changes are needed in some patch.

Thanks!

The following changes since commit c17b750b3ad9f45f2b6f7e6f7f4679844244f0b9:

Linux 6.17-rc2 (2025-08-17 15:22:10 -0700)

are available in the Git repository at:

https://git.kernel.org/pub/scm/linux/kernel/git/boqun/linux.git/ tags/rust-atomic.2025.09.04a

for you to fetch changes up to f9bd1b3774be140762af2fec9c415b4a11746c48:

MAINTAINERS: update atomic infrastructure entry to include Rust (2025-09-01 19:15:53 -0700)

----------------------------------------------------------------
Rust atomic changes for v6.18:

- Add initial support for generic LKMM atomic variables in Rust. This
ensures Rust and C side are using the same memory model when
communicating with each other, and would unblock a few more
fine-grained concurrent core on Rust side.

- Add the wrapper for `refcount_t` in Rust. This avoids using customized
reference counting solution on Rust side (e.g. in `block::mq`).
-----BEGIN PGP SIGNATURE-----

iQEzBAABCAAdFiEEj5IosQTPz8XU1wRHSXnow7UH+rgFAmi6YvwACgkQSXnow7UH
+rh/kgf+LruO9gn49QAzDE4T7kf9rP/z4ocie8sxMtED5J0vw12PAVa0UERQyB4m
756O0GSFKwESJMjLUifBslkt64k8x8hQ+XHYH/WPe/Rm7Ku4kf1zsTO9Mt0xA5qr
c5OgnLxR3T2L+1x8rEus8lPnExyX0G0b1/H1XjR+rvZAP1enwcLNyGFV3fNfAYNJ
cMpkGCMFM9wc5dpzDx89ttw49I8yuy+Cmf/eTtm1YDWQgzYVEycF8jTkFqYykIax
jMcZC0a1Lqrn1pLbxCZ5UEM9vxJREv46xBW6iKSkH5RWlbLo2gqMJbixYvkLtgBP
AbtrUtsyIx4Rw0nPEZ880Nce/LdhUw==
=Kuix
-----END PGP SIGNATURE-----

----------------------------------------------------------------
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: atomic: Add Atomic<{usize,isize}>
rust: sync: Add memory barriers

Gary Guo (5):
rust: implement `kernel::sync::Refcount`
rust: make `Arc::into_unique_or_drop` associated function
rust: convert `Arc` to use `Refcount`
rust: block: convert `block::mq` to use `Refcount`
MAINTAINERS: update atomic infrastructure entry to include Rust

MAINTAINERS | 6 +-
rust/helpers/atomic.c | 1040 +++++++++++++++++++++++++++++
rust/helpers/barrier.c | 18 +
rust/helpers/helpers.c | 2 +
rust/helpers/refcount.c | 10 +
rust/kernel/block/mq/operations.rs | 7 +-
rust/kernel/block/mq/request.rs | 73 +-
rust/kernel/sync.rs | 4 +
rust/kernel/sync/arc.rs | 55 +-
rust/kernel/sync/atomic.rs | 551 +++++++++++++++
rust/kernel/sync/atomic/internal.rs | 265 ++++++++
rust/kernel/sync/atomic/ordering.rs | 104 +++
rust/kernel/sync/atomic/predefine.rs | 169 +++++
rust/kernel/sync/barrier.rs | 61 ++
rust/kernel/sync/refcount.rs | 113 ++++
scripts/atomic/gen-atomics.sh | 1 +
scripts/atomic/gen-rust-atomic-helpers.sh | 67 ++
17 files changed, 2454 insertions(+), 92 deletions(-)
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/internal.rs
create mode 100644 rust/kernel/sync/atomic/ordering.rs
create mode 100644 rust/kernel/sync/atomic/predefine.rs
create mode 100644 rust/kernel/sync/barrier.rs
create mode 100644 rust/kernel/sync/refcount.rs
create mode 100755 scripts/atomic/gen-rust-atomic-helpers.sh