Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] lib/xe: Retry xe_vm_bind on transient -EBUSY
@ 2026-05-12 15:39 nishit.sharma
  2026-05-12 22:35 ` ✓ i915.CI.BAT: success for " Patchwork
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: nishit.sharma @ 2026-05-12 15:39 UTC (permalink / raw)
  To: igt-dev, stuart.summers

From: Nishit Sharma <nishit.sharma@intel.com>

__xe_vm_bind_assert() can intermittently fail with -EBUSY when the
kernel rejects the bind because it detects in-flight work that has
not yet completed. This is transient condition the call is expected
to succeed once the competing work settles.

Add a retry loop (up to 5 attempts) that re-issues __xe_vm_bind()
whenever -EBUSY is returned, before asserting success. All other
error codes are treated as fatal and propagate immediately to
igt_assert_eq() as before.

Signed-off-by: Nishit Sharma <nishit.sharma@intel.com>
---
 lib/xe/xe_ioctl.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/lib/xe/xe_ioctl.c b/lib/xe/xe_ioctl.c
index e13195e16..3a307f95f 100644
--- a/lib/xe/xe_ioctl.c
+++ b/lib/xe/xe_ioctl.c
@@ -242,9 +242,24 @@ void  __xe_vm_bind_assert(int fd, uint32_t vm, uint32_t exec_queue, uint32_t bo,
 			  uint32_t op, uint32_t flags, struct drm_xe_sync *sync,
 			  uint32_t num_syncs, uint32_t prefetch_region, uint64_t ext)
 {
-	igt_assert_eq(__xe_vm_bind(fd, vm, exec_queue, bo, offset, addr, size,
-				   op, flags, sync, num_syncs, prefetch_region,
-				   DEFAULT_PAT_INDEX, ext), 0);
+	int ret, retries = 0;
+
+retry:
+	ret = __xe_vm_bind(fd, vm, exec_queue, bo, offset, addr, size,
+			   op, flags, sync, num_syncs, prefetch_region,
+			   DEFAULT_PAT_INDEX, ext);
+
+	if (ret && retries < 5) {
+		/*
+		 * Retry on transient -EBUSY, which can occur when the
+		 * kernel is contended by in-flight background work
+		 */
+		retries++;
+		goto retry;
+	}
+
+	igt_assert_eq(ret, 0);
+	return;
 }
 
 void xe_vm_prefetch_async(int fd, uint32_t vm, uint32_t exec_queue, uint64_t offset,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-05-14  9:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-12 15:39 [PATCH i-g-t] lib/xe: Retry xe_vm_bind on transient -EBUSY nishit.sharma
2026-05-12 22:35 ` ✓ i915.CI.BAT: success for " Patchwork
2026-05-13  0:47 ` ✓ Xe.CI.BAT: " Patchwork
2026-05-13  8:38 ` [PATCH i-g-t] " Jani Nikula
2026-05-13 17:46 ` ✗ Xe.CI.FULL: failure for " Patchwork
2026-05-13 21:42 ` ✗ i915.CI.Full: " Patchwork
2026-05-14  9:12 ` [PATCH i-g-t] " Zbigniew Kempczyński

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox