Skip to content

Commit b8ae264

Browse files
Jie1zhangalexdeucher
authored andcommitted
drm/amdgpu: Fix fence signaling race condition in userqueue
This commit fixes a potential race condition in the userqueue fence signaling mechanism by replacing dma_fence_is_signaled_locked() with dma_fence_is_signaled(). The issue occurred because: 1. dma_fence_is_signaled_locked() should only be used when holding the fence's individual lock, not just the fence list lock 2. Using the locked variant without the proper fence lock could lead to double-signaling scenarios: - Hardware completion signals the fence - Software path also tries to signal the same fence By using dma_fence_is_signaled() instead, we properly handle the locking hierarchy and avoid the race condition while still maintaining the necessary synchronization through the fence_list_lock. v2: drop the comment (Christian) Reviewed-by: Christian König <[email protected]> Signed-off-by: Jesse Zhang <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 45da20e commit b8ae264

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ static int amdgpu_userq_fence_create(struct amdgpu_usermode_queue *userq,
284284

285285
/* Check if hardware has already processed the job */
286286
spin_lock_irqsave(&fence_drv->fence_list_lock, flags);
287-
if (!dma_fence_is_signaled_locked(fence))
287+
if (!dma_fence_is_signaled(fence))
288288
list_add_tail(&userq_fence->link, &fence_drv->fences);
289289
else
290290
dma_fence_put(fence);

0 commit comments

Comments
 (0)