Commit 68befebe authored by Chunming Zhou's avatar Chunming Zhou Committed by Alex Deucher

drm/amdgpu: only update last_flush when vmid doesn't have other new owner

Signed-off-by: default avatarChunming Zhou <David1.Zhou@amd.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 66067ad7
...@@ -881,6 +881,7 @@ struct amdgpu_vm_id { ...@@ -881,6 +881,7 @@ struct amdgpu_vm_id {
struct fence *first; struct fence *first;
struct amdgpu_sync active; struct amdgpu_sync active;
struct fence *last_flush; struct fence *last_flush;
struct amdgpu_ring *last_user;
atomic_long_t owner; atomic_long_t owner;
uint64_t pd_gpu_addr; uint64_t pd_gpu_addr;
......
...@@ -260,6 +260,7 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring, ...@@ -260,6 +260,7 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring,
id->pd_gpu_addr = pd_addr; id->pd_gpu_addr = pd_addr;
list_move_tail(&id->list, &adev->vm_manager.ids_lru); list_move_tail(&id->list, &adev->vm_manager.ids_lru);
id->last_user = ring;
atomic_long_set(&id->owner, (long)vm); atomic_long_set(&id->owner, (long)vm);
vm->ids[ring->idx] = id; vm->ids[ring->idx] = id;
...@@ -307,13 +308,17 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, ...@@ -307,13 +308,17 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring,
trace_amdgpu_vm_flush(pd_addr, ring->idx, vm_id); trace_amdgpu_vm_flush(pd_addr, ring->idx, vm_id);
amdgpu_ring_emit_vm_flush(ring, vm_id, pd_addr); amdgpu_ring_emit_vm_flush(ring, vm_id, pd_addr);
r = amdgpu_fence_emit(ring, &fence);
if (r)
return r;
mutex_lock(&adev->vm_manager.lock); mutex_lock(&adev->vm_manager.lock);
if ((id->pd_gpu_addr == pd_addr) && (id->last_user == ring)) {
r = amdgpu_fence_emit(ring, &fence);
if (r) {
mutex_unlock(&adev->vm_manager.lock);
return r;
}
fence_put(id->last_flush); fence_put(id->last_flush);
id->last_flush = fence; id->last_flush = fence;
}
mutex_unlock(&adev->vm_manager.lock); mutex_unlock(&adev->vm_manager.lock);
} }
......
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