Skip to contentSkip to conversation

drm/amdgpu: Fix runtime PM leak in amdgpu_debugfs_test_ib_show()

PATCH Applied Wentao Liang 2 participants 2 messages Sep 16

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3 -1
index 092fd3309099..adc0252f6400 100644
@@ -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++) {
Signature · 1 line
2.34.1
maintainer Applied
#1 lore raw

AMD General

Applied. Thanks!

Quoted 49 lines

-----Original Message-----
From: Wentao Liang <[email protected]>
Sent: Wednesday, September 16, 2026 5:58 AM
To: Li, Dennis <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; [email protected]; Koenig, Christian <[email protected]>; [email protected]; linux- [email protected]; Liu, Monk <[email protected]>; [email protected]; Wentao Liang <[email protected]>; [email protected]
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")

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3 -1
index 092fd3309099..adc0252f6400 100644
@@ -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