Commit 87c910d8 authored by Christian König's avatar Christian König Committed by Alex Deucher

drm/amdgpu: allow concurrent VM flushes

Enable concurrent VM flushes for Vega10.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Reviewed-by: default avatarAndres Rodriguez <andresx7@gmail.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 4789c463
...@@ -462,10 +462,11 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring, ...@@ -462,10 +462,11 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring,
} }
kfree(fences); kfree(fences);
job->vm_needs_flush = true; job->vm_needs_flush = false;
/* Check if we can use a VMID already assigned to this VM */ /* Check if we can use a VMID already assigned to this VM */
list_for_each_entry_reverse(id, &id_mgr->ids_lru, list) { list_for_each_entry_reverse(id, &id_mgr->ids_lru, list) {
struct dma_fence *flushed; struct dma_fence *flushed;
bool needs_flush = false;
/* Check all the prerequisites to using this VMID */ /* Check all the prerequisites to using this VMID */
if (amdgpu_vm_had_gpu_reset(adev, id)) if (amdgpu_vm_had_gpu_reset(adev, id))
...@@ -477,16 +478,17 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring, ...@@ -477,16 +478,17 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring,
if (job->vm_pd_addr != id->pd_gpu_addr) if (job->vm_pd_addr != id->pd_gpu_addr)
continue; continue;
if (!id->last_flush) if (!id->last_flush ||
continue; (id->last_flush->context != fence_context &&
!dma_fence_is_signaled(id->last_flush)))
if (id->last_flush->context != fence_context && needs_flush = true;
!dma_fence_is_signaled(id->last_flush))
continue;
flushed = id->flushed_updates; flushed = id->flushed_updates;
if (updates && if (updates && (!flushed || dma_fence_is_later(updates, flushed)))
(!flushed || dma_fence_is_later(updates, flushed))) needs_flush = true;
/* Concurrent flushes are only possible starting with Vega10 */
if (adev->asic_type < CHIP_VEGA10 && needs_flush)
continue; continue;
/* Good we can use this VMID. Remember this submission as /* Good we can use this VMID. Remember this submission as
...@@ -496,14 +498,15 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring, ...@@ -496,14 +498,15 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring,
if (r) if (r)
goto error; goto error;
list_move_tail(&id->list, &id_mgr->ids_lru); if (updates && (!flushed || dma_fence_is_later(updates, flushed))) {
dma_fence_put(id->flushed_updates);
job->vm_id = id - id_mgr->ids; id->flushed_updates = dma_fence_get(updates);
job->vm_needs_flush = false; }
trace_amdgpu_vm_grab_id(vm, ring->idx, job);
mutex_unlock(&id_mgr->lock); if (needs_flush)
return 0; goto needs_flush;
else
goto no_flush_needed;
}; };
...@@ -515,17 +518,20 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring, ...@@ -515,17 +518,20 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring,
if (r) if (r)
goto error; goto error;
dma_fence_put(id->last_flush); id->pd_gpu_addr = job->vm_pd_addr;
id->last_flush = NULL;
dma_fence_put(id->flushed_updates); dma_fence_put(id->flushed_updates);
id->flushed_updates = dma_fence_get(updates); id->flushed_updates = dma_fence_get(updates);
id->pd_gpu_addr = job->vm_pd_addr;
id->current_gpu_reset_count = atomic_read(&adev->gpu_reset_counter); id->current_gpu_reset_count = atomic_read(&adev->gpu_reset_counter);
list_move_tail(&id->list, &id_mgr->ids_lru);
atomic64_set(&id->owner, vm->client_id); atomic64_set(&id->owner, vm->client_id);
needs_flush:
job->vm_needs_flush = true;
dma_fence_put(id->last_flush);
id->last_flush = NULL;
no_flush_needed:
list_move_tail(&id->list, &id_mgr->ids_lru);
job->vm_id = id - id_mgr->ids; job->vm_id = id - id_mgr->ids;
trace_amdgpu_vm_grab_id(vm, ring->idx, job); trace_amdgpu_vm_grab_id(vm, ring->idx, job);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment