From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: intel-xe@lists.freedesktop.org
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Subject: [PATCH 5/7] drm/xe: Move vma rebinding to the drm_exec locking loop
Date: Thu, 21 Mar 2024 12:37:18 +0100 [thread overview]
Message-ID: <20240321113720.120865-10-thomas.hellstrom@linux.intel.com> (raw)
In-Reply-To: <20240321113720.120865-1-thomas.hellstrom@linux.intel.com>
Rebinding might allocate page-table bos, causing evictions.
To support blocking locking during these evictions,
perform the rebinding in the drm_exec locking loop.
Fixes: 24f947d58fe5 ("drm/xe: Use DRM GPUVM helpers for external- and evicted objects")
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
---
drivers/gpu/drm/xe/xe_exec.c | 13 ++++++++++---
drivers/gpu/drm/xe/xe_vm.c | 12 +++++++++---
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_exec.c b/drivers/gpu/drm/xe/xe_exec.c
index 397a49b731f1..e00910246741 100644
--- a/drivers/gpu/drm/xe/xe_exec.c
+++ b/drivers/gpu/drm/xe/xe_exec.c
@@ -96,13 +96,20 @@
static int xe_exec_fn(struct drm_gpuvm_exec *vm_exec)
{
+ struct xe_vm *vm = container_of(vm_exec->vm, struct xe_vm, gpuvm);
struct drm_gem_object *obj;
unsigned long index;
int ret;
- ret = drm_gpuvm_validate(vm_exec->vm, &vm_exec->exec);
- if (ret)
- return ret;
+ do {
+ ret = drm_gpuvm_validate(vm_exec->vm, &vm_exec->exec);
+ if (ret)
+ return ret;
+
+ ret = xe_vm_rebind(vm, false);
+ if (ret)
+ return ret;
+ } while (!list_empty(&vm->gpuvm.evict.list));
drm_exec_for_each_locked_object(&vm_exec->exec, index, obj) {
ret = dma_resv_reserve_fences(obj->resv, 1);
diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index 33a85e702e2c..f9da055180b3 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -512,9 +512,15 @@ static int xe_preempt_work_begin(struct drm_exec *exec, struct xe_vm *vm,
if (err)
return err;
- err = drm_gpuvm_validate(&vm->gpuvm, exec);
- if (err)
- return err;
+ do {
+ err = drm_gpuvm_validate(&vm->gpuvm, exec);
+ if (err)
+ return err;
+
+ err = xe_vm_rebind(vm, true);
+ if (err)
+ return err;
+ } while (!list_empty(&vm->gpuvm.evict.list));
drm_exec_for_each_locked_object(exec, index, obj) {
err = dma_resv_reserve_fences(obj->resv, vm->preempt.num_exec_queues);
--
2.44.0
next prev parent reply other threads:[~2024-03-21 11:37 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-21 11:37 [PATCH 0/7] drm/xe: Rework rebinding and allow same-vm eviction Thomas Hellström
2024-03-21 11:37 ` [PATCH 1/7] drm/xe: Make TLB invalidation fences unordered Thomas Hellström
2024-03-21 11:37 ` [PATCH 1/7] drm/xe: Use ring ops TLB invalidation for rebinds Thomas Hellström
2024-03-21 19:09 ` Matthew Brost
2024-03-21 21:14 ` Thomas Hellström
2024-03-21 21:21 ` Thomas Hellström
2024-03-22 2:36 ` Matthew Brost
2024-03-21 21:55 ` Thomas Hellström
2024-03-21 11:37 ` [PATCH 2/7] drm/xe: Rework rebinding Thomas Hellström
2024-03-21 19:14 ` Matthew Brost
2024-03-21 21:16 ` Thomas Hellström
2024-03-21 11:37 ` [PATCH 2/7] drm/xe: Use ring ops TLB invalidation for rebinds Thomas Hellström
2024-03-21 11:37 ` [PATCH 3/7] drm/xe: Make TLB invalidation fences unordered Thomas Hellström
2024-03-22 17:55 ` Matthew Brost
2024-03-21 11:37 ` [PATCH 3/7] drm/xe: Reserve fences where needed Thomas Hellström
2024-03-21 20:10 ` Matthew Brost
2024-03-21 21:34 ` Thomas Hellström
2024-03-21 11:37 ` [PATCH 4/7] " Thomas Hellström
2024-03-21 11:37 ` [PATCH 4/7] drm/xe: Rework rebinding Thomas Hellström
2024-03-21 11:37 ` Thomas Hellström [this message]
2024-03-21 11:37 ` [PATCH 6/7] drm/xe/bo: Forward the decision to evict local objects during validation Thomas Hellström
2024-03-21 11:37 ` [PATCH 7/7] drm/xe/bo: Allow eviction of unbound local bos Thomas Hellström
2024-03-21 13:44 ` ✗ CI.Patch_applied: failure for drm/xe: Rework rebinding and allow same-vm eviction Patchwork
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=20240321113720.120865-10-thomas.hellstrom@linux.intel.com \
--to=thomas.hellstrom@linux.intel.com \
--cc=intel-xe@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox