NAK, we already tried that and
it is really not a good idea because it
massively increases the per submission overhead.
Christian.
Am 27.03.2018 um 12:16 schrieb Chunming Zhou:
> Change-Id:
Ibad84ed585b0746867a5f4cd1eadc2273e7cf596
> Signed-off-by: Chunming Zhou
<david1.zhou@xxxxxxx>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2
++
> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 15
+++++++++++++++
> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 1 +
> 3 files changed, 18 insertions(+)
>
> diff --git
a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index 383bf2d31c92..414e61799236 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -919,6 +919,8 @@ static int
amdgpu_bo_vm_update_pte(struct amdgpu_cs_parser *p)
> }
> }
>
> + amdgpu_vm_refresh_lru(adev, vm);
> +
> return r;
> }
>
> diff --git
a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index 5e35e23511cf..8ad2bb705765 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -1902,6 +1902,21 @@ struct amdgpu_bo_va
*amdgpu_vm_bo_add(struct amdgpu_device *adev,
> return bo_va;
> }
>
> +void amdgpu_vm_refresh_lru(struct
amdgpu_device *adev, struct amdgpu_vm *vm)
> +{
> + struct ttm_bo_global *glob =
adev->mman.bdev.glob;
> + struct amdgpu_vm_bo_base *bo_base;
> +
> + spin_lock(&vm->status_lock);
> + list_for_each_entry(bo_base,
&vm->vm_bo_list, vm_bo) {
> +
spin_lock(&glob->lru_lock);
> +
ttm_bo_move_to_lru_tail(&bo_base->bo->tbo);
> + if (bo_base->bo->shadow)
> +
ttm_bo_move_to_lru_tail(&bo_base->bo->shadow->tbo);
> +
spin_unlock(&glob->lru_lock);
> + }
> + spin_unlock(&vm->status_lock);
> +}
>
> /**
> * amdgpu_vm_bo_insert_mapping - insert a new
mapping
> diff --git
a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> index 1886a561c84e..e01895581489 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> @@ -285,6 +285,7 @@ int
amdgpu_vm_clear_freed(struct amdgpu_device *adev,
> struct dma_fence
**fence);
> int amdgpu_vm_handle_moved(struct
amdgpu_device *adev,
> struct amdgpu_vm
*vm);
> +void amdgpu_vm_refresh_lru(struct
amdgpu_device *adev, struct amdgpu_vm *vm);
> int amdgpu_vm_bo_update(struct amdgpu_device
*adev,
> struct amdgpu_bo_va
*bo_va,
> bool clear);