[PATCH] lib/xe/xe_spin: Add additional MI_ARB_CHECK to preemptable spin init
Jonathan Cavitt
jonathan.cavitt at intel.com
Thu Aug 14 18:50:10 UTC 2025
Add an additional MI_ARB_CHECK to the spin initialization function,
just before the conditional batch buffer end, when preemption is
enabled. The MI_ARB_CHECK forces a preemption in this case, which can
allow additionally scheduled exec queues to make independent progress
earlier than if we relied on the automatic timeout of the exec queue.
Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/5783
Suggested-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Signed-off-by: Jonathan Cavitt <jonathan.cavitt at intel.com>
Cc: Matthew Brost <matthew.brost at intel.com>
Cc: Niranjana Vishwanathapura <niranjana.vishwanathapura at intel.com>
---
lib/xe/xe_spin.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/xe/xe_spin.c b/lib/xe/xe_spin.c
index 25f7555e27..b3a937fe80 100644
--- a/lib/xe/xe_spin.c
+++ b/lib/xe/xe_spin.c
@@ -30,7 +30,6 @@
enum { START_TS, NOW_TS };
-
uint32_t xe_spin_nsec_to_ticks(int fd, int gt_id, uint64_t nsec)
{
uint32_t ticks = xe_nsec_to_ticks(fd, gt_id, nsec);
@@ -167,6 +166,9 @@ void xe_spin_init(struct xe_spin *spin, struct xe_spin_opts *opts)
opts->mem_copy->dst->mocs_index;
}
+ if (opts->preempt)
+ spin->batch[b++] = MI_ARB_CHECK;
+
spin->batch[b++] = MI_COND_BATCH_BUFFER_END | MI_DO_COMPARE | 2;
spin->batch[b++] = 0;
spin->batch[b++] = end_addr;
--
2.43.0
More information about the igt-dev
mailing list