From: sashiko-bot@kernel.org
To: "Laura Nao" <laura.nao@collabora.com>
Cc: dri-devel@lists.freedesktop.org, ojeda@kernel.org
Subject: Re: [PATCH v3] drm/tyr: add Job IRQ handling
Date: Mon, 03 Aug 2026 13:43:52 +0000 [thread overview]
Message-ID: <20260803134353.3FC021F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260728-tyr-irq-v2-v3-1-9c9bc5c029c5@collabora.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Hardware interrupt is eagerly unmasked before the OS-level IRQ handler is registered, creating a race condition that can lead to an unhandled interrupt storm.
- [High] The threaded IRQ handler clears the interrupt status after handling it, causing a race condition where newly arrived interrupts for the same status bits are lost.
--
--- Patch [1]: [PATCH v3] drm/tyr: add Job IRQ handling ---
commit b6b7c4ae779f404042159506914510a46f953463
Author: Laura Nao <laura.nao@collabora.com>
drm/tyr: add Job IRQ handling
This commit adds a threaded IRQ wrapper for Tyr interrupt sources and
implements handling for the firmware Job IRQ. It sets up a wait queue to
signal firmware readiness when the global interface request bit is set.
> diff --git a/drivers/gpu/drm/tyr/driver.rs b/drivers/gpu/drm/tyr/driver.rs
> index 8348c6cd39295..224ee7f2eb3fd 100644
> --- a/drivers/gpu/drm/tyr/driver.rs
> +++ b/drivers/gpu/drm/tyr/driver.rs
[ ... ]
> + fn handle_threaded(&self) -> IrqReturn {
> + let mut ret = IrqReturn::None;
> +
> + loop {
> + let raw_status = self.irq.read_raw_status() & self.irq.mask();
> + if raw_status == 0 {
> + break;
> + }
> + self.irq.handle(raw_status);
> + self.irq.clear_status(raw_status);
[Severity: High]
Is it possible to lose hardware events here?
By calling handle() before clear_status(), if the hardware re-asserts
the same interrupt bit while handle() is executing, the subsequent
clear_status() will write the original raw_status bits to the
Write-1-to-Clear register.
This could inadvertently wipe out the newly arrived event, causing the
next iteration of the loop to read 0 and the new event to never be
handled. Should clear_status() be called before handle() to avoid this race?
> + ret = IrqReturn::Handled;
> + }
> +
> + self.irq.reenable_mask();
> + ret
> + }
> +}
> diff --git a/drivers/gpu/drm/tyr/fw/irq.rs b/drivers/gpu/drm/tyr/fw/irq.rs
> new file mode 100644
> index 0000000000000..6eeb1399a7b30
> --- /dev/null
> +++ b/drivers/gpu/drm/tyr/fw/irq.rs
[ ... ]
> +pub(crate) unsafe fn job_irq_init<'a>(
> + pdev: &'a platform::Device<Bound>,
> + iomem: Arc<IoMem<'a>>,
> + fw_ready: Arc<AtomicBool>,
> + job_irq_wait: Arc<WaitQueue>,
> +) -> Result<impl PinInit<ThreadedRegistration<'a, TyrIrq<JobIrq<'a>>>, Error> + 'a> {
> + iomem.write_reg(JOB_IRQ_MASK::zeroed().with_glb(true));
[Severity: High]
Could this cause an unhandled interrupt storm?
This writes to JOB_IRQ_MASK to enable the interrupt on the hardware
immediately, but returns a deferred PinInit descriptor for the OS-level
handler registration.
Because the actual OS-level handler registration is deferred until the
caller pins and executes this descriptor, there is a window where the
hardware can assert an interrupt that the OS has no handler for.
If the interrupt line is shared, could this cause the kernel to permanently
disable the IRQ line? Should the hardware mask be enabled only after
the handler is fully registered?
> + let job_irq = JobIrq {
> + iomem: iomem.clone(),
> + fw_ready,
> + job_irq_wait,
> + };
> + // SAFETY: The caller guarantees the resulting registration will not be leaked.
> + unsafe { TyrIrq::request(pdev, c_str!("job"), job_irq) }
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260728-tyr-irq-v2-v3-1-9c9bc5c029c5@collabora.com?part=1
next prev parent reply other threads:[~2026-08-03 13:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 13:34 [PATCH v3] drm/tyr: add Job IRQ handling Laura Nao
2026-08-03 13:43 ` sashiko-bot [this message]
2026-08-04 12:23 ` Link Mauve
2026-08-05 10:48 ` Laura Nao
2026-08-06 8:27 ` Alice Ryhl
2026-08-06 12:09 ` Gary Guo
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=20260803134353.3FC021F000E9@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.