[Intel-xe] [PATCH] drm/xe: Fix fence reservation accouting
Matthew Brost
matthew.brost at intel.com
Wed Aug 30 00:43:00 UTC 2023
Both execs and the preempt rebind worker can issue rebinds. Rebinds
require a fence, per tile, inserted into dma-resv slots of the VM and
BO (if external). The fence reservation accouting did not take into
account the number of fences required for rebinds, fix this.
Reported-by: Christopher Snowhill <kode54 at gmail.com>
Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/518
Signed-off-by: Matthew Brost <matthew.brost at intel.com>
---
drivers/gpu/drm/xe/xe_exec.c | 7 ++++++-
drivers/gpu/drm/xe/xe_vm.c | 7 ++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_exec.c b/drivers/gpu/drm/xe/xe_exec.c
index 8a5b614df090..0020f7dabe0a 100644
--- a/drivers/gpu/drm/xe/xe_exec.c
+++ b/drivers/gpu/drm/xe/xe_exec.c
@@ -111,7 +111,12 @@ static int xe_exec_begin(struct xe_exec_queue *q, struct ww_acquire_ctx *ww,
return 0;
retry:
- err = xe_vm_lock_dma_resv(vm, ww, tv_onstack, tv, objs, true, 1);
+ /*
+ * 1 fence for job from exec plus a fence for each tile from a possible
+ * rebind
+ */
+ err = xe_vm_lock_dma_resv(vm, ww, tv_onstack, tv, objs, true,
+ 1 + vm->xe->info.tile_count);
if (err)
return err;
diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index 15bff0783ec9..84d64fb3ac60 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -585,8 +585,13 @@ static void preempt_rebind_work_func(struct work_struct *w)
goto out_unlock_outer;
}
+ /*
+ * 1 fence for each preempt fence plus a fence for each tile from a
+ * possible rebind
+ */
err = xe_vm_lock_dma_resv(vm, &ww, tv_onstack, &tv, &objs,
- false, vm->preempt.num_engines);
+ false, vm->preempt.num_engines +
+ vm->xe->info.tile_count);
if (err)
goto out_unlock_outer;
--
2.34.1
More information about the Intel-xe
mailing list