On 11/11/26 19:28, Thadeu Lima de Souza Cascardo wrote:
> When we partially clear a BO mapping, we only add the partially unmapped
> region to the freed list. That will update the page table to clear that
> mapping and leave the other endpoints mapped.
> 
> However, we move the endpoints to the invalids list. When later closing
> that BO, it will simply free the mapping and not clear the GPU page
> tables.
> 
> Drop the optimization and clear the entire mapping from the page tables.
> As the endpoints are already in the invalids list, when that BO mapping
> needs to be accessed, the page tables will be updated.
> 
> Though that may clear, then write page table entries and even lead to
> new page table allocations in certain situations, those would already
> happen in the clear path.
> 
> When measuring a given workload, it was noticed an extra allocation in
> less than 10% of the cases, but no noticeable extra latency. In any
> case, correctness is more important and this fixes the scenario
> described.
> 
> Signed-off-by: Thadeu Lima de Souza Cascardo <[email protected]>

Reviewed-by: Christian König <[email protected]>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index a99c2ef14be9..808b77083a5e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -2108,12 +2108,6 @@ int amdgpu_vm_bo_clear_mappings(struct amdgpu_device 
> *adev,
>       list_for_each_entry_safe(tmp, next, &removed, list) {
>               amdgpu_vm_it_remove(tmp, &vm->va);
>               list_del(&tmp->list);
> -
> -             if (tmp->start < saddr)
> -                 tmp->start = saddr;
> -             if (tmp->last > eaddr)
> -                 tmp->last = eaddr;
> -
>               tmp->bo_va = NULL;
>               list_add(&tmp->list, &vm->freed);
>               trace_amdgpu_vm_bo_unmap(NULL, tmp);
> 
> ---
> base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
> change-id: 20261111-amdgpu_partial_mappings_fix-c48d729ef590
> 
> Best regards,
> --  
> Thadeu Lima de Souza Cascardo <[email protected]>
> 

Reply via email to