The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Wachowski, Karol" <karol.wachowski@linux.intel.com>
To: Guangshuo Li <lgs201920130244@gmail.com>,
	Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>,
	Oded Gabbay <ogabbay@kernel.org>,
	Jeff Hugo <jeff.hugo@oss.qualcomm.com>,
	Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>,
	Simona Vetter <simona.vetter@ffwll.ch>,
	Krystian Pradzynski <krystian.pradzynski@linux.intel.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] accel/ivpu: fix usage_count leak when autosuspend_delay is negative
Date: Thu, 13 Aug 2026 09:12:49 +0200	[thread overview]
Message-ID: <4c656606-b91f-4e12-8e39-3b89ec0c13cd@linux.intel.com> (raw)
In-Reply-To: <20260807145416.2518999-1-lgs201920130244@gmail.com>

On 07-Aug-26 16:54, Guangshuo Li wrote:
> ivpu_pm_init() calls pm_runtime_use_autosuspend(), but the autosuspend
> setting is not disabled when the device is removed or when
> initialization fails after runtime PM setup.
> 
> When the autosuspend delay is negative, the runtime PM core increments
> usage_count to prevent runtime suspend. Without a matching
> pm_runtime_dont_use_autosuspend(), this reference is not dropped and
> usage_count remains unbalanced.
> 
> Call pm_runtime_dont_use_autosuspend() from ivpu_pm_disable() to clean
> up the autosuspend state during normal device teardown. Also undo the
> autosuspend setting when ivpu_boot() fails after ivpu_pm_init().
> 
> This issue was found by manual code inspection.
> 
> Fixes: 852be13f3bd3 ("accel/ivpu: Add PM support")
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>

Hello,

Thanks for the submission.

> ---
>   drivers/accel/ivpu/ivpu_drv.c | 4 +++-
>   drivers/accel/ivpu/ivpu_pm.c  | 1 +
>   2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/accel/ivpu/ivpu_drv.c b/drivers/accel/ivpu/ivpu_drv.c
> index 35e506074d5f..633c90e73f2c 100644
> --- a/drivers/accel/ivpu/ivpu_drv.c
> +++ b/drivers/accel/ivpu/ivpu_drv.c
> @@ -756,13 +756,15 @@ static int ivpu_dev_init(struct ivpu_device *vdev)
>   
>   	ret = ivpu_boot(vdev);
>   	if (ret)
> -		goto err_ipc_fini;
> +		goto err_pm_fini;

This leaves err_ipc_fini label unused, could you please remove that 
label below and keep both pm_runtime_dont_use_autosuspend(vdev->drm.dev) 
and ivpu_ipc_fini(vdev) under err_pm_fini.

Otherwise compiler will complain about unused label.
>   
>   	ivpu_job_done_consumer_init(vdev);
>   	ivpu_pm_enable(vdev);
>   
>   	return 0;
>   
> +err_pm_fini:
> +	pm_runtime_dont_use_autosuspend(vdev->drm.dev);
>   err_ipc_fini:

Remove err_ipc_fini here.

Once that gets fixed:
Reviewed-by: Karol Wachowski <karol.wachowski@linux.intel.com>

>   	ivpu_ipc_fini(vdev);
>   err_fw_fini:
> diff --git a/drivers/accel/ivpu/ivpu_pm.c b/drivers/accel/ivpu/ivpu_pm.c
> index c1ce8329790e..20dc8ec7d70a 100644
> --- a/drivers/accel/ivpu/ivpu_pm.c
> +++ b/drivers/accel/ivpu/ivpu_pm.c
> @@ -445,6 +445,7 @@ void ivpu_pm_enable(struct ivpu_device *vdev)
>   
>   void ivpu_pm_disable(struct ivpu_device *vdev)
>   {
> +	pm_runtime_dont_use_autosuspend(vdev->drm.dev);
>   	pm_runtime_get_noresume(vdev->drm.dev);
>   	pm_runtime_forbid(vdev->drm.dev);
>   }



      reply	other threads:[~2026-08-13  7:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07 14:54 [PATCH] accel/ivpu: fix usage_count leak when autosuspend_delay is negative Guangshuo Li
2026-08-13  7:12 ` Wachowski, Karol [this message]

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=4c656606-b91f-4e12-8e39-3b89ec0c13cd@linux.intel.com \
    --to=karol.wachowski@linux.intel.com \
    --cc=andrzej.kacprowski@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jacek.lawrynowicz@linux.intel.com \
    --cc=jeff.hugo@oss.qualcomm.com \
    --cc=krystian.pradzynski@linux.intel.com \
    --cc=lgs201920130244@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ogabbay@kernel.org \
    --cc=simona.vetter@ffwll.ch \
    /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