All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] drm/amdgpu: keep PTL disable requests across GPU reset and resume
@ 2026-12-01  9:00 Perry Yuan
  2026-12-01  9:00 ` [PATCH 2/3] drm/amdkfd: Fix leaked PTL disable request on process exit Perry Yuan
  2026-12-01  9:00 ` [PATCH 3/3] drm/ttm: Narrow the eviction lock scope when adding move fences Perry Yuan
  0 siblings, 2 replies; 5+ messages in thread
From: Perry Yuan @ 2026-12-01  9:00 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alexander.Deucher, Christian.Koenig, Yifan1.Zhang, perry.yuan

gfx_v9_4_3_perf_monitor_ptl_init() sets ptl->disable_ref to 0 every
time it runs. Besides the first init, that is late_init after a GPU
reset and on resume, and hw_fini on suspend. The KFD processes holding
a PTL disable request survive all of these, and so do their
pdd->ptl_disable_req and the AMDGPU_PTL_DISABLE_PROFILER bit.

If a process holds the profiler lock across a GPU reset, its release
afterwards, by unlock, exit or kill, takes disable_ref from 0 to -1.
The 1 -> 0 transition that clears the PROFILER bit and enables PTL
never happens, neither for this process nor for later profilers, which
move the counter between -1 and 0. A write to ptl_enable is blocked by
the PROFILER bit. PTL stays disabled until amdgpu is reloaded.

disable_ref starts at 0 in the zeroed amdgpu_device and is balanced by
the request/release pairs, so there is nothing to reset. Drop the reset
so that the counter keeps matching the requests that are held.

Fixes: dd61e27535a6 ("drm/amdkfd: Add PTL control IOCTL Option and unify refcount logic")
Signed-off-by: Perry Yuan <perry.yuan@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
index e140430ce059..78ce980ac319 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
@@ -2463,7 +2463,11 @@ static int gfx_v9_4_3_perf_monitor_ptl_init(struct amdgpu_device *adev, bool ena
 
 	ptl->hw_supported_state = AMDGPU_PTL_HW_SUPPORTED;
 
-	atomic_set(&ptl->disable_ref, 0);
+	/*
+	 * disable_ref counts the KFD processes holding a PTL disable request.
+	 * They survive GPU reset and suspend/resume, so it must not be reset
+	 * here.
+	 */
 	if (!enable && !amdgpu_in_reset(adev) && !adev->in_suspend) {
 		dev_dbg(adev->dev,
 			"PTL disabled (amdgpu.ptl=%d)\
-- 
2.34.1


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

end of thread, other threads:[~2026-12-01 13:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01  9:00 [PATCH 1/3] drm/amdgpu: keep PTL disable requests across GPU reset and resume Perry Yuan
2026-12-01  9:00 ` [PATCH 2/3] drm/amdkfd: Fix leaked PTL disable request on process exit Perry Yuan
2026-12-01  9:00 ` [PATCH 3/3] drm/ttm: Narrow the eviction lock scope when adding move fences Perry Yuan
2026-12-01  9:07   ` sashiko-bot
2026-12-01 13:40   ` Christian König

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.