Re: [PATCH 2/2] rust: kcsan: add KUnit test for data race detection
From: Miguel Ojeda
Date: Tue Oct 13 2026 - 07:23:14 EST
On Tue, Oct 13, 2026 at 12:10 PM Marco Elver <elver@xxxxxxxxxx> wrote:
>
> Looks like it, and we need this patch to use system_dfl_wq:
>
>
> From: Marco Elver <elver@xxxxxxxxxx>
> Date: Tue, 13 Oct 2026 10:05:52 +0000
> Subject: [PATCH] rust: workqueue: add system_dfl()
>
> The C kernel deprecated system_unbound_wq in favor of system_dfl_wq
> (commit 64d8eae3f895 ("workqueue: Add warnings and fallback if
> system_{unbound}_wq is used")).
>
> Add `system_dfl()` to provide a safe wrapper around `system_dfl_wq`.
>
> Signed-off-by: Marco Elver <elver@xxxxxxxxxx>
> ---
> rust/kernel/workqueue.rs | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/rust/kernel/workqueue.rs b/rust/kernel/workqueue.rs
> index 7e253b6f299c..e46d3acf903d 100644
> --- a/rust/kernel/workqueue.rs
> +++ b/rust/kernel/workqueue.rs
> @@ -1063,6 +1063,16 @@ pub fn system_unbound() -> &'static Queue {
> unsafe { Queue::from_raw(bindings::system_unbound_wq) }
> }
>
> +/// Returns the system default work queue (`system_dfl_wq`).
> +///
> +/// Workers are not bound to any specific CPU, not concurrency managed, and all queued work items
> +/// are executed immediately as long as `max_active` limit is not reached and resources are
> +/// available.
> +pub fn system_dfl() -> &'static Queue {
> + // SAFETY: `system_dfl_wq` is a C global, always available.
> + unsafe { Queue::from_raw(bindings::system_dfl_wq) }
> +}
> +
> /// Returns the system freezable work queue (`system_freezable_wq`).
> ///
> /// It is equivalent to the one returned by [`system`] except that it's freezable.
> --
> 2.56.0.385.gd3acb90ef8-goog
This is:
https://lore.kernel.org/rust-for-linux/20260807165252.3849875-2-dakr@xxxxxxxxxx/
i.e. we have had a warning like that in one of our current tests for a
while, it would be nice to clean it up:
workqueue: work func
_RNvXs8_NtCs5lxGbhOOw2k_6kernel9workqueueINtNtNtB7_4sync3arc3ArcNtNtNtNtBH_4lock8spinlock5tests4TestEINtB5_15WorkItemPointerKy0_E3runB7_
enqueued on deprecated workqueue. Use system_{percpu|dfl}_wq instead.
Cc'ing workqueue: Tejun and Lai.
Cheers,
Miguel