dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Adrián Larumbe" <adrian.larumbe@collabora.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v11 08/15] drm/panfrost: Move all DRM device initialisation into device_init()
Date: Fri, 25 Sep 2026 18:58:26 +0000	[thread overview]
Message-ID: <20260925185826.AD2BC1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260925-claude-fixes-v11-8-0dbf5a58e7ce@collabora.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] pm_runtime: usage_count corruption on early probe failure
--

commit 83a4c1b15f0bb7a999d8fbc11545b9b267d7fbdf
Author: Adrián Larumbe <adrian.larumbe@collabora.com>

drm/panfrost: Move all DRM device initialisation into device_init()

This commit moves DRM device registration and runtime PM setup from
panfrost_probe() into panfrost_device_init(), and consolidates the
cleanup path into panfrost_device_fini().

> diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c
> index 9f2b1967a3984..b8094c0d12528 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_device.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_device.c

[ ... ]

> @@ -311,11 +343,22 @@ int panfrost_device_init(struct panfrost_device *pfdev)
>  	panfrost_reset_fini(pfdev);
>  out_pm_domain:
>  	panfrost_pm_domain_fini(pfdev);
> +
> +	if (pm_runtime_active(pfdev->base.dev)) {
> +		pm_runtime_set_suspended(pfdev->base.dev);
> +		pm_runtime_put_noidle(pfdev->base.dev);
> +	}
> +

[Severity: High]
Can this catch-all conditional block cause a PM runtime usage_count corruption
on early probe failures?

If sysfs power/control is set to 'on' (e.g., via udev rules before probe),
pm_runtime_forbid() increments the usage_count to 1.

If the driver then fails early in panfrost_device_init() (such as a probe
deferral during panfrost_clk_init()), pm_runtime_enable() has not been called
yet. This leaves dev->power.disable_depth at 1, which inherently causes
pm_runtime_active() to return true.

This would cause the error path to incorrectly assume the driver acquired the
PM reference, calling pm_runtime_put_noidle() and erroneously decrementing
the usage_count to 0.

When userspace later sets power/control to 'auto', pm_runtime_allow() would
decrement the usage_count again, underflowing it to -1 and permanently breaking
runtime PM for the device.

>  	return err;
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260925-claude-fixes-v11-0-0dbf5a58e7ce@collabora.com?part=8

  reply	other threads:[~2026-09-25 18:58 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25 18:45 [PATCH v11 00/15] Collection of fixes for Panfrost: Perfcnt, RPM, refactorings Adrián Larumbe
2026-09-25 18:45 ` [PATCH v11 01/15] drm/panfrost: Move shrinker initialization and unplug one level down Adrián Larumbe
2026-09-25 18:45 ` [PATCH v11 02/15] drm/panfrost: Move lock and modparam initialisations into their subsystems Adrián Larumbe
2026-09-25 18:45 ` [PATCH v11 03/15] drm/panfrost: Move debugfs initialisation to relevant subsystems Adrián Larumbe
2026-09-25 18:45 ` [PATCH v11 04/15] drm/panfrost: Skip NULL checks for clock enable/disabling Adrián Larumbe
2026-09-25 18:45 ` [PATCH v11 05/15] drm/panfrost: Consolidate device clock management and reset Adrián Larumbe
2026-09-25 18:57   ` sashiko-bot
2026-09-25 18:45 ` [PATCH v11 06/15] drm/panfrost: Fix PM refcnt and autosuspend issues at device probe/remove Adrián Larumbe
2026-09-25 18:57   ` sashiko-bot
2026-09-25 18:45 ` [PATCH v11 07/15] drm/panfrost: Explicitly enable MMU interrupts at device init Adrián Larumbe
2026-09-25 18:45 ` [PATCH v11 08/15] drm/panfrost: Move all DRM device initialisation into device_init() Adrián Larumbe
2026-09-25 18:58   ` sashiko-bot [this message]
2026-09-25 19:45   ` Adrián Larumbe
2026-09-25 18:45 ` [PATCH v11 09/15] drm/panfrost: Add warning messages to fatal error conditions Adrián Larumbe
2026-09-25 18:45 ` [PATCH v11 10/15] drm/panfrost: Add debugfs knob for manually triggering a GPU reset Adrián Larumbe
2026-09-25 18:45 ` [PATCH v11 11/15] drm/panfrost: Move perfcnt GPU disable sequence into a helper Adrián Larumbe
2026-09-25 18:45 ` [PATCH v11 12/15] drm/panfrost: Skip cache flush/invalidate when enabling perfcnt Adrián Larumbe
2026-09-25 18:45 ` [PATCH v11 13/15] drm/panfrost: Avoid cache flush after perfcnt sample in fully coherent systems Adrián Larumbe
2026-09-25 18:45 ` [PATCH v11 14/15] drm/panfrost: Introduce a reset lock Adrián Larumbe
2026-09-25 18:45 ` [PATCH v11 15/15] drm/panfrost: Fix races between perfcnt and reset sequence Adrián Larumbe
2026-09-25 19:02   ` sashiko-bot
2026-09-25 20:29   ` Adrián Larumbe

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=20260925185826.AD2BC1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=adrian.larumbe@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox