aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Brost <[email protected]>2023-09-11 14:10:32 -0700
committerRodrigo Vivi <[email protected]>2023-12-21 11:41:07 -0500
commit30278e299646a1a8f9c1fd1da33768440f71bb42 (patch)
treefab3a09f91ac094037e402ceb8790e2cbe9e6e84
parent1f72718215ff2763653a82d9cbc41bfed3186caa (diff)
drm/xe: Fix fence reservation accouting
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. v2: Rebase Reviewed-by: Thomas Hellström <[email protected]> Reported-by: Christopher Snowhill <[email protected]> Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/518 Signed-off-by: Matthew Brost <[email protected]> Signed-off-by: Rodrigo Vivi <[email protected]>
-rw-r--r--drivers/gpu/drm/xe/xe_exec.c6
-rw-r--r--drivers/gpu/drm/xe/xe_vm.c7
2 files changed, 11 insertions, 2 deletions
diff --git a/drivers/gpu/drm/xe/xe_exec.c b/drivers/gpu/drm/xe/xe_exec.c
index eb7fc3192c22..293960efcd22 100644
--- a/drivers/gpu/drm/xe/xe_exec.c
+++ b/drivers/gpu/drm/xe/xe_exec.c
@@ -103,7 +103,11 @@ static int xe_exec_begin(struct drm_exec *exec, struct xe_vm *vm)
if (xe_vm_no_dma_fences(vm))
return 0;
- err = xe_vm_lock_dma_resv(vm, exec, 1, true);
+ /*
+ * 1 fence for job from exec plus a fence for each tile from a possible
+ * rebind
+ */
+ err = xe_vm_lock_dma_resv(vm, exec, 1 + vm->xe->info.tile_count, true);
if (err)
return err;
diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index 4def60249381..89f7428f00d7 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -519,8 +519,13 @@ static int xe_preempt_work_begin(struct drm_exec *exec, struct xe_vm *vm,
struct xe_vma *vma;
int err;
+ /*
+ * 1 fence for each preempt fence plus a fence for each tile from a
+ * possible rebind
+ */
err = drm_exec_prepare_obj(exec, xe_vm_obj(vm),
- vm->preempt.num_exec_queues);
+ vm->preempt.num_exec_queues +
+ vm->xe->info.tile_count);
if (err)
return err;