Rust synchronization changes for v7.2
Subsystems (3)
Boqun Feng
maintainerHi Peter,
Please pull this small set of changes into tip.
Sorry for being a bit late on this cycle. I was trying to get the refcounted interrupt change [1] in this PR, but I feel maybe I should make that a separate patch series for more reviews, which I will send out shortly.
The following changes since commit 608323bf7bb85bbb647eca4373acef247f105e67:
selftests: futex: Add tests for robust release operations (2026-06-03 11:38:53 +0200)
are available in the Git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/boqun/linux.git/ tags/rust-sync-7.2
for you to fetch changes up to 33d221f06eb7e068fd6c3c78d432322f807a3f0f:
rust: sync: completion: Mark inline complete_all and wait_for_completion (2026-06-03 11:52:08 -0700)
----------------------------------------------------------------
Rust synchronization changes for 7.2:
- Add "RUST [SYNC]" maintainer entry.
- locking/lockdep: Replace snprintf with strscpy in seq_stats.
- Mark a few completion related Rust function as inline.
[1]: https://lore.kernel.org/rust-for-linux/[email protected]/
Regards,
Boqun
----------------------------------------------------------------
Boqun Feng (1):
MAINTAINERS: Add RUST [SYNC] entry
Fabricio Parra (1):
rust: sync: completion: Mark inline complete_all and wait_for_completion
Thorsten Blum (1):
locking/lockdep: Replace snprintf with strscpy in seq_stats
MAINTAINERS | 14 ++++++++++++++ kernel/locking/lockdep_proc.c | 5 +++-- rust/kernel/sync/completion.rs | 2 ++ 3 files changed, 19 insertions(+), 2 deletions(-)
Boqun Feng
maintainerPATCH 1/3 MAINTAINERS: Add RUST [SYNC] entry
We have two pull requests on Rust synchronization primitives with 10+ patches in a row for recent cycles, so it makes sense to start the effort of handling this area as a group.
Luckily for me, Gary Guo and Alice Ryhl agreed to help as co-maintainers, and we also have a talented group of reviewers:
Lyude Paul started the SpinLockIrq work [1] and did an amazing job at improving the design and implementation.
Daniel Almeida resolved the Lock<T: !Unpin> issue [2] and he did a fair amount of reviews in areas related to synchronization primitives already.
Onur Özkan started the ww_mutex work [3] and did an amazing job at consolidating various design requirements and decisions.
Of course, this only reflects my own knowledge, and I believe they did way more outside what I'm aware of ;-)
Note that having this MAINTAINERS entry is meant to bring more people to help on the synchronization primitives in Rust, which means for patch submissions and design discussion, please still involve the corresponding maintainers (e.g. LOCKING and ATOMIC), scripts/get_maintainers.pl should have this covered.
--- MAINTAINERS | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
MAINTAINERS +14 -0
@@ -23450,6 +23450,20 @@ S: Maintained T: git https://github.com/Rust-for-Linux/linux.git rust-analyzer-next F: scripts/generate_rust_analyzer.py +RUST [SYNC] +M: Boqun Feng <[email protected]> +M: Gary Guo <[email protected]> +M: Alice Ryhl <[email protected]> +R: Lyude Paul <[email protected]> +R: Daniel Almeida <[email protected]> +R: "Onur Özkan" <[email protected]> +L: [email protected] +L: [email protected] +S: Maintained +T: git git://git.kernel.org/pub/scm/linux/kernel/git/boqun/linux.git rust-sync +F: rust/kernel/sync.rs +F: rust/kernel/sync/ + RXRPC SOCKETS (AF_RXRPC) M: David Howells <[email protected]> M: Marc Dionne <[email protected]>
Signature · 1 line
2.51.0
[tip: locking/core] MAINTAINERS: Add RUST [SYNC] entry
The following commit has been merged into the locking/core branch of tip:
The following commit has been merged into the locking/core branch of tip:
Commit-ID: 4770880855359b345314ca1d0b28f9be8886eba8 Gitweb: https://git.kernel.org/tip/4770880855359b345314ca1d0b28f9be8886eba8 Author: Boqun Feng <[email protected]> AuthorDate: Thu, 04 Jun 2026 22:23:29 -07:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Tue, 09 Jun 2026 10:28:06 +02:00
MAINTAINERS: Add RUST [SYNC] entry
We have two pull requests on Rust synchronization primitives with 10+ patches in a row for recent cycles, so it makes sense to start the effort of handling this area as a group.
Luckily for me, Gary Guo and Alice Ryhl agreed to help as co-maintainers, and we also have a talented group of reviewers:
Lyude Paul started the SpinLockIrq work [1] and did an amazing job at improving the design and implementation.
Daniel Almeida resolved the Lock<T: !Unpin> issue [2] and he did a fair amount of reviews in areas related to synchronization primitives already.
Onur Özkan started the ww_mutex work [3] and did an amazing job at consolidating various design requirements and decisions.
Of course, this only reflects my own knowledge, and I believe they did way more outside what I'm aware of ;-)
Note that having this MAINTAINERS entry is meant to bring more people to help on the synchronization primitives in Rust, which means for patch submissions and design discussion, please still involve the corresponding maintainers (e.g. LOCKING and ATOMIC), scripts/get_maintainers.pl should have this covered.
--- MAINTAINERS | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
MAINTAINERS +14 -0
@@ -23450,6 +23450,20 @@ S: Maintained T: git https://github.com/Rust-for-Linux/linux.git rust-analyzer-next F: scripts/generate_rust_analyzer.py +RUST [SYNC] +M: Boqun Feng <[email protected]> +M: Gary Guo <[email protected]> +M: Alice Ryhl <[email protected]> +R: Lyude Paul <[email protected]> +R: Daniel Almeida <[email protected]> +R: "Onur Özkan" <[email protected]> +L: [email protected] +L: [email protected] +S: Maintained +T: git git://git.kernel.org/pub/scm/linux/kernel/git/boqun/linux.git rust-sync +F: rust/kernel/sync.rs +F: rust/kernel/sync/ + RXRPC SOCKETS (AF_RXRPC) M: David Howells <[email protected]> M: Marc Dionne <[email protected]>
Boqun Feng
maintainerPATCH 2/3 locking/lockdep: Replace snprintf with strscpy in seq_stats
In reply to Boqun FengFrom: Thorsten Blum <[email protected]>
Replace snprintf("%s", ...) with the faster and more direct strscpy().
--- kernel/locking/lockdep_proc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/locking/lockdep_proc.c +3 -2
@@ -19,6 +19,7 @@#include <linux/debug_locks.h> #include <linux/vmalloc.h> #include <linux/sort.h> +#include <linux/string.h> #include <linux/uaccess.h> #include <asm/div64.h>
@@ -488,9 +489,9 @@ static void seq_stats(struct seq_file *m, struct lock_stat_data *data)const char *key_name; key_name =__get_key_name (ckey, str); -snprintf (name, namelen,"%s" , key_name); +strscpy (name, key_name, namelen); }else { -snprintf (name, namelen,"%s" , cname); +strscpy (name, cname, namelen); }rcu_read_unlock_sched ();
Signature · 1 line
2.51.0
Boqun Feng
maintainerPATCH 3/3 rust: sync: completion: Mark inline complete_all and wait_for_completion
In reply to Boqun FengFrom: Fabricio Parra <[email protected]>
When building the kernel using the llvm-22.1.0-rust-1.93.1-x86_64 toolchain provided by kernel.org with ARCH=x86_64, the following symbols are generated:
$ nm vmlinux | grep ' _R'.*Completion | rustfilt ffffffff81827930 T <kernel::sync::completion::Completion>::complete_all ffffffff81827950 T <kernel::sync::completion::Completion>::wait_for_completion
These Rust methods are thin wrappers around the C completion helpers complete_all and wait_for_completion. Mark them #[inline] to keep the wrapper pattern consistent with other small Rust helper methods.
After applying this patch, the above command will produce no output.
--- rust/kernel/sync/completion.rs | 2 ++ 1 file changed, 2 insertions(+)
rust/kernel/sync/completion.rs +2 -0
@@ -94,6 +94,7 @@ fn as_raw(&self) -> *mut bindings::completion {/// /// This method wakes up all tasks waiting on this completion; after this operation the /// completion is permanently done, i.e. signals all current and future waiters. +#[inline] pub fn complete_all (&self) {// SAFETY: `self.as_raw()` is a pointer to a valid `struct completion`. unsafe { bindings::complete_all (self.as_raw ()) };
@@ -105,6 +106,7 @@ pub fn complete_all(&self) {/// timeout. /// /// See also [`Completion::complete_all`]. +#[inline] pub fn wait_for_completion (&self) {// SAFETY: `self.as_raw()` is a pointer to a valid `struct completion`. unsafe { bindings::wait_for_completion (self.as_raw ()) };
Signature · 1 line
2.51.0
[tip: locking/core] rust: sync: completion: Mark inline complete_all and wait_for_completion
The following commit has been merged into the locking/core branch of tip:
The following commit has been merged into the locking/core branch of tip:
Commit-ID: a837dd95e841586c3a6bbe41c41843b392a1b725 Gitweb: https://git.kernel.org/tip/a837dd95e841586c3a6bbe41c41843b392a1b725 Author: Fabricio Parra <[email protected]> AuthorDate: Thu, 04 Jun 2026 22:23:31 -07:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Tue, 09 Jun 2026 10:28:06 +02:00
rust: sync: completion: Mark inline complete_all and wait_for_completion
When building the kernel using the llvm-22.1.0-rust-1.93.1-x86_64 toolchain provided by kernel.org with ARCH=x86_64, the following symbols are generated:
$ nm vmlinux | grep ' _R'.*Completion | rustfilt ffffffff81827930 T <kernel::sync::completion::Completion>::complete_all ffffffff81827950 T <kernel::sync::completion::Completion>::wait_for_completion
These Rust methods are thin wrappers around the C completion helpers complete_all and wait_for_completion. Mark them #[inline] to keep the wrapper pattern consistent with other small Rust helper methods.
After applying this patch, the above command will produce no output.
--- rust/kernel/sync/completion.rs | 2 ++ 1 file changed, 2 insertions(+)
rust/kernel/sync/completion.rs +2 -0
@@ -94,6 +94,7 @@ impl Completion {/// /// This method wakes up all tasks waiting on this completion; after this operation the /// completion is permanently done, i.e. signals all current and future waiters. +#[inline] pub fn complete_all (&self) {// SAFETY: `self.as_raw()` is a pointer to a valid `struct completion`. unsafe { bindings::complete_all (self.as_raw ()) };
@@ -105,6 +106,7 @@ impl Completion {/// timeout. /// /// See also [`Completion::complete_all`]. +#[inline] pub fn wait_for_completion (&self) {// SAFETY: `self.as_raw()` is a pointer to a valid `struct completion`. unsafe { bindings::wait_for_completion (self.as_raw ()) };