aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2016-07-08 04:21:02 -0400
committerAlex Deucher <alexander.deucher@amd.com>2016-07-14 16:46:07 -0400
commit090b767e97fcdabe8ecd71cf43e7d39d94e6cfef (patch)
tree68cbae5a009f06c5fbcd91f29d85856967fbb5d9 /drivers/gpu/drm/amd/amdgpu
parentd3200be6c423afa1c34f7e39e9f6d04dd5b0af9d (diff)
drm/amdgpu: check flush fence context instead of same ring v2
Otherwise we can run into the following situation: 1. Process A grabs ID 1 for ring 0. 2. Process B grabs ID 1 for ring 0. 3. Process A grabs ID 1 for ring 1. 4. Process A tries to reuse ID1 for ring 0 but things he doesn't need to flush. v2: check the context of the flush fence instead of messing with the owner field. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Chunming Zhou <david1.zhou@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 2f8496d48c94..a041168ad521 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -195,6 +195,7 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring,
195 struct amdgpu_job *job) 195 struct amdgpu_job *job)
196{ 196{
197 struct amdgpu_device *adev = ring->adev; 197 struct amdgpu_device *adev = ring->adev;
198 uint64_t fence_context = adev->fence_context + ring->idx;
198 struct fence *updates = sync->last_vm_update; 199 struct fence *updates = sync->last_vm_update;
199 struct amdgpu_vm_id *id, *idle; 200 struct amdgpu_vm_id *id, *idle;
200 struct fence **fences; 201 struct fence **fences;
@@ -254,7 +255,6 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring,
254 i = ring->idx; 255 i = ring->idx;
255 do { 256 do {
256 struct fence *flushed; 257 struct fence *flushed;
257 bool same_ring = ring->idx == i;
258 258
259 id = vm->ids[i++]; 259 id = vm->ids[i++];
260 if (i == AMDGPU_MAX_RINGS) 260 if (i == AMDGPU_MAX_RINGS)
@@ -272,8 +272,11 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring,
272 if (job->vm_pd_addr != id->pd_gpu_addr) 272 if (job->vm_pd_addr != id->pd_gpu_addr)
273 continue; 273 continue;
274 274
275 if (!same_ring && 275 if (!id->last_flush)
276 (!id->last_flush || !fence_is_signaled(id->last_flush))) 276 continue;
277
278 if (id->last_flush->context != fence_context &&
279 !fence_is_signaled(id->last_flush))
277 continue; 280 continue;
278 281
279 flushed = id->flushed_updates; 282 flushed = id->flushed_updates;