Stop the scheduler before releasing the PTL disable request to ensure the GPU is quiescent during the PTL state transition. This prevents potential queue preemption failures and GPU resets caused by modifying PTL state while waves are executing
v1->v2: only stop/start the scheduler when the PTL state actually needs to transition(Yifan) Signed-off-by: Perry Yuan <[email protected]> Reviewed-by: Yifan Zhang <[email protected]> --- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c index 6457c5703f99..6fa8cff55a32 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c @@ -1831,7 +1831,11 @@ int kfd_ptl_disable_release(struct kfd_process_device *pdd, goto out; if (atomic_dec_return(&adev->psp.ptl_disable_ref) == 0) { + if (adev->kfd.init_complete) + amdgpu_amdkfd_stop_sched(adev, pdd->dev->node_id); ret = kfd_ptl_control(pdd, true); + if (adev->kfd.init_complete) + amdgpu_amdkfd_start_sched(adev, pdd->dev->node_id); if (ret) { atomic_inc(&adev->psp.ptl_disable_ref); dev_warn(pdd->dev->adev->dev, @@ -1839,6 +1843,7 @@ int kfd_ptl_disable_release(struct kfd_process_device *pdd, goto out; } } + pdd->ptl_disable_req = false; out: -- 2.34.1
