[PATCH 5/9] drm/amdgpu: Remove explicit wait after VM validate
Alex Deucher
alexdeucher at gmail.com
Tue Nov 6 21:35:53 UTC 2018
On Mon, Nov 5, 2018 at 8:41 PM Kuehling, Felix <Felix.Kuehling at amd.com> wrote:
>
> From: Harish Kasiviswanathan <Harish.Kasiviswanathan at amd.com>
>
> PD or PT might have to be moved during validation and this move has to be
> completed before updating it. If page table updates are done using SDMA
> then this serializing is done by SDMA command submission.
>
> And if PD/PT updates are done by CPU, then explicit waiting for PD/PT
> updates are done in amdgpu VM amdgpu_vm_wait_pd function.
>
> Sync to PD BO moving fence to handle corner case where none of the PTs
> are updated but PD is evicted.
>
> Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan at amd.com>
> Reviewed-by: Felix Kuehling <Felix.Kuehling at amd.com>
> Signed-off-by: Felix Kuehling <Felix.Kuehling at amd.com>
Acked-by: Alex Deucher <alexander.deucher at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 31 ++++++++++++++++++------
> 1 file changed, 24 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> index 9a1b2b2..e124d2d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> @@ -901,6 +901,26 @@ static int process_validate_vms(struct amdkfd_process_info *process_info)
> return 0;
> }
>
> +static int process_sync_pds_resv(struct amdkfd_process_info *process_info,
> + struct amdgpu_sync *sync)
> +{
> + struct amdgpu_vm *peer_vm;
> + int ret;
> +
> + list_for_each_entry(peer_vm, &process_info->vm_list_head,
> + vm_list_node) {
> + struct amdgpu_bo *pd = peer_vm->root.base.bo;
> +
> + ret = amdgpu_sync_resv(amdgpu_ttm_adev(pd->tbo.bdev),
> + sync, pd->tbo.resv,
> + AMDGPU_FENCE_OWNER_UNDEFINED, false);
> + if (ret)
> + return ret;
> + }
> +
> + return 0;
> +}
> +
> static int process_update_pds(struct amdkfd_process_info *process_info,
> struct amdgpu_sync *sync)
> {
> @@ -2045,13 +2065,10 @@ int amdgpu_amdkfd_gpuvm_restore_process_bos(void *info, struct dma_fence **ef)
> if (ret)
> goto validate_map_fail;
>
> - /* Wait for PD/PTs validate to finish */
> - /* FIXME: I think this isn't needed */
> - list_for_each_entry(peer_vm, &process_info->vm_list_head,
> - vm_list_node) {
> - struct amdgpu_bo *bo = peer_vm->root.base.bo;
> -
> - ttm_bo_wait(&bo->tbo, false, false);
> + ret = process_sync_pds_resv(process_info, &sync_obj);
> + if (ret) {
> + pr_debug("Memory eviction: Failed to sync to PD BO moving fence. Try again\n");
> + goto validate_map_fail;
> }
>
> /* Validate BOs and map them to GPUVM (update VM page tables). */
> --
> 2.7.4
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
More information about the amd-gfx
mailing list