From 2daaf24eab7ed751c8aa7f0c23ea85e324eeb3c2 Mon Sep 17 00:00:00 2001 From: Harish Kasiviswanathan Date: Tue, 14 Mar 2017 16:35:47 -0400 Subject: [PATCH 1608/4131] drm/amdgpu: Ignore eviction fence during unmap Remove eviction fence from PD (and thereby from PTs too as they share the resv. object. Otherwise during PT update job (see amdgpu_vm_bo_update_mapping), eviction fence will get added to job->sync object. This will trigger unnecessary evictions when the scheduler tries to execute the job. This change will also enable to revert the temporary commit 6bb00e491bfb ("drm/amdgpu: Use AMDGPU_FENCE_OWNER_VM in unmap") Change-Id: I3fb2540526840b65c733f1adbfc88c5b5e9ace8b Signed-off-by: Harish Kasiviswanathan --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c index 9a26cff..801c34e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c @@ -886,11 +886,24 @@ static int unmap_bo_from_gpuvm(struct amdgpu_device *adev, { struct amdgpu_bo_va *bo_va = entry->bo_va; struct amdgpu_vm *vm = bo_va->vm; + struct amdkfd_vm *kvm = container_of(vm, struct amdkfd_vm, base); + struct amdgpu_bo *pd = vm->page_directory; + /* Remove eviction fence from PD (and thereby from PTs too as they + * share the resv. object. Otherwise during PT update job (see + * amdgpu_vm_bo_update_mapping), eviction fence will get added to + * job->sync object + */ + amdgpu_amdkfd_remove_eviction_fence(pd, + kvm->process_info->eviction_fence, + NULL, NULL); amdgpu_vm_bo_unmap(adev, bo_va, entry->va); amdgpu_vm_clear_freed(adev, vm, &bo_va->last_pt_update); + /* Add the eviction fence back */ + amdgpu_bo_fence(pd, &kvm->process_info->eviction_fence->base, true); + amdgpu_sync_fence(adev, sync, bo_va->last_pt_update); /* Sync objects can't handle multiple GPUs (contexts) updating -- 2.7.4