drm/amdgpu/userq: ignore duplicate BO locks when counting wait fences
authorSunil Khatri <sunil.khatri@amd.com>
Thu, 13 Aug 2026 08:32:09 +0000 (14:02 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 19 Aug 2026 14:03:30 +0000 (10:03 -0400)
amdgpu_userq_wait_count_fences() calls drm_exec_init() without
DRM_EXEC_IGNORE_DUPLICATES. When the same GEM object appears more than
once across the read/write BO handle lists submitted by userspace,
drm_exec_lock_obj() returns -EALREADY the second time it locks that
object, which aborts the fence-counting pass instead of treating the
repeat as a no-op.

Add DRM_EXEC_IGNORE_DUPLICATES so duplicate objects are silently
skipped on the second lock attempt.

Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c

index cd0bd01..981cb1d 100644 (file)
@@ -643,7 +643,7 @@ amdgpu_userq_wait_count_fences(struct drm_file *filp,
        /* TODO: It is actually not necessary to lock them */
        num_read_bo_handles = wait_info->num_bo_read_handles;
        num_write_bo_handles = wait_info->num_bo_write_handles;
-       drm_exec_init(&exec, DRM_EXEC_INTERRUPTIBLE_WAIT,
+       drm_exec_init(&exec, DRM_EXEC_INTERRUPTIBLE_WAIT | DRM_EXEC_IGNORE_DUPLICATES,
                      num_read_bo_handles + num_write_bo_handles);
 
        drm_exec_until_all_locked(&exec) {