From: Danilo Krummrich <dakr@kernel.org>
To: lyude@redhat.com, airlied@gmail.com, simona@ffwll.ch
Cc: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org,
Danilo Krummrich <dakr@kernel.org>,
Alice Ryhl <aliceryhl@google.com>
Subject: [PATCH] drm/nouveau: use DRM_GPUVM_RESV_PROTECTED locking scheme
Date: Tue, 12 Aug 2025 19:01:25 +0200 [thread overview]
Message-ID: <20250812170135.3544-1-dakr@kernel.org> (raw)
Given that nouveau does not update the GPUVA space from the DMA fence
signalling critical path, we are able to use the DRM_GPUVM_RESV_PROTECTED
locking scheme, rather than relying on the spinlock dance for the
external and evicted object list.
Except for the call to drm_gpuvm_bo_extobj_add() add other relevant call
are already protected by the corresponding dma-resv locks.
Hence, move drm_gpuvm_bo_extobj_add into the same lock context as
drm_gpuvm_bo_obtain() and enable DRM_GPUVM_RESV_PROTECTED.
Cc: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
---
drivers/gpu/drm/nouveau/nouveau_uvmm.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_uvmm.c b/drivers/gpu/drm/nouveau/nouveau_uvmm.c
index ddfc46bc1b3e..9d9e82628053 100644
--- a/drivers/gpu/drm/nouveau/nouveau_uvmm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_uvmm.c
@@ -1208,11 +1208,13 @@ nouveau_uvmm_bind_job_submit(struct nouveau_job *job,
dma_resv_lock(obj->resv, NULL);
op->vm_bo = drm_gpuvm_bo_obtain(&uvmm->base, obj);
- dma_resv_unlock(obj->resv);
- if (IS_ERR(op->vm_bo))
+ if (IS_ERR(op->vm_bo)) {
+ dma_resv_unlock(obj->resv);
return PTR_ERR(op->vm_bo);
+ }
drm_gpuvm_bo_extobj_add(op->vm_bo);
+ dma_resv_unlock(obj->resv);
}
ret = bind_validate_op(job, op);
@@ -1857,7 +1859,9 @@ nouveau_uvmm_ioctl_vm_init(struct drm_device *dev,
mt_init_flags(&uvmm->region_mt, MT_FLAGS_LOCK_EXTERN);
mt_set_external_lock(&uvmm->region_mt, &uvmm->mutex);
- drm_gpuvm_init(&uvmm->base, cli->name, 0, drm, r_obj,
+ drm_gpuvm_init(&uvmm->base, cli->name,
+ DRM_GPUVM_RESV_PROTECTED,
+ drm, r_obj,
NOUVEAU_VA_SPACE_START,
NOUVEAU_VA_SPACE_END,
init->kernel_managed_addr,
base-commit: fb357dbadbebc7a9ca3c5ef26f6c792b0e8e1278
--
2.50.1
reply other threads:[~2025-08-12 17:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20250812170135.3544-1-dakr@kernel.org \
--to=dakr@kernel.org \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=lyude@redhat.com \
--cc=nouveau@lists.freedesktop.org \
--cc=simona@ffwll.ch \
/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.