]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu: add missing lock in amdgpu_benchmark_do_move
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Tue, 18 Nov 2025 14:15:04 +0000 (15:15 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 23 Feb 2026 19:16:30 +0000 (14:16 -0500)
Taking the entity lock is required to guarantee the ordering of
execution. The next commit will add a check that the lock is
held.

Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@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_benchmark.c

index 1cbba9803d314d95027142f8b9423b8d510176a5..98ccd7ab9e9a3303f1bf0e1f89687c85196d0d6e 100644 (file)
@@ -35,6 +35,7 @@ static int amdgpu_benchmark_do_move(struct amdgpu_device *adev, unsigned size,
        struct dma_fence *fence;
        int i, r;
 
+       mutex_lock(&adev->mman.default_entity.lock);
        stime = ktime_get();
        for (i = 0; i < n; i++) {
                r = amdgpu_copy_buffer(adev, &adev->mman.default_entity,
@@ -47,6 +48,7 @@ static int amdgpu_benchmark_do_move(struct amdgpu_device *adev, unsigned size,
                if (r)
                        goto exit_do_move;
        }
+       mutex_unlock(&adev->mman.default_entity.lock);
 
 exit_do_move:
        etime = ktime_get();