From: sashiko-bot@kernel.org
To: "Daniel Stone" <daniels@collabora.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/panthor: Delegate neural power domain to CSF when present
Date: Thu, 15 Oct 2026 13:18:19 +0000 [thread overview]
Message-ID: <sashiko-outbox-172908@kernel.org> (raw)
In-Reply-To: <20261015131301.711153-3-daniels@collabora.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Medium] panthor: resource leak due to incorrect LIFO label ordering in error path
- [Medium] panthor: incorrect hardware teardown order and duplicate TILER power-off
- [Low] panthor: build failure due to returning a label identifier
--
commit e4aa5571cda90f71765f06232acbfee948feed3e
Author: Daniel Stone <daniels@collabora.com>
drm/panthor: Delegate neural power domain to CSF when present
As the neural power domain is a child of the L2 power domain, control
over the L2 domain cannot be delegated to CSF unless the neural domain
has first been delegated. Given that we delegate all power control on
v14+, this eventually causes a hard lock-up and/or firmware OOPS when we
try to power on anything due to the inconsistent delegation state.
Fixes: ee4f9af07933 ("drm/panthor: Implement L2 power on/off via PWR_CONTROL")
> diff --git a/drivers/gpu/drm/panthor/panthor_pwr.c b/drivers/gpu/drm/panthor/panthor_pwr.c
> index dd7b6ef8ea209..23954c863cc26 100644
> --- a/drivers/gpu/drm/panthor/panthor_pwr.c
> +++ b/drivers/gpu/drm/panthor/panthor_pwr.c
[ ... ]
> @@ -405,9 +418,15 @@ static int panthor_pwr_delegate_domains(struct panthor_device *ptdev)
> if (!ptdev->pwr)
> return 0;
>
> + if (panthor_hw_has_neural(ptdev)) {
> + ret = delegate_domain(ptdev, PWR_COMMAND_DOMAIN_NEURAL);
> + if (ret)
> + return ret;
> + }
> +
> ret = delegate_domain(ptdev, PWR_COMMAND_DOMAIN_SHADER);
> if (ret)
> - return ret;
> + return err_retract_neural;
[Severity: Low]
Will this cause a build failure?
Because err_retract_neural is a label and not a declared variable, returning it
is invalid C syntax and results in a compiler error. Should this be a
goto err_retract_neural; instead?
> ret = delegate_domain(ptdev, PWR_COMMAND_DOMAIN_TILER);
> if (ret)
> @@ -415,6 +434,8 @@ static int panthor_pwr_delegate_domains(struct panthor_device *ptdev)
>
> return 0;
>
> +err_retract_neural:
> + retract_domain(ptdev, PWR_COMMAND_DOMAIN_NEURAL);
> err_retract_shader:
> retract_domain(ptdev, PWR_COMMAND_DOMAIN_SHADER);
>
[Severity: Medium]
Does this error path leak the NEURAL domain delegation?
The domains are delegated in the order: NEURAL -> SHADER -> TILER. On failure,
they typically must be retracted in reverse order. However, the error labels
are ordered with err_retract_neural: placed before err_retract_shader:.
If TILER delegation fails, the code executes goto err_retract_shader;, retracts
the SHADER domain, and immediately returns, bypassing the err_retract_neural:
block above it.
Should the labels be swapped to correctly implement the teardown?
[ ... ]
> @@ -530,6 +552,13 @@ void panthor_pwr_l2_power_off(struct panthor_device *ptdev)
> * host control to be powered down in the right order before powering
> * down the L2.
> */
> + if (has_neural &&
> + panthor_pwr_domain_force_off(ptdev, PWR_COMMAND_DOMAIN_NEURAL))
> + return;
> +
> + if (panthor_pwr_domain_force_off(ptdev, PWR_COMMAND_DOMAIN_TILER))
> + return;
> +
> if (panthor_pwr_domain_force_off(ptdev, PWR_COMMAND_DOMAIN_TILER))
> return;
>
[Severity: Medium]
Does this execute an incorrect hardware teardown order and duplicate the TILER
power-off?
The NEURAL power-off block is placed above the existing TILER and SHADER blocks,
while also duplicating the TILER block. This causes
panthor_pwr_domain_force_off(ptdev, PWR_COMMAND_DOMAIN_TILER) to execute twice.
The execution sequence becomes NEURAL -> TILER -> TILER -> SHADER. This violates
the strict teardown order required by the hardware (delegation is NEURAL ->
SHADER -> TILER, so teardown must be TILER -> SHADER -> NEURAL).
Could this lead to invalid hardware states or timeouts?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261015131301.711153-1-daniels@collabora.com?part=2
next prev parent reply other threads:[~2026-10-15 13:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 13:10 [PATCH 0/2] drm/panthor: Consistently delegate shader power Daniel Stone
2026-10-15 13:10 ` [PATCH 1/2] drm/panthor: Add neural-engine presence and power bits for v14+ Daniel Stone
2026-10-15 13:10 ` [PATCH 2/2] drm/panthor: Delegate neural power domain to CSF when present Daniel Stone
2026-10-15 13:18 ` sashiko-bot [this message]
2026-10-15 13:45 ` Daniel Stone
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-172908@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=daniels@collabora.com \
--cc=dri-devel@lists.freedesktop.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.