Tracking the last update per bo_va was an optimization for apps that keep lots of buffer objects around that never make it onto the buffer list. This isn't a very common usecase (anymore), since usage of VM_ALWAYS_VALID buffers is much more prominent nowadays.
Since it complicates lots of things, just remove it. Signed-off-by: Natalie Vock <[email protected]> --- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 6 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 15 ------------- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 21 +------------------ drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 1 - drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 13 ------------ drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 17 +++------------ 6 files changed, 7 insertions(+), 66 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c index a5d1d83ee5d32..11ecaace3f3d5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c @@ -1285,9 +1285,9 @@ static int unmap_bo_from_gpuvm(struct kgd_mem *mem, if (!amdgpu_vm_ready(vm)) return 0; - (void)amdgpu_vm_clear_freed(adev, vm, &bo_va->last_pt_update); + (void)amdgpu_vm_clear_freed(adev, vm, &vm->last_update); - (void)amdgpu_sync_fence(sync, bo_va->last_pt_update, GFP_KERNEL); + (void)amdgpu_sync_fence(sync, vm->last_update, GFP_KERNEL); return 0; } @@ -1311,7 +1311,7 @@ static int update_gpuvm_pte(struct kgd_mem *mem, return ret; } - return amdgpu_sync_fence(sync, bo_va->last_pt_update, GFP_KERNEL); + return amdgpu_sync_fence(sync, bo_va->base.vm->last_update, GFP_KERNEL); } static int map_bo_to_gpuvm(struct kgd_mem *mem, diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index d059e0c928669..c4f1a49b8519e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -1142,21 +1142,11 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p) if (r) return r; - r = amdgpu_sync_fence(&p->sync, fpriv->prt_va->last_pt_update, - GFP_KERNEL); - if (r) - return r; - if (fpriv->csa_va) { bo_va = fpriv->csa_va; r = amdgpu_vm_bo_update(adev, bo_va, false); if (r) return r; - - r = amdgpu_sync_fence(&p->sync, bo_va->last_pt_update, - GFP_KERNEL); - if (r) - return r; } /* FIXME: In theory this loop shouldn't be needed any more when @@ -1172,11 +1162,6 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p) r = amdgpu_vm_bo_update(adev, bo_va, false); if (r) return r; - - r = amdgpu_sync_fence(&p->sync, bo_va->last_pt_update, - GFP_KERNEL); - if (r) - return r; } r = amdgpu_vm_handle_moved(adev, vm, &p->exec.ticket); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c index 374f1322c3ee4..a35f641a554f9 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c @@ -836,26 +836,7 @@ amdgpu_gem_va_update_vm(struct amdgpu_device *adev, if (r) goto error; - if ((operation == AMDGPU_VA_OP_MAP || - operation == AMDGPU_VA_OP_REPLACE) && - !amdgpu_vm_is_bo_always_valid(vm, bo_va->base.bo)) { - - /* - * For MAP/REPLACE of non per-VM BOs we need to sync to both the - * bo_va->last_pt_update and vm->last_update or otherwise we - * potentially miss the PDE updates. - */ - fence = dma_fence_unwrap_merge(vm->last_update, - bo_va->last_pt_update); - if (!fence) { - /* As fallback in OOM situations */ - dma_fence_wait(vm->last_update, false); - dma_fence_wait(bo_va->last_pt_update, false); - fence = dma_fence_get_stub(); - } - } else { - fence = dma_fence_get(vm->last_update); - } + fence = dma_fence_get(vm->last_update); return fence; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h index 2e6a8e6f577a7..ef13a7bc55034 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h @@ -80,7 +80,6 @@ struct amdgpu_bo_va { unsigned ref_count; /* all other members protected by the VM PD being reserved */ - struct dma_fence *last_pt_update; /* mappings for this bo_va */ struct list_head invalids; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c index e29823ae8672e..e674309599f44 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c @@ -1188,19 +1188,6 @@ amdgpu_userq_vm_validate_and_restore_queue(struct amdgpu_userq_mgr *uq_mgr) if (ret) goto unlock_all; - /* - * We need to wait for all VM updates to finish before restarting the - * queues. Using the idle list like that is now ok since everything is - * locked in place. - */ - list_for_each_entry(bo_va, &vm->always_valid.idle, base.vm_status) - dma_fence_wait(bo_va->last_pt_update, false); - /* - * The PRT bo_va is kept off the state lists, so its PTE update fence - * lands in prt_va->last_pt_update rather than vm->last_update; wait on - * it explicitly (as the CS path syncs it) before restarting queues. - */ - dma_fence_wait(fpriv->prt_va->last_pt_update, false); dma_fence_wait(vm->last_update, false); xa_for_each(&uq_mgr->userq_xa, tmp_key, queue) { diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 7d3659ef11e53..5756d4d9f9ba6 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -1287,7 +1287,6 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, struct amdgpu_bo_va *bo_va, struct amdgpu_bo *bo = bo_va->base.bo; struct amdgpu_vm *vm = bo_va->base.vm; struct amdgpu_bo_va_mapping *mapping; - struct dma_fence **last_update; dma_addr_t *pages_addr = NULL; struct ttm_resource *mem; struct amdgpu_sync sync; @@ -1359,11 +1358,6 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, struct amdgpu_bo_va *bo_va, uncached = false; } - if (clear || amdgpu_vm_is_bo_always_valid(vm, bo)) - last_update = &vm->last_update; - else - last_update = &bo_va->last_pt_update; - if (!clear && bo_va->base.moved) { flush_tlb = true; list_splice_init(&bo_va->valids, &bo_va->invalids); @@ -1393,7 +1387,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, struct amdgpu_bo_va *bo_va, !uncached, &sync, mapping->start, mapping->last, update_flags, mapping->offset, vram_base, mem, - pages_addr, last_update); + pages_addr, &vm->last_update); if (r) goto error_free; } @@ -1770,7 +1764,6 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev, amdgpu_vm_bo_base_init(&bo_va->base, vm, bo); bo_va->ref_count = 1; - bo_va->last_pt_update = dma_fence_get_stub(); INIT_LIST_HEAD(&bo_va->valids); INIT_LIST_HEAD(&bo_va->invalids); @@ -2018,8 +2011,7 @@ int amdgpu_vm_bo_unmap(struct amdgpu_device *adev, if (valid) list_add(&mapping->list, &vm->freed); else - amdgpu_vm_free_mapping(adev, vm, mapping, - bo_va->last_pt_update); + amdgpu_vm_free_mapping(adev, vm, mapping, vm->last_update); return 0; } @@ -2243,12 +2235,9 @@ void amdgpu_vm_bo_del(struct amdgpu_device *adev, list_for_each_entry_safe(mapping, next, &bo_va->invalids, list) { list_del(&mapping->list); amdgpu_vm_it_remove(mapping, &vm->va); - amdgpu_vm_free_mapping(adev, vm, mapping, - bo_va->last_pt_update); + amdgpu_vm_free_mapping(adev, vm, mapping, vm->last_update); } - dma_fence_put(bo_va->last_pt_update); - if (bo && bo_va->is_xgmi) amdgpu_xgmi_set_pstate(adev, AMDGPU_XGMI_PSTATE_MIN); -- 2.56.0
