aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPrike Liang <[email protected]>2025-04-30 02:34:14 +0000
committerAlex Deucher <[email protected]>2025-05-22 16:00:44 +0000
commitb2c11e27080d8556664c20c30ca3527ffa99bec4 (patch)
tree494cd0d19a38f66d83c97e84b050cea74f0d10a5
parentdrm/amdkfd: Change svm_range_get_info return type (diff)
downloadkernel-b2c11e27080d8556664c20c30ca3527ffa99bec4.tar.gz
kernel-b2c11e27080d8556664c20c30ca3527ffa99bec4.zip
drm/amdgpu: lock the eviction fence for wq signals it
Lock and refer to the eviction fence before the eviction fence schedules work queue tries to signal it. Suggested-by: Christian König <[email protected]> Signed-off-by: Prike Liang <[email protected]> Acked-by: Alex Deucher <[email protected]> Reviewed-by: Arvind Yadav <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
index 73b629b5f56f..8b919ad3af29 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
@@ -108,13 +108,22 @@ amdgpu_eviction_fence_suspend_worker(struct work_struct *work)
struct amdgpu_eviction_fence *ev_fence;
mutex_lock(&uq_mgr->userq_mutex);
+ spin_lock(&evf_mgr->ev_fence_lock);
ev_fence = evf_mgr->ev_fence;
- if (!ev_fence)
+ if (ev_fence)
+ dma_fence_get(&ev_fence->base);
+ else
goto unlock;
+ spin_unlock(&evf_mgr->ev_fence_lock);
amdgpu_userq_evict(uq_mgr, ev_fence);
+ mutex_unlock(&uq_mgr->userq_mutex);
+ dma_fence_put(&ev_fence->base);
+ return;
+
unlock:
+ spin_unlock(&evf_mgr->ev_fence_lock);
mutex_unlock(&uq_mgr->userq_mutex);
}