amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>
Cc: "Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"amd-gfx mailing list" <amd-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 4/5] drm/amdgpu: add last_update to amdgpu_vm_update_pdes
Date: Wed, 6 Apr 2022 04:26:14 +0200	[thread overview]
Message-ID: <CAP+8YyGFNe2RoW6S5WmkPMaHUfY7L8gevxH+HZcWRtqjkYTSWg@mail.gmail.com> (raw)
In-Reply-To: <20220331094727.27153-4-christian.koenig@amd.com>

On Thu, Mar 31, 2022 at 11:47 AM Christian König
<ckoenig.leichtzumerken@gmail.com> wrote:
>
> Allows separate tracking of VM updates.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c           | 2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c          | 2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c           | 9 +++++----
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h           | 4 ++--
>  drivers/gpu/drm/amd/amdkfd/kfd_svm.c             | 2 +-
>  6 files changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> index 57b521bb1eec..92a6ca415ab8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> @@ -410,7 +410,7 @@ static int vm_update_pds(struct amdgpu_vm *vm, struct amdgpu_sync *sync)
>         struct amdgpu_device *adev = amdgpu_ttm_adev(pd->tbo.bdev);
>         int ret;
>
> -       ret = amdgpu_vm_update_pdes(adev, vm, false);
> +       ret = amdgpu_vm_update_pdes(adev, vm, false, NULL);
>         if (ret)
>                 return ret;
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index 50fddd6715db..87daa75b57c9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -849,7 +849,7 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p)
>         if (r)
>                 return r;
>
> -       r = amdgpu_vm_update_pdes(adev, vm, false);
> +       r = amdgpu_vm_update_pdes(adev, vm, false, NULL);
>         if (r)
>                 return r;
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> index 3f84eedb4d96..9cdfee67efeb 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> @@ -623,7 +623,7 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev,
>                         goto error;
>         }
>
> -       r = amdgpu_vm_update_pdes(adev, vm, false);
> +       r = amdgpu_vm_update_pdes(adev, vm, false, NULL);
>
>  error:
>         if (r && r != -ERESTARTSYS)
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index 05024999556b..3391256e2448 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -725,14 +725,15 @@ uint64_t amdgpu_vm_map_gart(const dma_addr_t *pages_addr, uint64_t addr)
>   * @adev: amdgpu_device pointer
>   * @vm: requested vm
>   * @immediate: submit immediately to the paging queue
> + * @last:update: optional returned last update
>   *
>   * Makes sure all directories are up to date.
>   *
>   * Returns:
>   * 0 for success, error for failure.
>   */
> -int amdgpu_vm_update_pdes(struct amdgpu_device *adev,
> -                         struct amdgpu_vm *vm, bool immediate)
> +int amdgpu_vm_update_pdes(struct amdgpu_device *adev, struct amdgpu_vm *vm,
> +                         bool immediate, struct dma_fence **last_update)
>  {
>         struct amdgpu_vm_update_params params;
>         struct amdgpu_vm_bo_base *entry;
> @@ -759,7 +760,7 @@ int amdgpu_vm_update_pdes(struct amdgpu_device *adev,
>                         goto error;
>         }
>
> -       r = vm->update_funcs->commit(&params, &vm->last_update);
> +       r = vm->update_funcs->commit(&params, last_update ? : &vm->last_update);

This ternary is pretty incomplete.
>         if (r)
>                 goto error;
>
> @@ -2529,7 +2530,7 @@ bool amdgpu_vm_handle_fault(struct amdgpu_device *adev, u32 pasid,
>         if (r)
>                 goto error_unlock;
>
> -       r = amdgpu_vm_update_pdes(adev, vm, true);
> +       r = amdgpu_vm_update_pdes(adev, vm, true, NULL);
>
>  error_unlock:
>         amdgpu_bo_unreserve(root);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> index 3c7df1b8e3c9..692ec7b51ac2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> @@ -394,8 +394,8 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm,
>                               int (*callback)(void *p, struct amdgpu_bo *bo),
>                               void *param);
>  int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job, bool need_pipe_sync);
> -int amdgpu_vm_update_pdes(struct amdgpu_device *adev,
> -                         struct amdgpu_vm *vm, bool immediate);
> +int amdgpu_vm_update_pdes(struct amdgpu_device *adev, struct amdgpu_vm *vm,
> +                         bool immediate, struct dma_fence **last_update);
>  int amdgpu_vm_clear_freed(struct amdgpu_device *adev,
>                           struct amdgpu_vm *vm,
>                           struct dma_fence **fence);
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> index 907b02045824..74824e3806d5 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> @@ -1294,7 +1294,7 @@ svm_range_map_to_gpu(struct kfd_process_device *pdd, struct svm_range *prange,
>                 last_start = prange->start + i + 1;
>         }
>
> -       r = amdgpu_vm_update_pdes(adev, vm, false);
> +       r = amdgpu_vm_update_pdes(adev, vm, false, NULL);
>         if (r) {
>                 pr_debug("failed %d to update directories 0x%lx\n", r,
>                          prange->start);
> --
> 2.25.1
>

  reply	other threads:[~2022-04-06  2:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-31  9:47 [PATCH 1/5] drm/amdgpu: cleanup freeing delayed mappings Christian König
2022-03-31  9:47 ` [PATCH 2/5] drm/amdgpu: add separate last_clear tracking Christian König
2022-03-31  9:47 ` [PATCH 3/5] drm/amdgpu: add last update fence to amdgpu_vm_bo_update Christian König
2022-03-31  9:47 ` [PATCH 4/5] drm/amdgpu: add last_update to amdgpu_vm_update_pdes Christian König
2022-04-06  2:26   ` Bas Nieuwenhuizen [this message]
2022-03-31  9:47 ` [PATCH 5/5] drm/amdgpu: allow specifying a syncobj for VM map operations Christian König
2022-04-04  1:32   ` Bas Nieuwenhuizen
2022-04-04  6:43     ` Christian König
2022-04-06  2:25       ` Bas Nieuwenhuizen
2022-04-16 18:43         ` Bas Nieuwenhuizen
2022-04-16 21:08           ` Bas Nieuwenhuizen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAP+8YyGFNe2RoW6S5WmkPMaHUfY7L8gevxH+HZcWRtqjkYTSWg@mail.gmail.com \
    --to=bas@basnieuwenhuizen.nl \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=ckoenig.leichtzumerken@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).