Skip to contentSkip to conversation

FAILED: patch "[PATCH] drm/amdgpu: Fix runtime PM leak in" failed to apply to 5.15-stable tree

PATCH New [email protected] 2 participants 2 messages Sep 29

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x 2b86ab1bd6673c525adda88819d7658ba9e784ec
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026092928-heading-septic-a26f@gregkh' --subject-prefix 'PATCH 5.15.y' 'HEAD^..'

Possible dependencies:

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 2b86ab1bd6673c525adda88819d7658ba9e784ec Mon Sep 17 00:00:00 2001
From: Wentao Liang <[email protected]>
Date: Wed, 16 Sep 2026 09:58:05 +0000
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")
(cherry picked from commit ec30a576c2d4c0364549e6c04218f50704ef56c8)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3 -1
index 132d054900b5..aca1a8045afa 100644
@@ -1780,8 +1780,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++) {
maintainer
#1 lore raw

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

From: Wentao Liang <[email protected]>

[ Upstream commit 2b86ab1bd6673c525adda88819d7658ba9e784ec ]

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")
(cherry picked from commit ec30a576c2d4c0364549e6c04218f50704ef56c8)
[ Adapted `down_write_killable(&adev->reset_domain->sem)` to `down_read_killable(&adev->reset_sem)`. ]
---
 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 49711776b3516..944ecf780781e 100644
@@ -1140,8 +1140,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_read_killable(&adev->reset_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.53.0