From: sashiko-bot@kernel.org
To: "Karunika Choo" <karunika.choo@arm.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 20/28] drm/panthor: Handle partition control INVALID_COMMAND interrupt
Date: Tue, 10 Nov 2026 16:16:22 +0000 [thread overview]
Message-ID: <sashiko-outbox-207350@kernel.org> (raw)
In-Reply-To: <20261110153907.3241978-21-karunika.choo@arm.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/panthor: unassigned current_aw in window_open() breaks
recovery
- [Medium] drm/panthor: stale last_cmd on PART_STATE_RESET in
yield/close helpers
--
commit 94f33b60c028012f4fc4c4edbb429977e08e2557
Author: Karunika Choo <karunika.choo@arm.com>
drm/panthor: Handle partition control INVALID_COMMAND interrupt
This commit tracks the last sent partition command and handles
PART_INVALID_COMMAND interrupts by retrying rejected commands or
requesting scheduler recovery when the partition is open for a different
access window.
> diff --git a/drivers/gpu/drm/panthor/arbitration/panthor_partition_control.c b/drivers/gpu/drm/panthor/arbitration/panthor_partition_control.c
> index d8fdafbf31864..3b472403f49d1 100644
> --- a/drivers/gpu/drm/panthor/arbitration/panthor_partition_control.c
> +++ b/drivers/gpu/drm/panthor/arbitration/panthor_partition_control.c
[ ... ]
> @@ -128,8 +158,8 @@ static int yield_now(struct panthor_partition_control *pc)
> if (partition_state_get(pc) != PART_STATE_WINDOW_OPEN)
> return -EAGAIN;
>
> - gpu_write(pc->iomem, AM_PART_COMMAND,
> - AM_PART_SET_COMMAND(PART_CMD_YIELD_NOW));
> + partition_command_write(pc, AM_PART_SET_COMMAND(PART_CMD_YIELD_NOW),
> + pc->current_aw);
>
> return 0;
> }
> @@ -144,8 +174,8 @@ static int yield_idle(struct panthor_partition_control *pc)
> if (partition_state_get(pc) != PART_STATE_WINDOW_OPEN)
> return -EAGAIN;
>
> - gpu_write(pc->iomem, AM_PART_COMMAND,
> - AM_PART_SET_COMMAND(PART_CMD_YIELD_IDLE));
> + partition_command_write(pc, AM_PART_SET_COMMAND(PART_CMD_YIELD_IDLE),
> + pc->current_aw);
>
> return 0;
> }
> @@ -162,8 +192,8 @@ static int window_close(struct panthor_partition_control *pc)
>
> pc->closing = true;
>
> - gpu_write(pc->iomem, AM_PART_COMMAND,
> - AM_PART_SET_COMMAND(PART_CMD_CLOSE_WINDOW));
> + partition_command_write(pc, AM_PART_SET_COMMAND(PART_CMD_CLOSE_WINDOW),
> + pc->current_aw);
>
> return 0;
> }
[Severity: Medium]
Can a stale PART_CMD_OPEN_WINDOW in pc->last_cmd reopen the partition
after yield_now(), yield_idle(), or window_close() has already returned 0?
window_open() writes PART_CMD_OPEN_WINDOW, stores it in pc->last_cmd, and
returns 0 without waiting for AM_PART_STATE to leave PART_STATE_RESET. If
PART_CMD_OPEN_WINDOW is rejected while a previous reset is still finishing
(or before the hardware leaves PART_STATE_RESET) and the scheduler then
calls yield_now(), yield_idle(), or window_close(), those helpers see
partition_state_get(pc) == PART_STATE_RESET and return 0 without clearing
pc->last_cmd or scheduling retry_work:
drivers/gpu/drm/panthor/arbitration/panthor_partition_control.c:yield_now() {
guard(spinlock_irqsave)(&pc->lock);
if (partition_state_get(pc) == PART_STATE_RESET)
return 0;
When partition_handle_invalid_cmd() later runs for the rejected open
command, pc->last_cmd.cmd is still PART_CMD_OPEN_WINDOW and the partition
is not in PART_STATE_WINDOW_OPEN, so it re-issues PART_CMD_OPEN_WINDOW and
opens the access window after the yield or close already succeeded.
> @@ -188,8 +218,8 @@ static int window_open(struct panthor_partition_control *pc, u8 aw_id)
> return -EBUSY;
> }
>
> - gpu_write(pc->iomem, AM_PART_COMMAND,
> - AM_PART_SET_COMMAND(PART_CMD_OPEN_WINDOW) | AM_PART_SET_WINDOW(aw_id));
> + partition_command_write(pc, (AM_PART_SET_COMMAND(PART_CMD_OPEN_WINDOW) |
> + AM_PART_SET_WINDOW(aw_id)), aw_id);
>
> pc->current_aw = aw_id;
>
> @@ -201,10 +231,16 @@ static void partition_handle_reset_done(struct panthor_partition_control *pc)
> bool notify_stopped = false;
> int aw_id;
>
> + gpu_write(pc->iomem, AM_PART_IRQ_CLEAR, PART_RESET_DONE);
> +
> scoped_guard(spinlock_irqsave, &pc->lock) {
> aw_id = pc->current_aw;
> pc->current_aw = AW_UNASSIGNED;
>
> + /* invalidate last command */
> + pc->last_cmd.aw_id = AW_UNASSIGNED;
> + pc->last_cmd.cmd = 0;
> +
> /* RESET_DONE from CLOSE_WINDOW */
> if (pc->closing)
> pc->closing = false;
> @@ -216,6 +252,55 @@ static void partition_handle_reset_done(struct panthor_partition_control *pc)
> panthor_arbitration_on_stopped(dev_get_drvdata(pc->dev), aw_id);
> }
>
> +static void partition_handle_invalid_cmd(struct panthor_partition_control *pc)
> +{
> + bool on_err = false;
> + int aw_id;
> +
> + gpu_write(pc->iomem, AM_PART_IRQ_CLEAR, PART_INVALID_COMMAND);
> +
> + scoped_guard(spinlock_irqsave, &pc->lock) {
> + if (!pc->last_cmd.cmd)
> + return;
> +
> + if (pc->last_cmd.aw_id < 0)
> + return;
[Severity: Medium]
Does leaving pc->current_aw as AW_UNASSIGNED (-1) when window_open() finds
the partition in PART_STATE_WINDOW_OPEN prevent command retries and
scheduler recovery?
When window_open() sees PART_STATE_WINDOW_OPEN, it returns 0 (if
cur_aw == aw_id) or -EBUSY (if cur_aw != aw_id) before setting
pc->current_aw = aw_id:
drivers/gpu/drm/panthor/arbitration/panthor_partition_control.c:window_open() {
if (partition_state_get(pc) == PART_STATE_WINDOW_OPEN) {
u8 cur_aw = partition_aw_get(pc);
if (cur_aw == aw_id)
return 0;
dev_warn(pc->dev,
"%s: OPEN_WINDOW(%u): Already opened for aw=%u, state=%u. Closing...",
pc->name, aw_id, cur_aw, partition_state_get(pc));
return -EBUSY;
}
On -EBUSY, arb_sched_grant_locked() queues sched->reset_work, which calls
arb_sched_force_close_locked() -> arb_sched_close_locked() ->
window_close(). Because pc->current_aw is still -1, window_close() (as
well as yield_now() and yield_idle() when cur_aw == aw_id) records
pc->last_cmd.aw_id = -1. If that command raises PART_INVALID_COMMAND,
partition_handle_invalid_cmd() aborts at pc->last_cmd.aw_id < 0 without
retrying it. Furthermore, when PART_RESET_DONE later fires,
partition_handle_reset_done() sees aw_id < 0 and skips
panthor_arbitration_on_stopped(), leaving the scheduler stuck in
ARB_SCHED_PHASE_LOST.
In addition, panthor_partition_control_term() calls
partition_irq_suspend() before window_close() and partition_state_wait(),
which masks PART_INVALID_COMMAND so a rejected close command cannot be
retried during teardown.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261110153907.3241978-1-karunika.choo@arm.com?part=20
next prev parent reply other threads:[~2026-11-10 16:16 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 15:38 [PATCH v2 00/28] drm/panthor: Add Mali v15 virtualization support Karunika Choo
2026-11-10 15:38 ` [PATCH v2 01/28] drm/panthor: Ignore -EOPNOTSUPP for shader-present nvmem lookup Karunika Choo
2026-11-10 15:38 ` [PATCH v2 02/28] drm/panthor: Rename neural accelerator feature macro to NX Karunika Choo
2026-11-10 15:47 ` sashiko-bot
2026-11-10 15:38 ` [PATCH v2 03/28] drm/panthor: Move register access helpers out of panthor_device.h Karunika Choo
2026-11-10 15:38 ` [PATCH v2 04/28] drm/panthor: Parse and store GPU_ID fields Karunika Choo
2026-11-10 15:38 ` [PATCH v2 05/28] drm/panthor: Add 64-bit GPU_ID decoding for v15 GPUs Karunika Choo
2026-11-10 15:38 ` [PATCH v2 06/28] drm/panthor: Move register base offsets to the HW description Karunika Choo
2026-11-10 15:38 ` [PATCH v2 07/28] drm/panthor: Derive MMU AS register addresses from base and stride Karunika Choo
2026-11-10 15:38 ` [PATCH v2 08/28] dt-bindings: gpu: mali-gen5-am: Add Mali 5th-Gen AM schema Karunika Choo
2026-11-11 8:33 ` Krzysztof Kozlowski
2026-11-11 10:32 ` Karunika Choo
2026-11-11 10:41 ` Krzysztof Kozlowski
2026-11-11 11:04 ` Karunika Choo
2026-11-12 8:36 ` Krzysztof Kozlowski
2026-11-10 15:38 ` [PATCH v2 09/28] drm/panthor: Add Mali v15 hardware support Karunika Choo
2026-11-10 15:38 ` [PATCH v2 10/28] drm/panthor: Skip devfreq when no OPP table is present Karunika Choo
2026-11-10 16:03 ` sashiko-bot
2026-11-10 15:38 ` [PATCH v2 11/28] dt-bindings: gpu: panthor: Document AM system bindings Karunika Choo
2026-11-11 8:29 ` Krzysztof Kozlowski
2026-11-11 10:43 ` Karunika Choo
2026-11-12 8:32 ` Krzysztof Kozlowski
2026-11-10 15:38 ` [PATCH v2 12/28] drm/panthor: Add AM_SYSTEM platform driver Karunika Choo
2026-11-10 15:57 ` sashiko-bot
2026-11-10 15:38 ` [PATCH v2 13/28] dt-bindings: gpu: panthor: Document panthor-arbitration bindings Karunika Choo
2026-11-10 15:38 ` [PATCH v2 14/28] drm/panthor: Add AM_PARTITION_CONTROL support Karunika Choo
2026-11-10 16:10 ` sashiko-bot
2026-11-11 5:43 ` kernel test robot
2026-11-10 15:38 ` [PATCH v2 15/28] drm/panthor: Add AM message helpers Karunika Choo
2026-11-10 15:38 ` [PATCH v2 16/28] drm/panthor: Add AM_RESOURCE_GROUP support Karunika Choo
2026-11-10 16:07 ` sashiko-bot
2026-11-11 8:30 ` kernel test robot
2026-11-10 15:38 ` [PATCH v2 17/28] drm/panthor: Add arbitration scheduler Karunika Choo
2026-11-10 16:05 ` sashiko-bot
2026-11-11 0:43 ` kernel test robot
2026-11-10 15:38 ` [PATCH v2 18/28] drm/panthor: Route arbitration events Karunika Choo
2026-11-10 16:19 ` sashiko-bot
2026-11-10 15:38 ` [PATCH v2 19/28] drm/panthor: Add AW assignment tracking Karunika Choo
2026-11-10 16:03 ` sashiko-bot
2026-11-10 15:38 ` [PATCH v2 20/28] drm/panthor: Handle partition control INVALID_COMMAND interrupt Karunika Choo
2026-11-10 16:16 ` sashiko-bot [this message]
2026-11-10 15:38 ` [PATCH v2 21/28] drm/panthor: Request AW to yield GPU access on idle Karunika Choo
2026-11-10 16:15 ` sashiko-bot
2026-11-10 15:38 ` [PATCH v2 22/28] drm/panthor: Add access-window support Karunika Choo
2026-11-10 16:20 ` sashiko-bot
2026-11-10 15:38 ` [PATCH v2 23/28] drm/panthor: Synchronize HW component PM transitions Karunika Choo
2026-11-10 16:23 ` sashiko-bot
2026-11-10 15:38 ` [PATCH v2 24/28] drm/panthor: Quiesce scheduler tick during system suspend Karunika Choo
2026-11-10 16:24 ` sashiko-bot
2026-11-10 15:38 ` [PATCH v2 25/28] drm/panthor: Route HW component PM through access windows Karunika Choo
2026-11-10 16:50 ` sashiko-bot
2026-11-10 15:38 ` [PATCH v2 26/28] drm/panthor: Tolerate access-window loss during HW waits Karunika Choo
2026-11-10 16:30 ` sashiko-bot
2026-11-10 15:38 ` [PATCH v2 27/28] drm/panthor: Prevent missed post-yield cleanup due to reset Karunika Choo
2026-11-10 16:44 ` sashiko-bot
2026-11-10 15:38 ` [PATCH v2 28/28] drm/panthor: Reset partitions before starting arbitration Karunika Choo
2026-11-10 16:22 ` 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=sashiko-outbox-207350@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 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.