RE: [PATCH] drm/amdgpu: Fix runtime PM leak in amdgpu_debugfs_test_ib_show()

From: Deucher, Alexander

Date: Wed Sep 16 2026 - 10:33:45 EST


AMD General

Applied. Thanks!

> -----Original Message-----
> From: Wentao Liang <vulab@xxxxxxxxxxx>
> Sent: Wednesday, September 16, 2026 5:58 AM
> To: Li, Dennis <Dennis.Li@xxxxxxx>
> Cc: airlied@xxxxxxxxx; Deucher, Alexander <Alexander.Deucher@xxxxxxx>;
> amd-gfx@xxxxxxxxxxxxxxxxxxxxx; Koenig, Christian
> <Christian.Koenig@xxxxxxx>; dri-devel@xxxxxxxxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; Liu, Monk <Monk.Liu@xxxxxxx>; simona@xxxxxxxx;
> Wentao Liang <vulab@xxxxxxxxxxx>; stable@xxxxxxxxxxxxxxx
> Subject: [PATCH] drm/amdgpu: Fix runtime PM leak in
> amdgpu_debugfs_test_ib_show()
>
> amdgpu_debugfs_test_ib_show() resumes the device with
> pm_runtime_get_sync() before taking the reset domain semaphore with
> down_write_killable(). If the write lock acquisition is interrupted, the function
> returns without calling pm_runtime_put_autosuspend(), leaking the runtime
> PM reference acquired for the device and keeping the GPU awake.
>
> Drop the runtime PM reference on the interrupted down_write_killable() error
> path before returning.
>
> Fixes: 6049db43d6dd ("drm/amdgpu: change reset lock from mutex to
> rw_semaphore")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> index 092fd3309099..adc0252f6400 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> @@ -1764,8 +1764,10 @@ static int amdgpu_debugfs_test_ib_show(struct
> seq_file *m, void *unused)
>
> /* Avoid accidently unparking the sched thread during GPU reset */
> r = down_write_killable(&adev->reset_domain->sem);
> - if (r)
> + if (r) {
> + pm_runtime_put_autosuspend(dev->dev);
> return r;
> + }
>
> /* hold on the scheduler */
> for (i = 0; i < AMDGPU_MAX_RINGS; i++) {
> --
> 2.34.1