From: sashiko-bot@kernel.org
To: "Karunika Choo" <karunika.choo@arm.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v1 25/27] drm/panthor: Tolerate access-window loss during HW waits
Date: Tue, 22 Sep 2026 21:14:30 +0000 [thread overview]
Message-ID: <20260922211430.9FB381F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260922204535.2850094-26-karunika.choo@arm.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] panthor: false success returned when hardware waits are interrupted by AW loss
- [High] panthor: firmware events dropped or IRQ livelock on AW loss
- [High] panthor: threads block for full timeout duration on AW loss due to missing wakeups
--
commit 4e7abd3f16aae357d6bd8c91a0c0d4c8218b1fcc
Author: Karunika Choo <karunika.choo@arm.com>
drm/panthor: Tolerate access-window loss during HW waits
The patch handles access window (AW) loss during hardware waits to prevent
false hardware timeouts or recoveries. It uses panthor_aw_has_gpu_access
to suppress timeout handling once access is revoked.
> diff --git a/drivers/gpu/drm/panthor/panthor_fw.c b/drivers/gpu/drm/panthor/panthor_fw.c
> index 1449d9a66302e..b4c234f3d3ea4 100644
> --- a/drivers/gpu/drm/panthor/panthor_fw.c
> +++ b/drivers/gpu/drm/panthor/panthor_fw.c
> @@ -1140,9 +1140,10 @@ static int panthor_fw_start(struct panthor_device *ptdev)
> gpu_write(fw->iomem, MCU_CONTROL, MCU_CONTROL_AUTO);
>
> if (!wait_event_timeout(ptdev->fw->req_waitqueue,
> - ptdev->fw->booted,
> + (ptdev->fw->booted ||
> + !panthor_aw_has_gpu_access(ptdev)),
> msecs_to_jiffies(1000))) {
> - if (!ptdev->fw->booted &&
> + if (!ptdev->fw->booted && panthor_aw_has_gpu_access(ptdev) &&
> !(gpu_read(fw->irq.iomem, INT_STAT) & JOB_INT_GLOBAL_IF))
> timedout = true;
> }
[Severity: High]
Does this code silently fail to boot but return success? If the AW is lost
during the wait, panthor_aw_has_gpu_access() returns false, preventing
timedout from being set to true. As a result, panthor_fw_start() returns
success even though the firmware is not actually booted.
Additionally, because there is no wakeup mechanism triggered upon AW loss,
will this thread stall in wait_event_timeout() for the full 1000ms duration
when AW access is revoked?
[ ... ]
> diff --git a/drivers/gpu/drm/panthor/panthor_gpu.c b/drivers/gpu/drm/panthor/panthor_gpu.c
> index e6e970e9b59d3..25fe7c77f8763 100644
> --- a/drivers/gpu/drm/panthor/panthor_gpu.c
> +++ b/drivers/gpu/drm/panthor/panthor_gpu.c
> @@ -376,7 +377,8 @@ int panthor_gpu_flush_caches(struct panthor_device *ptdev,
> msecs_to_jiffies(100))) {
> scoped_guard(spinlock, &ptdev->gpu->reqs_lock) {
> if ((ptdev->gpu->pending_reqs & GPU_IRQ_CLEAN_CACHES_COMPLETED) != 0 &&
> - !(gpu_read(gpu->irq.iomem, INT_RAWSTAT) & GPU_IRQ_CLEAN_CACHES_COMPLETED))
> + !(gpu_read(gpu->irq.iomem, INT_RAWSTAT) &
> + GPU_IRQ_CLEAN_CACHES_COMPLETED) && panthor_aw_has_gpu_access(ptdev))
> ret = -ETIMEDOUT;
> else
> ptdev->gpu->pending_reqs &= ~GPU_IRQ_CLEAN_CACHES_COMPLETED;
[Severity: High]
Can this deceive callers into assuming caches were successfully flushed?
If AW is lost, the timeout error is suppressed and the pending request flag
is cleared, causing panthor_gpu_flush_caches() to return 0. This could cause
divergence if callers proceed assuming the flush completed in the hardware.
Also, wait_event_timeout() lacks an AW check in the condition and has no
associated wakeup on AW loss, which will cause a 100ms stall.
[ ... ]
> diff --git a/drivers/gpu/drm/panthor/panthor_pwr.c b/drivers/gpu/drm/panthor/panthor_pwr.c
> index cc2e01595f23b..2a0feb0b39ece 100644
> --- a/drivers/gpu/drm/panthor/panthor_pwr.c
> +++ b/drivers/gpu/drm/panthor/panthor_pwr.c
> @@ -122,7 +123,8 @@ static int panthor_pwr_reset(struct panthor_device *ptdev, u32 reset_cmd)
> msecs_to_jiffies(PWR_RESET_TIMEOUT_MS))) {
> guard(spinlock_irqsave)(&ptdev->pwr->reqs_lock);
>
> - if (reset_pending(ptdev) && !reset_irq_raised(ptdev)) {
> + if (reset_pending(ptdev) && !reset_irq_raised(ptdev) &&
> + panthor_aw_has_gpu_access(ptdev)) {
> drm_err(&ptdev->base, "RESET timed out (0x%x)", reset_cmd);
> return -ETIMEDOUT;
> }
[Severity: High]
Is the thread blocked for the full PWR_RESET_TIMEOUT_MS when AW is lost?
The wait_event_timeout() lacks an AW check in its condition, and without a
corresponding wakeup mechanism for AW loss, it appears this will stall
the thread unnecessarily in panthor_pwr_reset().
[ ... ]
> @@ -266,9 +268,14 @@ static int panthor_pwr_domain_transition(struct panthor_device *ptdev, u32 cmd,
>
> panthor_pwr_write_command(ptdev, pwr_cmd, mask);
>
> - ret = gpu_read64_poll_timeout(pwr->iomem, ready_reg, val, (mask & val) == expected_val,
> + ret = gpu_read64_poll_timeout(pwr->iomem, ready_reg, val,
> + ((mask & val) == expected_val ||
> + !panthor_aw_has_gpu_access(ptdev)),
> 100, timeout_us);
> if (ret) {
> + if (!panthor_aw_has_gpu_access(ptdev))
> + return 0;
> +
[Severity: High]
Does returning success here break the power domain transition sequence?
If the AW arbiter revokes access before the transition finishes, this will
return 0 even though the hardware power domain transition failed to complete.
[ ... ]
> diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
> index 60b2417deb81b..e13553ec97ec9 100644
> --- a/drivers/gpu/drm/panthor/panthor_sched.c
> +++ b/drivers/gpu/drm/panthor/panthor_sched.c
> @@ -1886,6 +1886,9 @@ void panthor_sched_report_fw_events(struct panthor_device *ptdev, u32 events)
>
> guard(spinlock)(&ptdev->scheduler->events_lock);
>
> + if (!panthor_aw_has_gpu_access(ptdev))
> + return;
> +
[Severity: High]
Could this early return cause an IRQ livelock or dropped firmware events?
If a hardware interrupt occurs and panthor_job_irq_handler() successfully
clears the interrupt from the hardware, but then AW access is lost, this
returns early. The cleared events would be permanently dropped.
If AW access is lost before the hardware is cleared in the IRQ handler,
the interrupt remains asserted but this function ignores it, which may cause
the threaded IRQ handler to enter an infinite loop.
[ ... ]
> @@ -2059,6 +2062,8 @@ static int csgs_upd_ctx_apply_locked(struct panthor_device *ptdev,
> csg_iface = panthor_fw_get_csg_iface(ptdev, csg_id);
>
> ret = panthor_fw_csg_wait_acks(ptdev, csg_id, req_mask, &acked, 100);
> + if (ret && !panthor_aw_has_gpu_access(ptdev))
> + ret = 0;
>
[Severity: High]
Does this override the timeout error with success, causing the scheduler to
erroneously assume the firmware processed the CSG state change?
Also, panthor_fw_csg_wait_acks() relies on panthor_fw_wait_acks() which uses
wait_event_timeout(). Since this is called in a loop while holding the
scheduler lock, will the lack of AW wakeups cause compounded delays
(N * 100ms) that block the entire scheduler?
[ ... ]
Regarding panthor_job_irq_handler() in drivers/gpu/drm/panthor/panthor_fw.c:
static void panthor_job_irq_handler(struct panthor_irq *pirq, u32 status)
{
...
if (!ptdev->fw->booted && (status & JOB_INT_GLOBAL_IF))
ptdev->fw->booted = true;
...
}
[Severity: Medium]
This is a pre-existing issue, but does this logic spuriously set the firmware
state to booted on an AW loss? When AW access is lost, the MMIO read for the
interrupt status will return 0xFFFFFFFF, which has JOB_INT_GLOBAL_IF set.
This would incorrectly flag the firmware as booted during early execution.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260922204535.2850094-1-karunika.choo@arm.com?part=25
next prev parent reply other threads:[~2026-09-22 21:14 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 20:44 [PATCH v1 00/27] drm/panthor: Add Mali v15 virtualization support Karunika Choo
2026-09-22 20:44 ` [PATCH v1 01/27] drm/panthor: Ignore -EOPNOTSUPP for shader-present nvmem lookup Karunika Choo
2026-09-22 20:44 ` [PATCH v1 02/27] drm/panthor: Move register access helpers out of panthor_device.h Karunika Choo
2026-09-22 20:54 ` sashiko-bot
2026-09-22 20:44 ` [PATCH v1 03/27] drm/panthor: Parse and store GPU_ID fields Karunika Choo
2026-09-22 20:56 ` sashiko-bot
2026-09-22 20:44 ` [PATCH v1 04/27] drm/panthor: Add 64-bit GPU_ID decoding for v15 GPUs Karunika Choo
2026-09-22 21:01 ` sashiko-bot
2026-09-22 23:23 ` Deborah Brouwer
2026-09-22 20:44 ` [PATCH v1 05/27] drm/panthor: Move register base offsets to the HW description Karunika Choo
2026-09-22 20:45 ` [PATCH v1 06/27] drm/panthor: Derive MMU AS register addresses from base and stride Karunika Choo
2026-09-22 21:00 ` sashiko-bot
2026-09-22 20:45 ` [PATCH v1 07/27] dt-bindings: gpu: mali-valhall-csf: Add Mali Gen5 AM compatible Karunika Choo
2026-09-28 10:02 ` Krzysztof Kozlowski
2026-09-22 20:45 ` [PATCH v1 08/27] drm/panthor: Add Mali v15 hardware support Karunika Choo
2026-09-22 20:58 ` sashiko-bot
2026-09-22 20:45 ` [PATCH v1 09/27] drm/panthor: Skip devfreq when no OPP table is present Karunika Choo
2026-09-22 20:45 ` [PATCH v1 10/27] dt-bindings: gpu: panthor: Document panthor-system bindings Karunika Choo
2026-09-22 20:56 ` sashiko-bot
2026-09-28 10:05 ` Krzysztof Kozlowski
2026-09-22 20:45 ` [PATCH v1 11/27] drm/panthor: Add AM_SYSTEM platform driver Karunika Choo
2026-09-22 20:59 ` sashiko-bot
2026-09-22 20:45 ` [PATCH v1 12/27] dt-bindings: gpu: panthor: Document panthor-arbitration bindings Karunika Choo
2026-09-22 20:59 ` sashiko-bot
2026-09-28 10:06 ` Krzysztof Kozlowski
2026-09-22 20:45 ` [PATCH v1 13/27] drm/panthor: Add AM_PARTITION_CONTROL support Karunika Choo
2026-09-22 20:57 ` sashiko-bot
2026-09-22 20:45 ` [PATCH v1 14/27] drm/panthor: Add AM message helpers Karunika Choo
2026-09-22 20:58 ` sashiko-bot
2026-09-22 20:45 ` [PATCH v1 15/27] drm/panthor: Add AM_RESOURCE_GROUP support Karunika Choo
2026-09-22 20:56 ` sashiko-bot
2026-09-22 20:45 ` [PATCH v1 16/27] drm/panthor: Add arbitration scheduler Karunika Choo
2026-09-22 21:00 ` sashiko-bot
2026-09-22 20:45 ` [PATCH v1 17/27] drm/panthor: Route arbitration events Karunika Choo
2026-09-22 21:04 ` sashiko-bot
2026-09-22 20:45 ` [PATCH v1 18/27] dt-bindings: gpu: panthor: Document AW assignment DT property Karunika Choo
2026-09-22 20:57 ` sashiko-bot
2026-09-28 10:06 ` Krzysztof Kozlowski
2026-09-22 20:45 ` [PATCH v1 19/27] drm/panthor: Add AW assignment tracking Karunika Choo
2026-09-22 20:45 ` [PATCH v1 20/27] drm/panthor: Handle partition control INVALID_COMMAND interrupt Karunika Choo
2026-09-22 21:04 ` sashiko-bot
2026-09-22 20:45 ` [PATCH v1 21/27] drm/panthor: Request AW to yield GPU access on idle Karunika Choo
2026-09-22 21:07 ` sashiko-bot
2026-09-22 20:45 ` [PATCH v1 22/27] drm/panthor: Add access-window support Karunika Choo
2026-09-22 21:05 ` sashiko-bot
2026-09-22 20:45 ` [PATCH v1 23/27] drm/panthor: Synchronize HW component PM transitions Karunika Choo
2026-09-22 20:45 ` [PATCH v1 24/27] drm/panthor: Route HW component PM through access windows Karunika Choo
2026-09-22 21:06 ` sashiko-bot
2026-09-22 20:45 ` [PATCH v1 25/27] drm/panthor: Tolerate access-window loss during HW waits Karunika Choo
2026-09-22 21:14 ` sashiko-bot [this message]
2026-09-22 20:45 ` [PATCH v1 26/27] drm/panthor: Prevent missed post-yield cleanup due to reset Karunika Choo
2026-09-22 21:12 ` sashiko-bot
2026-09-22 20:45 ` [PATCH v1 27/27] drm/panthor: Release GPU access immediately for out-of-band grants Karunika Choo
2026-09-22 21:06 ` sashiko-bot
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=20260922211430.9FB381F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=karunika.choo@arm.com \
--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