[PATCH 0/5] rust: sync: add WaitQueue infrastructure

Danilo Krummrich <[email protected]> Mon, 27 Jul 2026 00:36:06 +0200
Newsgroups org.kernel.vger.rust-for-linux,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Add a WaitQueue abstraction wrapping struct wait_queue_head, providing
wait_event()-style methods that take a condition closure directly.

This is needed for a (subsequent) DRM patch series to wait for in-flight file
close operations during driver unbind. The Tyr driver also needs it for "CSF
firmware responses and other GPU-driven events" [1].

Convert CondVar (and PollCondVar) to use WaitQueue internally, removing
duplicate code using WaitQueue as the base primitive.

Also replace the deprecated system_wq wrapper with system_percpu_wq and
system_dfl_wq to avoid introducing more callers generating warnings that would
need to be converted later.

[1] https://lore.kernel.org/dri-devel/[email protected]/

Danilo Krummrich (5):
  rust: task: add safe schedule_timeout() wrapper
  rust: workqueue: replace deprecated system_wq with
    system_{percpu,dfl}_wq
  rust: sync: add WaitQueue infrastructure
  rust: sync: convert CondVar and PollCondVar to use WaitQueue
  rust: sync: condvar: use task::schedule_timeout()

 drivers/android/binder/process.rs |   4 +-
 rust/kernel/sync.rs               |   6 +
 rust/kernel/sync/completion.rs    |   2 +-
 rust/kernel/sync/condvar.rs       | 104 +++-----
 rust/kernel/sync/lock/spinlock.rs |   2 +-
 rust/kernel/sync/poll.rs          |  14 +-
 rust/kernel/sync/wait.rs          | 385 ++++++++++++++++++++++++++++++
 rust/kernel/task.rs               |  13 +
 rust/kernel/workqueue.rs          |  40 ++--
 9 files changed, 469 insertions(+), 101 deletions(-)
 create mode 100644 rust/kernel/sync/wait.rs


base-commit: 6f6629ab2185d27cbc65d7d85908159b1293c082
-- 
2.55.0