Skip to content

Commit 4fa9442

Browse files
peppsacalexdeucher
authored andcommitted
drm/amdgpu: add missing lock to amdgpu_ttm_access_memory_sdma
Users of ttm entities need to hold the gtt_window_lock before using them to guarantee proper ordering of jobs. Cc: stable@vger.kernel.org Fixes: cb5cc4f ("drm/amdgpu: improve debug VRAM access performance using sdma") 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>
1 parent 5427e32 commit 4fa9442

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,6 +1486,7 @@ static int amdgpu_ttm_access_memory_sdma(struct ttm_buffer_object *bo,
14861486
if (r)
14871487
goto out;
14881488

1489+
mutex_lock(&adev->mman.gtt_window_lock);
14891490
amdgpu_res_first(abo->tbo.resource, offset, len, &src_mm);
14901491
src_addr = amdgpu_ttm_domain_start(adev, bo->resource->mem_type) +
14911492
src_mm.start;
@@ -1500,6 +1501,7 @@ static int amdgpu_ttm_access_memory_sdma(struct ttm_buffer_object *bo,
15001501
WARN_ON(job->ibs[0].length_dw > num_dw);
15011502

15021503
fence = amdgpu_job_submit(job);
1504+
mutex_unlock(&adev->mman.gtt_window_lock);
15031505

15041506
if (!dma_fence_wait_timeout(fence, false, adev->sdma_timeout))
15051507
r = -ETIMEDOUT;

0 commit comments

Comments
 (0)