mirror of https://github.com/torvalds/linux.git
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: cb5cc4f573 ("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>
This commit is contained in:
parent
5427e32fa3
commit
4fa944255b
|
|
@ -1486,6 +1486,7 @@ static int amdgpu_ttm_access_memory_sdma(struct ttm_buffer_object *bo,
|
||||||
if (r)
|
if (r)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
mutex_lock(&adev->mman.gtt_window_lock);
|
||||||
amdgpu_res_first(abo->tbo.resource, offset, len, &src_mm);
|
amdgpu_res_first(abo->tbo.resource, offset, len, &src_mm);
|
||||||
src_addr = amdgpu_ttm_domain_start(adev, bo->resource->mem_type) +
|
src_addr = amdgpu_ttm_domain_start(adev, bo->resource->mem_type) +
|
||||||
src_mm.start;
|
src_mm.start;
|
||||||
|
|
@ -1500,6 +1501,7 @@ static int amdgpu_ttm_access_memory_sdma(struct ttm_buffer_object *bo,
|
||||||
WARN_ON(job->ibs[0].length_dw > num_dw);
|
WARN_ON(job->ibs[0].length_dw > num_dw);
|
||||||
|
|
||||||
fence = amdgpu_job_submit(job);
|
fence = amdgpu_job_submit(job);
|
||||||
|
mutex_unlock(&adev->mman.gtt_window_lock);
|
||||||
|
|
||||||
if (!dma_fence_wait_timeout(fence, false, adev->sdma_timeout))
|
if (!dma_fence_wait_timeout(fence, false, adev->sdma_timeout))
|
||||||
r = -ETIMEDOUT;
|
r = -ETIMEDOUT;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue