From: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>,
dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
alexander.deucher@amd.com
Subject: Re: [PATCH 4/6] drm/amdgpu: use drm_exec for GEM and CSA handling
Date: Thu, 29 Jun 2023 17:20:10 +0900 [thread overview]
Message-ID: <dda5dd70-403a-273d-6506-cca5bc084f64@gmail.com> (raw)
In-Reply-To: <20230628104446.1369-5-christian.koenig@amd.com>
On 6/28/23 19:44, Christian König wrote:
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> index 74055cba3dc9..6811fc866494 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> @@ -728,36 +723,37 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
> return -EINVAL;
> }
>
> - INIT_LIST_HEAD(&list);
> - INIT_LIST_HEAD(&duplicates);
> if ((args->operation != AMDGPU_VA_OP_CLEAR) &&
> !(args->flags & AMDGPU_VM_PAGE_PRT)) {
> gobj = drm_gem_object_lookup(filp, args->handle);
> if (gobj == NULL)
> return -ENOENT;
> abo = gem_to_amdgpu_bo(gobj);
> - tv.bo = &abo->tbo;
> - if (abo->flags & AMDGPU_GEM_CREATE_VM_ALWAYS_VALID)
> - tv.num_shared = 1;
> - else
> - tv.num_shared = 0;
> - list_add(&tv.head, &list);
> } else {
> gobj = NULL;
> abo = NULL;
> }
>
> - amdgpu_vm_get_pd_bo(&fpriv->vm, &list, &vm_pd);
> + drm_exec_init(&exec, DRM_EXEC_INTERRUPTIBLE_WAIT);
Sorry, I missed this last time, but this needs to allow duplicates as well or mapping
always_valid BOs doesn't work.
> + drm_exec_until_all_locked(&exec) {
> + if (gobj) {
> + r = drm_exec_lock_obj(&exec, gobj);
> + drm_exec_retry_on_contention(&exec);
> + if (unlikely(r))
> + goto error;
> + }
>
> - r = ttm_eu_reserve_buffers(&ticket, &list, true, &duplicates);
> - if (r)
> - goto error_unref;
> + r = amdgpu_vm_lock_pd(&fpriv->vm, &exec, 2);
> + drm_exec_retry_on_contention(&exec);
> + if (unlikely(r))
> + goto error;
> + }
>
> if (abo) {
> bo_va = amdgpu_vm_bo_find(&fpriv->vm, abo);
> if (!bo_va) {
> r = -ENOENT;
> - goto error_backoff;
> + goto error;
> }
> } else if (args->operation != AMDGPU_VA_OP_CLEAR) {
> bo_va = fpriv->prt_va;
> @@ -794,10 +790,8 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
> amdgpu_gem_va_update_vm(adev, &fpriv->vm, bo_va,
> args->operation);
>
> -error_backoff:
> - ttm_eu_backoff_reservation(&ticket, &list);
> -
> -error_unref:
> +error:
> + drm_exec_fini(&exec);
> drm_gem_object_put(gobj);
> return r;
> }
next prev parent reply other threads:[~2023-06-29 8:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-28 10:44 AMDGPU patches for the drm_exec context Christian König
2023-06-28 10:44 ` [PATCH 1/6] drm: execution context for GEM buffers v6 Christian König
2023-06-28 10:44 ` [PATCH 2/6] drm: add drm_exec selftests v4 Christian König
2023-06-28 10:44 ` [PATCH 3/6] drm/amdkfd: switch over to using drm_exec v2 Christian König
2023-06-28 10:44 ` [PATCH 4/6] drm/amdgpu: use drm_exec for GEM and CSA handling Christian König
2023-06-29 8:20 ` Tatsuyuki Ishi [this message]
2023-06-28 10:44 ` [PATCH 5/6] drm/amdgpu: use drm_exec for MES testing Christian König
2023-06-28 10:44 ` [PATCH 6/6] drm/amdgpu: use the new drm_exec object for CS v2 Christian König
2023-06-29 8:20 ` Tatsuyuki Ishi
2023-06-29 13:58 ` Christian König
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=dda5dd70-403a-273d-6506-cca5bc084f64@gmail.com \
--to=ishitatsuyuki@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=ckoenig.leichtzumerken@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.