From: sashiko-bot@kernel.org
To: "Laura Nao" <laura.nao@collabora.com>
Cc: ojeda@kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v6 2/2] drm/tyr: add Job IRQ handling
Date: Thu, 27 Aug 2026 08:14:15 +0000 [thread overview]
Message-ID: <20260827081416.443EE1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260728-tyr-irq-v2-v6-2-15c90baed949@collabora.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] JobIrqEvents::wait_ready discards the timeout result from wait_event_timeout, improperly returning success even if the wait times out.
- [High] Race condition during IRQ teardown between JobIrqMaskGuard and the threaded IRQ handler leaves the hardware interrupt incorrectly unmasked.
--
commit 56688d4ee1c985c61ffa39c42b540903cfd3dca8
Author: Laura Nao <laura.nao@collabora.com>
drm/tyr: add Job IRQ handling
This commit adds Job IRQ handling to report requests from the CSF firmware,
including global interface requests to check firmware readiness. It adds
JobIrqEvents to signal readiness and JobIrqMaskGuard to ensure the Job IRQ
is masked before registration is freed.
> diff --git a/drivers/gpu/drm/tyr/fw/irq.rs b/drivers/gpu/drm/tyr/fw/irq.rs
> new file mode 100644
> index 0000000000000..7dd894de18cb2
> --- /dev/null
> +++ b/drivers/gpu/drm/tyr/fw/irq.rs
[ ... ]
> + /// Waits until the firmware signals readiness via the GLB IRQ bit, or the timeout expires.
> + pub(crate) fn wait_ready(&self, timeout_ms: Msecs) -> Result {
> + self.wait.wait_event_timeout(
> + || self.ready.load(ordering::Acquire),
> + msecs_to_jiffies(timeout_ms),
> + )?;
> +
> + Ok(())
> + }
[Severity: High]
Does this code accidentally discard the timeout result from
wait_event_timeout()?
The ? operator will only unwrap wait queue errors, but the actual return
value indicating whether the wait timed out or completed is discarded by
the semicolon, resulting in an unconditional Ok(()) return.
Could this cause the driver to proceed as if the firmware successfully
signaled readiness even when the initialization timed out, leading to
invalid hardware interactions or driver hangs?
[ ... ]
> +pub(crate) struct JobIrqMaskGuard<'a>(Arc<IoMem<'a>>);
> +
> +impl Drop for JobIrqMaskGuard<'_> {
> + fn drop(&mut self) {
> + self.0.write_reg(JOB_IRQ_MASK::zeroed());
> + }
> +}
[Severity: High]
Can this mask guard race with the threaded IRQ handler during teardown?
During driver teardown, this Drop implementation zeroes the hardware IRQ
mask before the ThreadedRegistration is dropped. However, if the
threaded handler handle_threaded() is running concurrently on another CPU,
it finishes its execution by unconditionally calling
self.irq.reenable_mask().
If the handler's reenable_mask() executes after this Drop but before
free_irq() completes, it would leave the hardware interrupt incorrectly
unmasked. Since the handler is being unregistered, could this lead to an
unhandled interrupt storm on the shared IRQ line?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260728-tyr-irq-v2-v6-0-15c90baed949@collabora.com?part=2
next prev parent reply other threads:[~2026-08-27 8:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 8:01 [PATCH v6 0/2] drm/tyr: add Job IRQ handling Laura Nao
2026-08-27 8:01 ` [PATCH v6 1/2] drm/tyr: add TyrIrq threaded IRQ wrapper Laura Nao
2026-08-27 8:15 ` sashiko-bot
2026-08-27 8:01 ` [PATCH v6 2/2] drm/tyr: add Job IRQ handling Laura Nao
2026-08-27 8:14 ` sashiko-bot [this message]
2026-09-23 8:37 ` Alice Ryhl
2026-10-05 13:40 ` Laura Nao
2026-09-25 19:29 ` [PATCH v6 0/2] " Daniel Almeida
2026-10-05 13:54 ` 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=20260827081416.443EE1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=laura.nao@collabora.com \
--cc=ojeda@kernel.org \
--cc=sashiko-reviews@lists.linux.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