mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Danilo Krummrich <dakr@kernel.org>
To: boqun@kernel.org, gary@garyguo.net, aliceryhl@google.com,
	lyude@redhat.com, daniel.almeida@collabora.com,
	work@onurozkan.dev, ojeda@kernel.org, bjorn3_gh@protonmail.com,
	lossin@kernel.org, a.hindborg@kernel.org, tmgross@umich.edu,
	dakr@kernel.org, tamird@kernel.org, acourbot@nvidia.com,
	viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz
Cc: linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
	linux-fsdevel@vger.kernel.org
Subject: [PATCH v2 0/5] rust: sync: add WaitQueue infrastructure
Date: Thu,  5 Nov 2026 01:59:37 +0100	[thread overview]
Message-ID: <20261105005951.756157-1-dakr@kernel.org> (raw)

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 and add
wait_interruptible_freezable_nonexclusive() for subsequent binder usage.

Changes in v2:
- Drop the already merged workqueue patch.
- Make as_raw() public.
- Split error types and use bindings constants for direct C calls.
- Avoid condition rechecks after success.
- Check the condition before preparing a waiter.
- Add non-exclusive wait support, including a CondVar method for subsequent
  Binder conversion.
- Handle zero and expired timeouts before interruption; extend KUnit coverage.

[1] https://lore.kernel.org/dri-devel/20260721151423.444175-2-laura.nao@collabora.com/

Danilo Krummrich (5):
  rust: task: add safe schedule_timeout() wrapper
  rust: sync: add WaitQueue infrastructure
  rust: sync: convert CondVar and PollCondVar to use WaitQueue
  rust: sync: condvar: use task::schedule_timeout()
  rust: sync: condvar: add non-exclusive freezable waiting

 rust/kernel/sync.rs         |   8 +
 rust/kernel/sync/condvar.rs | 134 ++++-----
 rust/kernel/sync/poll.rs    |  19 +-
 rust/kernel/sync/wait.rs    | 524 ++++++++++++++++++++++++++++++++++++
 rust/kernel/task.rs         |  16 ++
 5 files changed, 612 insertions(+), 89 deletions(-)
 create mode 100644 rust/kernel/sync/wait.rs


base-commit: 41871f4ddf710339863f957bcfcab5094c234771
-- 
2.56.0


             reply	other threads:[~2026-11-05  0:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05  0:59 Danilo Krummrich [this message]
2026-11-05  0:59 ` [PATCH v2 1/5] rust: task: add safe schedule_timeout() wrapper Danilo Krummrich
2026-11-05  4:20   ` FUJITA Tomonori
2026-11-05  0:59 ` [PATCH v2 2/5] rust: sync: add WaitQueue infrastructure Danilo Krummrich
2026-11-05  0:59 ` [PATCH v2 3/5] rust: sync: convert CondVar and PollCondVar to use WaitQueue Danilo Krummrich
2026-11-05  0:59 ` [PATCH v2 4/5] rust: sync: condvar: use task::schedule_timeout() Danilo Krummrich
2026-11-05  0:59 ` [PATCH v2 5/5] rust: sync: condvar: add non-exclusive freezable waiting Danilo Krummrich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261105005951.756157-1-dakr@kernel.org \
    --to=dakr@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=brauner@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=gary@garyguo.net \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=lyude@redhat.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=viro@zeniv.linux.org.uk \
    --cc=work@onurozkan.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®