From: "Danilo Krummrich" <dakr@kernel.org>
To: "Laura Nao" <laura.nao@collabora.com>
Cc: <daniel.almeida@collabora.com>, <aliceryhl@google.com>,
<airlied@gmail.com>, <simona@ffwll.ch>, <ojeda@kernel.org>,
<boqun@kernel.org>, <gary@garyguo.net>,
<bjorn3_gh@protonmail.com>, <a.hindborg@kernel.org>,
<tmgross@umich.edu>, <tamird@kernel.org>, <acourbot@nvidia.com>,
<work@onurozkan.dev>, <deborah.brouwer@collabora.com>,
<linux-kernel@vger.kernel.org>, <dri-devel@lists.freedesktop.org>,
<rust-for-linux@vger.kernel.org>, <kernel@collabora.com>,
"Beata Michalska" <beata.michalska@arm.com>
Subject: Re: [PATCH 1/2] drm/tyr: add Wait type for GPU events
Date: Tue, 21 Jul 2026 17:32:18 +0200 [thread overview]
Message-ID: <DK4CW8JXVL8M.2KKRMJVCD9AYO@kernel.org> (raw)
In-Reply-To: <20260721151423.444175-2-laura.nao@collabora.com>
On Tue Jul 21, 2026 at 5:14 PM CEST, Laura Nao wrote:
> +/// A convenience type to wait for GPU events.
> +///
> +/// Wraps a [`CondVar`] and [`Mutex`] pair. The mutex synchronizes predicate checks
> +/// with wait/wake operations; the condvar provides the sleep/wake mechanism.
> +#[pin_data]
> +pub(crate) struct Wait {
> + /// The actual wait/signal mechanism.
> + #[pin]
> + cond: CondVar,
> + /// Synchronizes waiters with notifications.
> + #[pin]
> + lock: Mutex<()>,
> +}
This is backwards; if I get this right at a quick glance it is basically abusing
CondVar to implement a WaitQueue abstraction in your driver.
What you actually seem to look for is a proper WaitQueue abstraction, which
could then also be used to simplify the implementation of CondVar.
I'm already working on a WaitQueue abstraction, since I need it elsewhere. I can
probably post something in a few days.
(I didn't check your use-case but you may want to consider completions and
simple waitqueue as well.)
next prev parent reply other threads:[~2026-07-21 15:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-21 15:14 [PATCH 0/2] drm/tyr: add Job IRQ handling and GPU event wait support Laura Nao
2026-07-21 15:14 ` [PATCH 1/2] drm/tyr: add Wait type for GPU events Laura Nao
2026-07-21 15:32 ` Danilo Krummrich [this message]
2026-07-21 15:14 ` [PATCH 2/2] drm/tyr: add Job IRQ handling Laura Nao
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=DK4CW8JXVL8M.2KKRMJVCD9AYO@kernel.org \
--to=dakr@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=beata.michalska@arm.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=deborah.brouwer@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gary@garyguo.net \
--cc=kernel@collabora.com \
--cc=laura.nao@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=simona@ffwll.ch \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--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