mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/panfrost: fix runtime PM leak on remove
@ 2026-06-09  7:34 Ruoyu Wang
  2026-06-09 15:37 ` Adrián Larumbe
  0 siblings, 1 reply; 2+ messages in thread
From: Ruoyu Wang @ 2026-06-09  7:34 UTC (permalink / raw)
  To: Boris Brezillon, Rob Herring, Steven Price, Adrián Larumbe
  Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, Tomeu Vizoso, dri-devel,
	linux-kernel, Ruoyu Wang

pm_runtime_get_sync() increments the runtime PM usage counter even when it
returns an error. panfrost_remove() uses it to keep the GPU active while
runtime PM is disabled and the device is finalized, but the usage counter
is not dropped afterwards.

Balance the get with pm_runtime_put_noidle() after disabling runtime PM.
This drops the extra usage count without requesting a runtime suspend,
preserving the existing teardown sequence that avoids suspending after
panfrost_device_fini().

Fixes: 876b15d2c88d ("drm/panfrost: Fix module unload")
Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
---
 drivers/gpu/drm/panfrost/panfrost_drv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
index 074c0995ddc26..d78ea7d4d099e 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -1027,6 +1027,7 @@ static void panfrost_remove(struct platform_device *pdev)
 
 	pm_runtime_get_sync(pfdev->base.dev);
 	pm_runtime_disable(pfdev->base.dev);
+	pm_runtime_put_noidle(pfdev->base.dev);
 	panfrost_device_fini(pfdev);
 	pm_runtime_set_suspended(pfdev->base.dev);
 }
-- 
2.51.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/panfrost: fix runtime PM leak on remove
  2026-06-09  7:34 [PATCH] drm/panfrost: fix runtime PM leak on remove Ruoyu Wang
@ 2026-06-09 15:37 ` Adrián Larumbe
  0 siblings, 0 replies; 2+ messages in thread
From: Adrián Larumbe @ 2026-06-09 15:37 UTC (permalink / raw)
  To: Ruoyu Wang
  Cc: Boris Brezillon, Rob Herring, Steven Price, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Tomeu Vizoso, dri-devel, linux-kernel

Hi Ruoyu, thanks for the patch.

A similar fix is being discussed together with a bunch of other patches at:
https://lore.kernel.org/dri-devel/20260604-claude-fixes-v2-6-57c6bd4c1655@collabora.com/

On 09.06.2026 15:34, Ruoyu Wang wrote:
> pm_runtime_get_sync() increments the runtime PM usage counter even when it
> returns an error. panfrost_remove() uses it to keep the GPU active while
> runtime PM is disabled and the device is finalized, but the usage counter
> is not dropped afterwards.
> 
> Balance the get with pm_runtime_put_noidle() after disabling runtime PM.
> This drops the extra usage count without requesting a runtime suspend,
> preserving the existing teardown sequence that avoids suspending after
> panfrost_device_fini().
> 
> Fixes: 876b15d2c88d ("drm/panfrost: Fix module unload")
> Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
> ---
>  drivers/gpu/drm/panfrost/panfrost_drv.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
> index 074c0995ddc26..d78ea7d4d099e 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_drv.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
> @@ -1027,6 +1027,7 @@ static void panfrost_remove(struct platform_device *pdev)
>  
>  	pm_runtime_get_sync(pfdev->base.dev);
>  	pm_runtime_disable(pfdev->base.dev);
> +	pm_runtime_put_noidle(pfdev->base.dev);
>  	panfrost_device_fini(pfdev);
>  	pm_runtime_set_suspended(pfdev->base.dev);
>  }
> -- 
> 2.51.0


Adrian Larumbe

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-09 15:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-09  7:34 [PATCH] drm/panfrost: fix runtime PM leak on remove Ruoyu Wang
2026-06-09 15:37 ` Adrián Larumbe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®