Skip to contentSkip to conversation

Add test for oversubscribing VRAM in multi process environment that creates VM, bind large BOs and submit workloads nearly simultaneously.

PATCH In review Sobin Thomas 4 participants 7 messages Jun 9 – Jun 16

lore
Share & tools
lore
#0 lore raw

PATCH v8 1/1 Add test for oversubscribing VRAM in multi process environment that creates VM, bind large BOs and submit workloads nearly simultaneously.

Previous coverage lacked a scenario combining multi-process bind with VRAM oversubscription. This generates memory pressure with multi-process VM Bind activity and concurrent submission, exercising the bind pipeline under eviction pressure.

v2: Removed helper APIs usage clock_nanosleep and commented code.(Nishit)

v3: Refactored code to smaller functions.
Added check for available SRAM usage and keep the max process to 20.

v4: Remove explicit macros definition
Replace Bind ioctl with library calls.(Thomas)
v5: Remove unused query_mem_info
Fix xe_exec_with_retry (Thomas)
Rename align_to_page_size with ALIGN macro (kamil/Thomas)
v6: Fix vm_bind_bo_batch: move igt_assert(ufence) before first dereference
Fix create_test_bos: check errno instead of ret for ENOMEM/ENOSPC detection, since igt_ioctl returns -1 on failure. (Thomas)
v7: Save errno immediately in create_test_bos before it can be clobbered.
Handle non-ENOMEM/ENOSPC failures in create_test_bos. Remove dead code (retries == 0 check) in xe_exec_with_retry. Add igt_skip when both vram and sram n_bufs are 0.
Add MAP_FAILED check on result_bo.ptr after xe_bo_map. (Nishit)
v8: Add error check while performing vmbind.

---
 tests/intel/xe_vm.c | 464 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 464 insertions(+)
tests/intel/xe_vm.c +464 -0
index 408bfdb71..ac2e335c0 100644
@@ -21,6 +21,7 @@
 #include "xe/xe_spin.h"
 #include <string.h>
 #define USER_FENCE_VALUE 0xdeadbeefdeadbeefull
+#define GB(x) (1024ULL * 1024ULL * 1024ULL * (x))
 
 enum overcommit_stage {
 	EXPECT_NONE,
@@ -29,6 +30,93 @@ enum overcommit_stage {
 	EXPECT_EXEC,
 };
 
+struct gem_bo {
+	uint32_t handle;
+	uint64_t size;
+	int *ptr;
+	uint64_t addr;
+};
+
+struct xe_test_ctx {
+	uint32_t vm_id;
+	uint32_t exec_queue_id;
+};
+
+struct mem_bind_sync {
+	struct gem_bo *bufs;
+	int n_bufs;
+	uint64_t *binds_ufence;
+};
+
+static void create_exec_queue(int fd, struct xe_test_ctx *ctx)
+{
+	struct drm_xe_engine_class_instance *hwe;
+	struct drm_xe_engine_class_instance eci = { 0 };
+
+	/* Use first available engine */
+	xe_for_each_engine(fd, hwe) {
+		eci = *hwe;
+		break;
+	}
+	ctx->exec_queue_id = xe_exec_queue_create(fd, ctx->vm_id, &eci, 0);
+}
+
+static int xe_vm_bind_array_get_err(int fd, uint32_t vm,
+				    struct drm_xe_vm_bind_op *bind_ops,
+				    uint32_t num_bind, struct drm_xe_sync *sync,
+				    uint32_t num_syncs)
+{
+	struct drm_xe_vm_bind bind = {
+		.vm_id = vm,
+		.num_binds = num_bind,
+		.vector_of_binds = (uintptr_t)bind_ops,
+		.num_syncs = num_syncs,
+		.syncs = (uintptr_t)sync,
+		.exec_queue_id = 0,
+	};
+
+	igt_assert(num_bind > 0);
+
+	if (igt_ioctl(fd, DRM_IOCTL_XE_VM_BIND, &bind))
+		return -errno;
+
+	return 0;
+}
+
+static uint64_t *
+vm_bind_bo_batch(int fd, struct xe_test_ctx *ctx, struct gem_bo *bos, int size, int *out_err)
+{
+	uint64_t *ufence;
+	struct drm_xe_sync bind_sync;
+	struct drm_xe_vm_bind_op binds[size];
+	int i, ret;
+
+	ufence = calloc(1, sizeof(uint64_t));
+	igt_assert(ufence);
+	*ufence = 0;
+	bind_sync = (struct drm_xe_sync) {
+		.type = DRM_XE_SYNC_TYPE_USER_FENCE,
+		.flags = DRM_XE_SYNC_FLAG_SIGNAL,
+		.addr = to_user_pointer(ufence),
+		.timeline_value = 1,
+	};
+
+	for (i = 0; i < size; i++) {
+		binds[i] = (struct drm_xe_vm_bind_op) {
+			.obj = bos[i].handle,
+			.obj_offset = 0,
+			.range = bos[i].size,
+			.addr = bos[i].addr,
+			.op = DRM_XE_VM_BIND_OP_MAP,
+			.flags = 0,
+		};
+	}
+	ret = xe_vm_bind_array_get_err(fd, ctx->vm_id, binds, size, &bind_sync, 1);
+	if (out_err)
+		*out_err = ret;
+	return ufence;
+}
+
 static uint32_t
 addr_low(uint64_t addr)
 {
@@ -3073,6 +3161,377 @@ static void test_get_property(int fd, void (*func)(int fd, uint32_t vm))
 	xe_vm_destroy(fd, vm);
 }
 
+static int build_add_batch(struct gem_bo *batch_bo, struct gem_bo *integers_bo,
+			   struct gem_bo *result_bo, int ints_to_add)
+{
+	int pos = 0;
+	uint64_t tmp_addr;
+	#define GPR_RX_ADDR(x)		(0x600 + (x) * 8)
+
+	batch_bo->ptr[pos++] =  MI_LOAD_REGISTER_MEM_CMD | MI_LRI_LRM_CS_MMIO | 2;
+	batch_bo->ptr[pos++] = GPR_RX_ADDR(0);
+	tmp_addr = integers_bo->addr + 0 * sizeof(uint32_t);
+	batch_bo->ptr[pos++] = tmp_addr & 0xFFFFFFFF;
+	batch_bo->ptr[pos++] = (tmp_addr >> 32) & 0xFFFFFFFF;
+	for (int i = 1; i < ints_to_add; i++) {
+		/* r1 = integers_bo[i] */
+		batch_bo->ptr[pos++] =  MI_LOAD_REGISTER_MEM_CMD | MI_LRI_LRM_CS_MMIO | 2;
+		batch_bo->ptr[pos++] = GPR_RX_ADDR(1);
+		tmp_addr = integers_bo->addr + i * sizeof(uint32_t);
+		batch_bo->ptr[pos++] = tmp_addr & 0xFFFFFFFF;
+		batch_bo->ptr[pos++] = (tmp_addr >> 32) & 0xFFFFFFFF;
+		/* r0 = r0 + r1 */
+		batch_bo->ptr[pos++] = MI_MATH(4);
+		batch_bo->ptr[pos++] = MI_MATH_LOAD(MI_MATH_REG_SRCA, MI_MATH_REG(0));
+		batch_bo->ptr[pos++] = MI_MATH_LOAD(MI_MATH_REG_SRCB, MI_MATH_REG(1));
+		batch_bo->ptr[pos++] = MI_MATH_ADD;
+		batch_bo->ptr[pos++] = MI_MATH_STORE(MI_MATH_REG(0), MI_MATH_REG_ACCU);
+	}
+	/* result_bo[0] = r0 */
+	batch_bo->ptr[pos++] = MI_STORE_REGISTER_MEM_GEN8 | MI_LRI_LRM_CS_MMIO;
+	batch_bo->ptr[pos++] = GPR_RX_ADDR(0);
+	tmp_addr = result_bo->addr + 0 * sizeof(uint32_t);
+	batch_bo->ptr[pos++] = tmp_addr & 0xFFFFFFFF;
+	batch_bo->ptr[pos++] = (tmp_addr >> 32) & 0xFFFFFFFF;
+
+	batch_bo->ptr[pos++] = MI_BATCH_BUFFER_END;
+	while (pos % 4 != 0)
+		batch_bo->ptr[pos++] = MI_NOOP;
+	return pos;
+}
+
+static void create_test_bos(int fd, struct xe_test_ctx *ctx, struct mem_bind_sync *bind,
+			    uint32_t  placement, uint64_t *addr)
+{
+	const char *mem_type = (placement & vram_memory(fd, 0)) ? "VRAM" : "SRAM";
+	uint32_t ret;
+
+	for (int i = 0; i < bind->n_bufs; i++) {
+		struct gem_bo *bo = &bind->bufs[i];
+
+		bo->size = GB(1);
+		ret = __xe_bo_create_caching(fd, ctx->vm_id, bo->size, placement, 0,
+					     DRM_XE_GEM_CPU_CACHING_WC, &bo->handle);
+		if (ret) {
+			int saved_errno = errno; /* capture before anything can clobber it */
+
+			bind->n_bufs = i;
+			if (saved_errno == ENOMEM || saved_errno == ENOSPC)
+				igt_debug("%s allocation failed at buffer %d (OOM)\n", mem_type, i);
+			else
+				igt_assert_f(false, "%s allocation failed at buffer %d: %s",
+					     mem_type, i, strerror(saved_errno));
+			break;
+		}
+		bo->ptr = NULL;
+		bo->addr = *addr;
+		*addr += bo->size;
+		igt_debug("%s buffer %d created at 0x%016lx\n", mem_type, i, bo->addr);
+	}
+}
+
+static int fill_random_integers(struct gem_bo *int_bo, int ints_to_add)
+{
+	uint32_t expected_result = 0;
+
+	for (int i = 0; i < ints_to_add; i++) {
+		int random_int = rand() % 8;
+
+		int_bo->ptr[i] = random_int;
+		expected_result += random_int;
+
+		igt_debug("%d", random_int);
+		if (i + 1 != ints_to_add)
+			igt_debug(" + ");
+		else
+			igt_debug(" = ");
+	}
+	igt_debug("%d\n", expected_result);
+	return expected_result;
+}
+
+/*
+ * In concurrent VM bind stress tests, multiple threads simultaneously bind
+ * buffers to GPU virtual address space and submit batch operations. This
+ * creates significant GPU memory pressure where the kernel may transiently
+ * fail batch submission when:
+ *   - GPU page tables are being updated across multiple bindings
+ *   - GPU memory is fragmented across many concurrent buffer mappings
+ *   - Multiple processes compete for finite GPU resources
+ *
+ * Without retries, transient ENOMEM/ENOSPC failures cause false test failures.
+ * Retrying lets us distinguish temporary resource exhaustion from actual
+ * driver bugs. Non ENOMEM/ENOSPC errors still fail immediately and are properly
+ * reported with full errno context for debugging.
+ */
+static int xe_exec_with_retry(int fd, struct drm_xe_exec *exec, int max_retries)
+{
+	int rc = 0, retries;
+
+	for (retries = 1; retries < max_retries; retries++) {
+		rc = igt_ioctl(fd, DRM_IOCTL_XE_EXEC, exec);
+
+		if (!(rc && (errno == ENOMEM || errno == ENOSPC)))
+			break;
+
+		igt_warn("got %s, retrying (%d/%d)\n", strerror(errno), retries, max_retries);
+		usleep(100 * retries);
+	}
+
+	if (retries == max_retries)
+		igt_warn("gave up after %d retries\n", retries);
+
+	if (rc)
+		igt_warn("errno: %d (%s)\n", errno, strerror(errno));
+
+	return rc;
+}
+
+static void cleanup_bo_resources(int fd, struct gem_bo *bo)
+{
+	if (bo->ptr) {
+		igt_assert_eq(munmap(bo->ptr, bo->size), 0);
+		bo->ptr = NULL;
+	}
+	if (bo->handle)
+		gem_close(fd, bo->handle);
+}
+
+static void cleanup_sram_vram_objs(int fd, struct mem_bind_sync *vram_bind,
+				   struct mem_bind_sync *sram_bind)
+{
+	for (int i = 0; i < vram_bind->n_bufs; i++)
+		gem_close(fd, vram_bind->bufs[i].handle);
+	for (int i = 0; i < sram_bind->n_bufs; i++)
+		gem_close(fd, sram_bind->bufs[i].handle);
+	free(vram_bind->bufs);
+	free(sram_bind->bufs);
+	if (vram_bind->n_bufs)
+		free(vram_bind->binds_ufence);
+	if (sram_bind->n_bufs)
+		free(sram_bind->binds_ufence);
+}
+
+/**
+ * SUBTEST: oversubscribe-concurrent-bind
+ * Description: Test for oversubscribing the VM with multiple processes
+ * doing binds at the same time, and ensure they all complete successfully.
+ * Functionality: This check is for a specific bug where if multiple processes
+ * oversubscribe the VM, some of the binds may fail with  ENOMEM due to
+ * deadlock in the bind code.
+ * Test category: stress test
+ */
+static void test_vm_oversubscribe_concurrent_bind(int fd)
+{
+	#define MIN_BUFS_PER_PROC 2
+	#define MAX_THREADS 20
+	/*
+	 * Cap SRAM test usage on large-RAM platforms (e.g. PVC). On small-RAM
+	 * platforms (e.g. BMG with ~32 GB RAM) 50% of RAM is ~16 GB which is
+	 * below this cap, so behavior is unchanged. On large-RAM platforms
+	 * 50% can be hundreds of GB; cap it to a bounded value that still
+	 * provides meaningful memory pressure for the concurrent bind test.
+	 */
+	#define MAX_SRAM_TEST_SIZE GB(32)
+	int n_proc = 0, n_vram_bufs = 0, n_sram_bufs = 0;
+	uint32_t max_by_mem;
+	uint64_t total_vram_demand = 0;
+	uint64_t vram_size = xe_visible_available_vram_size(fd, 0);
+	uint64_t sram_avail = (uint64_t)igt_get_avail_ram_mb() << 20;
+	uint64_t target_vram = vram_size * 2;
+	uint64_t target_sram, total_vram_bufs, total_sram_bufs;
+	pthread_barrier_t *barrier;
+	pthread_barrierattr_t attr;
+	/*
+	 * Dynamically cap VRAM oversubscription so the overflow into system
+	 * RAM stays within 25% of available RAM. On small-VRAM platforms
+	 * (e.g. BMG) the 2x target fits within the cap and behavior is
+	 * unchanged; on large-VRAM platforms (e.g. PVC) this prevents OOM.
+	 */
+	target_vram = min(target_vram, vram_size + sram_avail / 4);
+	target_sram = min_t(uint64_t, sram_avail * 50 / 100,
+			    MAX_SRAM_TEST_SIZE);
+
+	total_vram_bufs = target_vram / GB(1);
+	total_sram_bufs = target_sram / GB(1);
+
+	/* determine concurrency from memory pressure */
+
+	max_by_mem = min(total_vram_bufs / MIN_BUFS_PER_PROC,
+			 total_sram_bufs / MIN_BUFS_PER_PROC);
+	n_proc = min_t(uint32_t, max_by_mem, MAX_THREADS);
+	igt_require_f(n_proc > 0, "Not enough VRAM/RAM for oversubscription test\n");
+
+	n_vram_bufs = max_t(int, 2, total_vram_bufs / n_proc);
+	n_sram_bufs = max_t(int, 2, total_sram_bufs / n_proc);
+	total_vram_demand = (uint64_t)n_proc * n_vram_bufs * GB(1);
+
+	igt_debug("VRAM size: %" PRIu64 "MB, System RAM available: %" PRIu64 "MB\n",
+		  vram_size >> 20, sram_avail >> 20);
+
+	igt_debug(" n_proc = %d\n", n_proc);
+	igt_debug("VRAM: %" PRIu64 "GB\n", vram_size >> 30);
+	igt_debug("VRAM demand: %" PRIu64 "MB (%.2fx oversubscription)\n",
+		  total_vram_demand >> 20, (double)total_vram_demand / vram_size);
+	igt_debug("Processes=%d VRAM_bufs=%d SRAM_bufs=%d\n", n_proc,
+		  n_vram_bufs, n_sram_bufs);
+
+	barrier = mmap(NULL, sizeof(pthread_barrier_t),
+		       PROT_READ | PROT_WRITE,
+		       MAP_SHARED | MAP_ANONYMOUS, -1, 0);
+	igt_assert(barrier != MAP_FAILED);
+	pthread_barrierattr_init(&attr);
+	pthread_barrierattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
+	pthread_barrier_init(barrier, &attr, n_proc);
+
+	igt_fork(child, n_proc) {
+		struct xe_test_ctx ctx = {0};
+		int rc;
+		uint64_t addr = 0x40000000;
+		int expected_result = 0, ints_to_add = 4;
+		int max_retries = 1024;
+		struct gem_bo integers_bo, result_bo, batch_bo, *vram_bufs, *sram_bufs;
+		int pos = 0;
+		struct mem_bind_sync vram_bind = {0};
+		struct mem_bind_sync sram_bind = {0};
+		struct drm_xe_sync batch_syncs[1];
+		struct drm_xe_exec exec;
+		struct gem_bo ufence_bo = {0};
+		int vram_bind_err = 0, sram_bind_err = 0;
+
+		vram_bufs = (struct gem_bo *)calloc(n_vram_bufs, sizeof(struct gem_bo));
+		sram_bufs = (struct gem_bo *)calloc(n_sram_bufs, sizeof(struct gem_bo));
+		srand(child);
+
+		igt_assert(vram_bufs && sram_bufs);
+
+		ctx.vm_id = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_SCRATCH_PAGE, 0);
+		create_exec_queue(fd, &ctx);
+		vram_bind.bufs = vram_bufs;
+		vram_bind.n_bufs = n_vram_bufs;
+		sram_bind.bufs = sram_bufs;
+		sram_bind.n_bufs = n_sram_bufs;
+
+		create_test_bos(fd, &ctx, &vram_bind, vram_memory(fd, 0), &addr);
+		create_test_bos(fd, &ctx, &sram_bind, system_memory(fd), &addr);
+
+		if (!vram_bind.n_bufs && !sram_bind.n_bufs)
+			igt_skip("No BOs allocated; VRAM/SRAM unavailable, skipping\n");
+
+		pthread_barrier_wait(barrier);
+
+		if (vram_bind.n_bufs)
+			vram_bind.binds_ufence =
+				vm_bind_bo_batch(fd, &ctx, vram_bufs,
+						 vram_bind.n_bufs, &vram_bind_err);
+
+		if (sram_bind.n_bufs)
+			sram_bind.binds_ufence =
+				vm_bind_bo_batch(fd, &ctx, sram_bufs,
+						 sram_bind.n_bufs, &sram_bind_err);
+
+		if (vram_bind_err) {
+			if (vram_bind_err == -ENOMEM || vram_bind_err == -ENOSPC) {
+				igt_debug("VRAM bind OOM (error: %d) - expected on oversubscription\n",
+					  vram_bind_err);
+				vram_bind.n_bufs = 0;
+			} else {
+				igt_assert_f(0, "Unexpected VRAM bind error: %d", vram_bind_err);
+			}
+		}
+
+		/* Assert if there is any bind error in SRAM */
+		if (sram_bind_err)
+			igt_assert_f(0, "Unexpected SRAM bind error: %d", sram_bind_err);
+
+		integers_bo.size = ALIGN(sizeof(int) * ints_to_add, 4096);
+		integers_bo.handle = xe_bo_create_caching(fd, ctx.vm_id, integers_bo.size,
+							  system_memory(fd), 0,
+							  DRM_XE_GEM_CPU_CACHING_WC);
+		integers_bo.ptr = (int *)xe_bo_map(fd, integers_bo.handle, integers_bo.size);
+		integers_bo.addr = 0x100000;
+
+		expected_result = fill_random_integers(&integers_bo, ints_to_add);
+		igt_debug("%d\n", expected_result);
+
+		result_bo.size = ALIGN(sizeof(int), 4096);
+		result_bo.handle  = xe_bo_create_caching(fd, ctx.vm_id, result_bo.size,
+							 system_memory(fd), 0,
+							 DRM_XE_GEM_CPU_CACHING_WC);
+		result_bo.ptr = NULL;
+		result_bo.addr = 0x200000;
+
+		batch_bo.size = 4096;
+		batch_bo.handle = xe_bo_create_caching(fd, ctx.vm_id, batch_bo.size,
+						       system_memory(fd), 0,
+						       DRM_XE_GEM_CPU_CACHING_WC);
+
+		batch_bo.ptr = (int *)xe_bo_map(fd, batch_bo.handle, batch_bo.size);
+		batch_bo.addr = 0x300000;
+
+		pos = build_add_batch(&batch_bo, &integers_bo, &result_bo, ints_to_add);
+
+		igt_assert(pos * sizeof(int) <= batch_bo.size);
+
+		/* Wait for large bind operations to complete before binding small BOs */
+		if (vram_bind.n_bufs)
+			xe_wait_ufence(fd, vram_bind.binds_ufence, 1, 0, INT64_MAX);
+		if (sram_bind.n_bufs)
+			xe_wait_ufence(fd, sram_bind.binds_ufence, 1, 0, INT64_MAX);
+
+		xe_vm_bind_lr_sync(fd, ctx.vm_id, integers_bo.handle, 0, integers_bo.addr,
+				   integers_bo.size, 0);
+		xe_vm_bind_lr_sync(fd, ctx.vm_id, result_bo.handle, 0, result_bo.addr,
+				   result_bo.size, 0);
+		xe_vm_bind_lr_sync(fd, ctx.vm_id, batch_bo.handle, 0, batch_bo.addr,
+				   batch_bo.size, 0);
+
+		ufence_bo.size = 4096;
+		ufence_bo.handle = xe_bo_create_caching(fd, ctx.vm_id, ufence_bo.size,
+							system_memory(fd), 0,
+							DRM_XE_GEM_CPU_CACHING_WB);
+		ufence_bo.ptr = (int *)xe_bo_map(fd, ufence_bo.handle, ufence_bo.size);
+		ufence_bo.addr = 0x400000;
+		memset(ufence_bo.ptr, 0, ufence_bo.size);
+		xe_vm_bind_lr_sync(fd, ctx.vm_id, ufence_bo.handle, 0, ufence_bo.addr,
+				   ufence_bo.size, 0);
+
+		batch_syncs[0] = (struct drm_xe_sync){
+			.type = DRM_XE_SYNC_TYPE_USER_FENCE,
+			.flags = DRM_XE_SYNC_FLAG_SIGNAL,
+			.addr = ufence_bo.addr,
+			.timeline_value = 1,
+		};
+
+		exec = (struct drm_xe_exec) {
+			.exec_queue_id = ctx.exec_queue_id,
+			.num_syncs = 1,
+			.syncs = (uintptr_t)batch_syncs,
+			.address = batch_bo.addr,
+			.num_batch_buffer = 1,
+		};
+
+		rc = xe_exec_with_retry(fd, &exec, max_retries);
+		igt_assert_eq(rc, 0);
+		xe_wait_ufence(fd, (uint64_t *)ufence_bo.ptr, 1, ctx.exec_queue_id, INT64_MAX);
+		result_bo.ptr = (int *)xe_bo_map(fd, result_bo.handle, result_bo.size);
+		igt_assert(result_bo.ptr != MAP_FAILED);
+		igt_assert_eq(result_bo.ptr[0], expected_result);
+		cleanup_bo_resources(fd, &ufence_bo);
+		cleanup_bo_resources(fd, &result_bo);
+		cleanup_bo_resources(fd, &batch_bo);
+		cleanup_bo_resources(fd, &integers_bo);
+		cleanup_sram_vram_objs(fd, &vram_bind, &sram_bind);
+		xe_exec_queue_destroy(fd, ctx.exec_queue_id);
+		xe_vm_destroy(fd, ctx.vm_id);
+		close(fd);
+	}
+	igt_waitchildren();
+	pthread_barrier_destroy(barrier);
+	pthread_barrierattr_destroy(&attr);
+	igt_assert_eq(munmap(barrier, sizeof(pthread_barrier_t)), 0);
+}
+
 int igt_main()
 {
 	struct drm_xe_engine_class_instance *hwe, *hwe_non_copy = NULL;
@@ -3486,6 +3945,11 @@ int igt_main()
 		igt_assert(xe_visible_vram_size(fd, 0));
 		test_oom(fd);
 	}
+	igt_subtest("oversubscribe-concurrent-bind")
+	{
+		igt_require(xe_has_vram(fd));
+		test_vm_oversubscribe_concurrent_bind(fd);
+	}
 
 	for (const struct vm_get_property *f = xe_vm_get_property_tests; f->name; f++) {
 		igt_subtest_f("vm-get-property-%s", f->name)
Signature · 1 line
2.43.0
#1 lore raw

✓ Xe.CI.BAT: success for Add test for oversubscribing VRAM in multi process environment that creates VM, bind large BOs and submit workloads nearly simultaneously.

== Series Details ==

== Series Details ==

Series: Add test for oversubscribing VRAM in multi process environment that creates VM, bind large BOs and submit workloads nearly simultaneously.
URL : https://patchwork.freedesktop.org/series/168149/
State : success

== Summary ==

CI Bug Log - changes from XEIGT_8955_BAT -> XEIGTPW_15331_BAT
====================================================

Summary
-------

**SUCCESS**

No regressions found.

Participating hosts (13 -> 13)
------------------------------

No changes in participating hosts

Known issues
------------

Here are the changes found in XEIGTPW_15331_BAT that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@xe_live_ktest@xe_dma_buf:
- bat-bmg-vm: [PASS][1] -> [ABORT][2] ([Intel XE#8007] / [Intel XE#8023]) +1 other test abort
[1]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_8955/bat-bmg-vm/igt@xe_live_ktest@xe_dma_buf.html
[2]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/bat-bmg-vm/igt@xe_live_ktest@xe_dma_buf.html

[Intel XE#8007]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/8007
[Intel XE#8023]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/8023

Build changes
-------------

* IGT: IGT_8955 -> IGTPW_15331
* Linux: xe-5224-e591d473e392997b89c9ab9598bfe027c59ac21c -> xe-5225-1e8798282ef0590ad21ca33d80e225208d9c7864

IGTPW_15331: 15331
IGT_8955: 8955
xe-5224-e591d473e392997b89c9ab9598bfe027c59ac21c: e591d473e392997b89c9ab9598bfe027c59ac21c xe-5225-1e8798282ef0590ad21ca33d80e225208d9c7864: 1e8798282ef0590ad21ca33d80e225208d9c7864

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/index.html

#2 lore raw

✓ i915.CI.BAT: success for Add test for oversubscribing VRAM in multi process environment that creates VM, bind large BOs and submit workloads nearly simultaneously.

In reply to Sobin Thomas
== Series Details ==

== Series Details ==

Series: Add test for oversubscribing VRAM in multi process environment that creates VM, bind large BOs and submit workloads nearly simultaneously.
URL : https://patchwork.freedesktop.org/series/168149/
State : success

== Summary ==

CI Bug Log - changes from IGT_8955 -> IGTPW_15331
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15331/index.html

Participating hosts (42 -> 39)
------------------------------

Missing (3): bat-dg2-13 fi-snb-2520m bat-adls-6

Changes
-------

No changes found

Build changes
-------------

* CI: CI-20190529 -> None
* IGT: IGT_8955 -> IGTPW_15331
* Linux: CI_DRM_18647 -> CI_DRM_18648

CI-20190529: 20190529
CI_DRM_18647: e591d473e392997b89c9ab9598bfe027c59ac21c @ git://anongit.freedesktop.org/gfx-ci/linux
CI_DRM_18648: 1e8798282ef0590ad21ca33d80e225208d9c7864 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_15331: 15331
IGT_8955: 8955

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15331/index.html

#3 lore raw

✗ Xe.CI.FULL: failure for Add test for oversubscribing VRAM in multi process environment that creates VM, bind large BOs and submit workloads nearly simultaneously.

In reply to Sobin Thomas
== Series Details ==

== Series Details ==

Series: Add test for oversubscribing VRAM in multi process environment that creates VM, bind large BOs and submit workloads nearly simultaneously.
URL : https://patchwork.freedesktop.org/series/168149/
State : failure

== Summary ==

CI Bug Log - changes from XEIGT_8955_FULL -> XEIGTPW_15331_FULL
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with XEIGTPW_15331_FULL absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes
introduced in XEIGTPW_15331_FULL, please notify your bug team ([email protected]) to allow them to document this new failure mode, which will reduce false positives in CI.

Participating hosts (2 -> 2)
------------------------------

No changes in participating hosts

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in XEIGTPW_15331_FULL:

### IGT changes ###

#### Possible regressions ####

* igt@xe_spin_batch@spin-fixed-duration-with-preempter:
- shard-bmg: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_8955/shard-bmg-7/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-9/igt@[email protected]

New tests
---------

New tests have been introduced between XEIGT_8955_FULL and XEIGTPW_15331_FULL:

### New IGT tests (1) ###

* igt@xe_vm@oversubscribe-concurrent-bind:
- Statuses : 1 pass(s) 1 skip(s)
- Exec time: [0.0, 1.77] s

Known issues
------------

Here are the changes found in XEIGTPW_15331_FULL that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@kms_big_fb@x-tiled-32bpp-rotate-90:
- shard-bmg: NOTRUN -> [SKIP][3] ([Intel XE#2327])
[3]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-7/igt@[email protected]

* igt@kms_big_fb@y-tiled-16bpp-rotate-180:
- shard-bmg: NOTRUN -> [SKIP][4] ([Intel XE#1124]) +4 other tests skip
[4]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-8/igt@[email protected]

* igt@kms_bw@connected-linear-tiling-4-displays-target-3840x2160p:
- shard-bmg: NOTRUN -> [SKIP][5] ([Intel XE#7679])
[5]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-5/igt@[email protected]

* igt@kms_bw@linear-tiling-4-displays-target-2160x1440p:
- shard-bmg: NOTRUN -> [SKIP][6] ([Intel XE#367])
[6]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-6/igt@[email protected]

* igt@kms_ccs@ccs-on-another-bo-y-tiled-gen12-mc-ccs:
- shard-bmg: NOTRUN -> [SKIP][7] ([Intel XE#2887]) +4 other tests skip
[7]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-5/igt@[email protected]

* igt@kms_ccs@crc-sprite-planes-basic-4-tiled-lnl-ccs@pipe-d-hdmi-a-3:
- shard-bmg: NOTRUN -> [SKIP][8] ([Intel XE#2652]) +8 other tests skip
[8]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-7/igt@kms_ccs@[email protected]

* igt@kms_chamelium_color@ctm-max:
- shard-bmg: NOTRUN -> [SKIP][9] ([Intel XE#2325] / [Intel XE#7358])
[9]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-9/igt@[email protected]

* igt@kms_chamelium_hpd@dp-hpd-enable-disable-mode:
- shard-bmg: NOTRUN -> [SKIP][10] ([Intel XE#2252]) +2 other tests skip
[10]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-5/igt@[email protected]

* igt@kms_content_protection@dp-mst-lic-type-1:
- shard-bmg: NOTRUN -> [SKIP][11] ([Intel XE#2390] / [Intel XE#6974])
[11]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-10/igt@[email protected]

* igt@kms_cursor_crc@cursor-sliding-64x21:
- shard-bmg: NOTRUN -> [SKIP][12] ([Intel XE#2320]) +2 other tests skip
[12]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-8/igt@[email protected]

* igt@kms_cursor_crc@cursor-tearing-position-change@pipe-d-dp-2:
- shard-bmg: NOTRUN -> [ABORT][13] ([Intel XE#8007]) +1 other test abort
[13]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-10/igt@kms_cursor_crc@[email protected]

* igt@kms_cursor_legacy@flip-vs-cursor-atomic:
- shard-bmg: [PASS][14] -> [FAIL][15] ([Intel XE#7571]) +1 other test fail
[14]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_8955/shard-bmg-10/igt@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-8/igt@[email protected]

* igt@kms_dsc@dsc-with-bpc-formats:
- shard-bmg: NOTRUN -> [SKIP][16] ([Intel XE#8265]) +1 other test skip
[16]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-10/igt@[email protected]

* igt@kms_flip@flip-vs-expired-vblank@b-edp1:
- shard-lnl: [PASS][17] -> [FAIL][18] ([Intel XE#301])
[17]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_8955/shard-lnl-4/igt@kms_flip@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-lnl-7/igt@kms_flip@[email protected]

* igt@kms_flip_scaled_crc@flip-32bpp-ytile-to-32bpp-ytilegen12rcccs-upscaling:
- shard-bmg: NOTRUN -> [SKIP][19] ([Intel XE#7178] / [Intel XE#7351]) +2 other tests skip
[19]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-10/igt@kms_flip_scaled_crc@flip-32bpp-ytile-to-32bpp-ytilegen12rcccs-upscaling.html

* igt@kms_flip_scaled_crc@flip-64bpp-4tile-to-32bpp-4tiledg2rcccs-upscaling:
- shard-bmg: NOTRUN -> [SKIP][20] ([Intel XE#7178] / [Intel XE#7349])
[20]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-8/igt@kms_flip_scaled_crc@flip-64bpp-4tile-to-32bpp-4tiledg2rcccs-upscaling.html

* igt@kms_flip_scaled_crc@flip-64bpp-linear-to-32bpp-linear-upscaling:
- shard-bmg: [PASS][21] -> [ABORT][22] ([Intel XE#8007]) +1 other test abort
[21]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_8955/shard-bmg-7/igt@kms_flip_scaled_crc@flip-64bpp-linear-to-32bpp-linear-upscaling.html
[22]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-1/igt@kms_flip_scaled_crc@flip-64bpp-linear-to-32bpp-linear-upscaling.html

* igt@kms_flip_scaled_crc@flip-p016-linear-to-p016-linear-reflect-x:
- shard-bmg: NOTRUN -> [SKIP][23] ([Intel XE#7179])
[23]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-7/igt@kms_flip_scaled_crc@flip-p016-linear-to-p016-linear-reflect-x.html

* igt@kms_frontbuffer_tracking@drrshdr-slowdraw:
- shard-bmg: NOTRUN -> [SKIP][24] ([Intel XE#2311]) +26 other tests skip
[24]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-3/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-1p-offscreen-pri-shrfb-draw-mmap-wc:
- shard-bmg: NOTRUN -> [SKIP][25] ([Intel XE#4141]) +8 other tests skip
[25]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-9/igt@kms_frontbuffer_tracking@fbc-1p-offscreen-pri-shrfb-draw-mmap-wc.html

* igt@kms_frontbuffer_tracking@fbcpsr-abgr161616f-draw-render:
- shard-bmg: NOTRUN -> [SKIP][26] ([Intel XE#7061] / [Intel XE#7356]) +1 other test skip
[26]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-3/igt@[email protected]

* igt@kms_frontbuffer_tracking@psr-1p-primscrn-cur-indfb-draw-blt:
- shard-bmg: NOTRUN -> [SKIP][27] ([Intel XE#2313]) +22 other tests skip
[27]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-6/igt@[email protected]

* igt@kms_frontbuffer_tracking@psrhdr-abgr161616f-draw-blt:
- shard-bmg: NOTRUN -> [SKIP][28] ([Intel XE#7061])
[28]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-3/igt@[email protected]

* igt@kms_hdmi_inject@inject-audio:
- shard-bmg: [PASS][29] -> [SKIP][30] ([Intel XE#7308])
[29]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_8955/shard-bmg-4/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-8/igt@[email protected]

* igt@kms_hdr@static-swap@pipe-a-hdmi-a-3-xrgb2101010:
- shard-bmg: [PASS][31] -> [SKIP][32] ([Intel XE#7915]) +1 other test skip
[31]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_8955/shard-bmg-9/igt@kms_hdr@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-7/igt@kms_hdr@[email protected]

* igt@kms_joiner@basic-ultra-joiner:
- shard-bmg: NOTRUN -> [SKIP][33] ([Intel XE#6911] / [Intel XE#7378])
[33]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-5/igt@[email protected]

* igt@kms_plane@pixel-format-4-tiled-lnl-ccs-modifier-source-clamping:
- shard-bmg: NOTRUN -> [SKIP][34] ([Intel XE#7283]) +1 other test skip
[34]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-4/igt@kms_plane@pixel-format-4-tiled-lnl-ccs-modifier-source-clamping.html

* igt@kms_pm_backlight@fade:
- shard-bmg: NOTRUN -> [SKIP][35] ([Intel XE#7376] / [Intel XE#7760] / [Intel XE#870])
[35]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-1/igt@[email protected]

* igt@kms_pm_dc@dc5-dpms:
- shard-lnl: [PASS][36] -> [FAIL][37] ([Intel XE#7340] / [Intel XE#7504])
[36]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_8955/shard-lnl-4/igt@[email protected]
[37]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-lnl-8/igt@[email protected]

* igt@kms_pm_rpm@modeset-lpsp-stress:
- shard-bmg: NOTRUN -> [SKIP][38] ([Intel XE#1439] / [Intel XE#3141] / [Intel XE#7383] / [Intel XE#836])
[38]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-10/igt@[email protected]

* igt@kms_psr2_sf@fbc-pr-cursor-plane-move-continuous-sf:
- shard-bmg: NOTRUN -> [SKIP][39] ([Intel XE#1489]) +3 other tests skip
[39]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-8/igt@[email protected]

* igt@kms_psr2_su@frontbuffer-xrgb8888:
- shard-bmg: NOTRUN -> [SKIP][40] ([Intel XE#2387] / [Intel XE#7429])
[40]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-7/igt@[email protected]

* igt@kms_psr@pr-sprite-plane-onoff:
- shard-bmg: NOTRUN -> [SKIP][41] ([Intel XE#2234] / [Intel XE#2850]) +5 other tests skip
[41]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-6/igt@[email protected]

* igt@kms_psr_stress_test@flip-primary-invalidate-overlay:
- shard-lnl: [PASS][42] -> [SKIP][43] ([Intel XE#4692] / [Intel XE#7508])
[42]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_8955/shard-lnl-1/igt@[email protected]
[43]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-lnl-1/igt@[email protected]

* igt@kms_rotation_crc@primary-yf-tiled-reflect-x-90:
- shard-bmg: NOTRUN -> [SKIP][44] ([Intel XE#3904] / [Intel XE#7342])
[44]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-6/igt@[email protected]

* igt@kms_scaling_modes@scaling-mode-full:
- shard-bmg: NOTRUN -> [SKIP][45] ([Intel XE#2413])
[45]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-4/igt@[email protected]

* igt@kms_tiled_display@basic-test-pattern-with-chamelium:
- shard-bmg: NOTRUN -> [SKIP][46] ([Intel XE#2426] / [Intel XE#5848])
[46]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-6/igt@[email protected]

* igt@kms_vrr@lobf:
- shard-bmg: NOTRUN -> [SKIP][47] ([Intel XE#2168] / [Intel XE#7444])
[47]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-8/igt@[email protected]

* igt@xe_compute@ccs-mode-compute-kernel:
- shard-bmg: NOTRUN -> [SKIP][48] ([Intel XE#6599])
[48]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-5/igt@[email protected]

* igt@xe_eudebug_online@single-step:
- shard-bmg: NOTRUN -> [SKIP][49] ([Intel XE#7636]) +4 other tests skip
[49]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-4/igt@[email protected]

* igt@xe_exec_basic@multigpu-many-execqueues-many-vm-bindexecqueue-userptr-invalidate:
- shard-bmg: NOTRUN -> [SKIP][50] ([Intel XE#2322] / [Intel XE#7372]) +3 other tests skip
[50]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-4/igt@xe_exec_basic@multigpu-many-execqueues-many-vm-bindexecqueue-userptr-invalidate.html

* igt@xe_exec_fault_mode@twice-multi-queue-imm:
- shard-bmg: NOTRUN -> [SKIP][51] ([Intel XE#7136]) +6 other tests skip
[51]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-8/igt@[email protected]

* igt@xe_exec_multi_queue@max-queues-preempt-mode-fault-dyn-priority:
- shard-bmg: NOTRUN -> [SKIP][52] ([Intel XE#6874]) +11 other tests skip
[52]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-7/igt@xe_exec_multi_queue@max-queues-preempt-mode-fault-dyn-priority.html

* igt@xe_exec_threads@threads-multi-queue-cm-fd-userptr-rebind:
- shard-bmg: NOTRUN -> [SKIP][53] ([Intel XE#7138]) +3 other tests skip
[53]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-5/igt@[email protected]

* igt@xe_mmap@small-bar:
- shard-bmg: NOTRUN -> [SKIP][54] ([Intel XE#586] / [Intel XE#7323] / [Intel XE#7384])
[54]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-7/igt@[email protected]

* igt@xe_multigpu_svm@mgpu-atomic-op-basic:
- shard-bmg: NOTRUN -> [SKIP][55] ([Intel XE#6964]) +1 other test skip
[55]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-7/igt@[email protected]

* igt@xe_page_reclaim@many-vma-same-bo:
- shard-bmg: NOTRUN -> [SKIP][56] ([Intel XE#7793]) +1 other test skip
[56]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-8/igt@[email protected]

* igt@xe_pm@d3hot-i2c:
- shard-bmg: NOTRUN -> [SKIP][57] ([Intel XE#5742] / [Intel XE#7328] / [Intel XE#7400])
[57]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-3/igt@[email protected]

* igt@xe_pxp@pxp-stale-bo-bind-post-termination-irq:
- shard-bmg: NOTRUN -> [SKIP][58] ([Intel XE#4733] / [Intel XE#7417])
[58]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-6/igt@[email protected]

* igt@xe_query@multigpu-query-topology:
- shard-bmg: NOTRUN -> [SKIP][59] ([Intel XE#944])
[59]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-5/igt@[email protected]

* igt@xe_vm@oversubscribe-concurrent-bind (NEW):
- shard-lnl: NOTRUN -> [SKIP][60] ([Intel XE#7892])
[60]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-lnl-7/igt@[email protected]

#### Possible fixes ####

* igt@kms_async_flips@alternate-sync-async-flip:
- shard-bmg: [FAIL][61] ([Intel XE#3718] / [Intel XE#6078]) -> [PASS][62] +1 other test pass
[61]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_8955/shard-bmg-5/igt@[email protected]
[62]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-9/igt@[email protected]

* igt@kms_ccs@crc-primary-suspend-4-tiled-bmg-ccs:
- shard-bmg: [INCOMPLETE][63] ([Intel XE#7084] / [Intel XE#8150]) -> [PASS][64] +1 other test pass
[63]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_8955/shard-bmg-6/igt@[email protected]
[64]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-9/igt@[email protected]

* igt@kms_flip@2x-plain-flip-ts-check@bc-dp2-hdmi-a3:
- shard-bmg: [FAIL][65] ([Intel XE#6266]) -> [PASS][66] +1 other test pass
[65]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_8955/shard-bmg-4/igt@kms_flip@[email protected]
[66]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-6/igt@kms_flip@[email protected]

* igt@kms_hdr@invalid-hdr:
- shard-bmg: [SKIP][67] ([Intel XE#1503]) -> [PASS][68]
[67]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_8955/shard-bmg-10/igt@[email protected]
[68]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-6/igt@[email protected]

* igt@kms_hdr@invalid-hdr@pipe-a-hdmi-a-3-xrgb2101010:
- shard-bmg: [SKIP][69] ([Intel XE#7922]) -> [PASS][70] +1 other test pass
[69]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_8955/shard-bmg-10/igt@kms_hdr@[email protected]
[70]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-6/igt@kms_hdr@[email protected]

* igt@xe_evict@evict-mixed-many-threads-small:
- shard-bmg: [INCOMPLETE][71] ([Intel XE#6321]) -> [PASS][72] +1 other test pass
[71]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_8955/shard-bmg-10/igt@[email protected]
[72]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-7/igt@[email protected]

* igt@xe_sriov_auto_provisioning@resources-released-on-vfs-disabling@numvfs-random:
- shard-bmg: [FAIL][73] ([Intel XE#7992]) -> [PASS][74] +1 other test pass
[73]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_8955/shard-bmg-1/igt@xe_sriov_auto_provisioning@[email protected]
[74]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-7/igt@xe_sriov_auto_provisioning@[email protected]

* igt@xe_wedged@wedged-mode-toggle:
- shard-bmg: [ABORT][75] ([Intel XE#8007]) -> [PASS][76]
[75]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_8955/shard-bmg-7/igt@[email protected]
[76]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-1/igt@[email protected]

#### Warnings ####

* igt@kms_cursor_legacy@cursorb-vs-flipb-atomic-transitions:
- shard-lnl: [SKIP][77] ([Intel XE#309] / [Intel XE#7343]) -> [SKIP][78] ([Intel XE#309] / [Intel XE#7343] / [Intel XE#7935])
[77]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_8955/shard-lnl-5/igt@[email protected]
[78]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-lnl-8/igt@[email protected]

* igt@kms_tiled_display@basic-test-pattern:
- shard-bmg: [FAIL][79] ([Intel XE#1729] / [Intel XE#7424]) -> [SKIP][80] ([Intel XE#2426] / [Intel XE#5848])
[79]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_8955/shard-bmg-1/igt@[email protected]
[80]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/shard-bmg-6/igt@[email protected]

[Intel XE#1124]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/1124
[Intel XE#1439]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/1439
[Intel XE#1489]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/1489
[Intel XE#1503]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/1503
[Intel XE#1729]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/1729
[Intel XE#2168]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/2168
[Intel XE#2234]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/2234
[Intel XE#2252]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/2252
[Intel XE#2311]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/2311
[Intel XE#2313]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/2313
[Intel XE#2320]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/2320
[Intel XE#2322]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/2322
[Intel XE#2325]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/2325
[Intel XE#2327]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/2327
[Intel XE#2387]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/2387
[Intel XE#2390]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/2390
[Intel XE#2413]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/2413
[Intel XE#2426]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/2426
[Intel XE#2652]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/2652
[Intel XE#2850]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/2850
[Intel XE#2887]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/2887
[Intel XE#301]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/301
[Intel XE#309]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/309
[Intel XE#3141]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/3141
[Intel XE#367]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/367
[Intel XE#3718]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/3718
[Intel XE#3904]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/3904
[Intel XE#4141]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/4141
[Intel XE#4692]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/4692
[Intel XE#4733]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/4733
[Intel XE#5742]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/5742
[Intel XE#5848]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/5848
[Intel XE#586]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/586
[Intel XE#6078]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/6078
[Intel XE#6266]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/6266
[Intel XE#6321]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/6321
[Intel XE#6599]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/6599
[Intel XE#6874]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/6874
[Intel XE#6911]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/6911
[Intel XE#6964]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/6964
[Intel XE#6974]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/6974
[Intel XE#7061]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7061
[Intel XE#7084]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7084
[Intel XE#7136]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7136
[Intel XE#7138]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7138
[Intel XE#7178]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7178
[Intel XE#7179]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7179
[Intel XE#7283]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7283
[Intel XE#7308]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7308
[Intel XE#7323]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7323
[Intel XE#7328]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7328
[Intel XE#7340]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7340
[Intel XE#7342]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7342
[Intel XE#7343]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7343
[Intel XE#7349]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7349
[Intel XE#7351]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7351
[Intel XE#7356]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7356
[Intel XE#7358]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7358
[Intel XE#7372]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7372
[Intel XE#7376]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7376
[Intel XE#7378]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7378
[Intel XE#7383]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7383
[Intel XE#7384]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7384
[Intel XE#7400]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7400
[Intel XE#7417]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7417
[Intel XE#7424]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7424
[Intel XE#7429]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7429
[Intel XE#7444]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7444
[Intel XE#7504]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7504
[Intel XE#7508]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7508
[Intel XE#7571]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7571
[Intel XE#7636]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7636
[Intel XE#7679]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7679
[Intel XE#7760]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7760
[Intel XE#7793]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7793
[Intel XE#7892]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7892
[Intel XE#7915]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7915
[Intel XE#7922]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7922
[Intel XE#7935]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7935
[Intel XE#7992]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7992
[Intel XE#8007]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/8007
[Intel XE#8150]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/8150
[Intel XE#8265]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/8265
[Intel XE#836]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/836
[Intel XE#870]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/870
[Intel XE#944]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/944

Build changes
-------------

* IGT: IGT_8955 -> IGTPW_15331
* Linux: xe-5224-e591d473e392997b89c9ab9598bfe027c59ac21c -> xe-5225-1e8798282ef0590ad21ca33d80e225208d9c7864

IGTPW_15331: 15331
IGT_8955: 8955
xe-5224-e591d473e392997b89c9ab9598bfe027c59ac21c: e591d473e392997b89c9ab9598bfe027c59ac21c xe-5225-1e8798282ef0590ad21ca33d80e225208d9c7864: 1e8798282ef0590ad21ca33d80e225208d9c7864

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15331/index.html

#4 lore raw
In reply to Sobin Thomas
Quoted 187 lines · Sobin Thomas

Previous coverage lacked a scenario combining multi-process bind with VRAM oversubscription. This generates memory pressure with multi-process VM Bind activity and concurrent submission, exercising the bind pipeline under eviction pressure.

v2: Removed helper APIs usage clock_nanosleep and commented code.(Nishit)

v3: Refactored code to smaller functions.
Added check for available SRAM usage and keep the max process to 20.

v4: Remove explicit macros definition
Replace Bind ioctl with library calls.(Thomas)
v5: Remove unused query_mem_info
Fix xe_exec_with_retry (Thomas)
Rename align_to_page_size with ALIGN macro (kamil/Thomas)
v6: Fix vm_bind_bo_batch: move igt_assert(ufence) before first dereference
Fix create_test_bos: check errno instead of ret for ENOMEM/ENOSPC detection, since igt_ioctl returns -1 on failure. (Thomas)
v7: Save errno immediately in create_test_bos before it can be clobbered.
Handle non-ENOMEM/ENOSPC failures in create_test_bos. Remove dead code (retries == 0 check) in xe_exec_with_retry. Add igt_skip when both vram and sram n_bufs are 0.
Add MAP_FAILED check on result_bo.ptr after xe_bo_map. (Nishit)
v8: Add error check while performing vmbind.

---
  tests/intel/xe_vm.c | 464 ++++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 464 insertions(+)
tests/intel/xe_vm.c +134 -0
index 408bfdb71..ac2e335c0 100644
@@ -21,6 +21,7 @@
  #include "xe/xe_spin.h"
  #include <string.h>
  #define USER_FENCE_VALUE 0xdeadbeefdeadbeefull
+#define GB(x) (1024ULL * 1024ULL * 1024ULL * (x))
 
  enum overcommit_stage {
  	EXPECT_NONE,
@@ -29,6 +30,93 @@ enum overcommit_stage {
  	EXPECT_EXEC,
  };
 
+struct gem_bo {
+	uint32_t handle;
+	uint64_t size;
+	int *ptr;
+	uint64_t addr;
+};
+
+struct xe_test_ctx {
+	uint32_t vm_id;
+	uint32_t exec_queue_id;
+};
+
+struct mem_bind_sync {
+	struct gem_bo *bufs;
+	int n_bufs;
+	uint64_t *binds_ufence;
+};
+
+static void create_exec_queue(int fd, struct xe_test_ctx *ctx)
+{
+	struct drm_xe_engine_class_instance *hwe;
+	struct drm_xe_engine_class_instance eci = { 0 };
+
+	/* Use first available engine */
+	xe_for_each_engine(fd, hwe) {
+		eci = *hwe;
+		break;
+	}
+	ctx->exec_queue_id = xe_exec_queue_create(fd, ctx->vm_id, &eci, 0);
+}
+
+static int xe_vm_bind_array_get_err(int fd, uint32_t vm,
+				    struct drm_xe_vm_bind_op *bind_ops,
+				    uint32_t num_bind, struct drm_xe_sync *sync,
+				    uint32_t num_syncs)
+{
+	struct drm_xe_vm_bind bind = {
+		.vm_id = vm,
+		.num_binds = num_bind,
+		.vector_of_binds = (uintptr_t)bind_ops,
+		.num_syncs = num_syncs,
+		.syncs = (uintptr_t)sync,
+		.exec_queue_id = 0,
+	};
+
+	igt_assert(num_bind > 0);
+
+	if (igt_ioctl(fd, DRM_IOCTL_XE_VM_BIND, &bind))
+		return -errno;
+
+	return 0;
+}
+
+static uint64_t *
+vm_bind_bo_batch(int fd, struct xe_test_ctx *ctx, struct gem_bo *bos, int size, int *out_err)
+{
+	uint64_t *ufence;
+	struct drm_xe_sync bind_sync;
+	struct drm_xe_vm_bind_op binds[size];
+	int i, ret;
+
+	ufence = calloc(1, sizeof(uint64_t));
+	igt_assert(ufence);
+	*ufence = 0;
+	bind_sync = (struct drm_xe_sync) {
+		.type = DRM_XE_SYNC_TYPE_USER_FENCE,
+		.flags = DRM_XE_SYNC_FLAG_SIGNAL,
+		.addr = to_user_pointer(ufence),
+		.timeline_value = 1,
+	};
+
+	for (i = 0; i < size; i++) {
+		binds[i] = (struct drm_xe_vm_bind_op) {
+			.obj = bos[i].handle,
+			.obj_offset = 0,
+			.range = bos[i].size,
+			.addr = bos[i].addr,
+			.op = DRM_XE_VM_BIND_OP_MAP,
+			.flags = 0,
+		};
+	}
+	ret = xe_vm_bind_array_get_err(fd, ctx->vm_id, binds, size, &bind_sync, 1);
+	if (out_err)
+		*out_err = ret;
+	return ufence;
+}
+
  static uint32_t
  addr_low(uint64_t addr)
  {
@@ -3073,6 +3161,377 @@ static void test_get_property(int fd, void (*func)(int fd, uint32_t vm))
  	xe_vm_destroy(fd, vm);
  }
 
+static int build_add_batch(struct gem_bo *batch_bo, struct gem_bo *integers_bo,
+			   struct gem_bo *result_bo, int ints_to_add)
+{
+	int pos = 0;
+	uint64_t tmp_addr;
+	#define GPR_RX_ADDR(x)		(0x600 + (x) * 8)
+
+	batch_bo->ptr[pos++] =  MI_LOAD_REGISTER_MEM_CMD | MI_LRI_LRM_CS_MMIO | 2;
+	batch_bo->ptr[pos++] = GPR_RX_ADDR(0);
+	tmp_addr = integers_bo->addr + 0 * sizeof(uint32_t);
+	batch_bo->ptr[pos++] = tmp_addr & 0xFFFFFFFF;
+	batch_bo->ptr[pos++] = (tmp_addr >> 32) & 0xFFFFFFFF;
+	for (int i = 1; i < ints_to_add; i++) {
+		/* r1 = integers_bo[i] */
+		batch_bo->ptr[pos++] =  MI_LOAD_REGISTER_MEM_CMD | MI_LRI_LRM_CS_MMIO | 2;
+		batch_bo->ptr[pos++] = GPR_RX_ADDR(1);
+		tmp_addr = integers_bo->addr + i * sizeof(uint32_t);
+		batch_bo->ptr[pos++] = tmp_addr & 0xFFFFFFFF;
+		batch_bo->ptr[pos++] = (tmp_addr >> 32) & 0xFFFFFFFF;
+		/* r0 = r0 + r1 */
+		batch_bo->ptr[pos++] = MI_MATH(4);
+		batch_bo->ptr[pos++] = MI_MATH_LOAD(MI_MATH_REG_SRCA, MI_MATH_REG(0));
+		batch_bo->ptr[pos++] = MI_MATH_LOAD(MI_MATH_REG_SRCB, MI_MATH_REG(1));
+		batch_bo->ptr[pos++] = MI_MATH_ADD;
+		batch_bo->ptr[pos++] = MI_MATH_STORE(MI_MATH_REG(0), MI_MATH_REG_ACCU);
+	}
+	/* result_bo[0] = r0 */
+	batch_bo->ptr[pos++] = MI_STORE_REGISTER_MEM_GEN8 | MI_LRI_LRM_CS_MMIO;
+	batch_bo->ptr[pos++] = GPR_RX_ADDR(0);
+	tmp_addr = result_bo->addr + 0 * sizeof(uint32_t);
+	batch_bo->ptr[pos++] = tmp_addr & 0xFFFFFFFF;
+	batch_bo->ptr[pos++] = (tmp_addr >> 32) & 0xFFFFFFFF;
+
+	batch_bo->ptr[pos++] = MI_BATCH_BUFFER_END;
+	while (pos % 4 != 0)
+		batch_bo->ptr[pos++] = MI_NOOP;
+	return pos;
+}
+
+static void create_test_bos(int fd, struct xe_test_ctx *ctx, struct mem_bind_sync *bind,
+			    uint32_t  placement, uint64_t *addr)
+{
+	const char *mem_type = (placement & vram_memory(fd, 0)) ? "VRAM" : "SRAM";
+	uint32_t ret;
+
+	for (int i = 0; i < bind->n_bufs; i++) {

tests/intel/xe_vm.c static void test_get_property(int fd, void (*func)(int fd, uint32_t vm)) · line 3219

Quoted 10 lines
tests/intel/xe_vm.c +10 -0
+		struct gem_bo *bo = &bind->bufs[i];
+
+		bo->size = GB(1);
+		ret = __xe_bo_create_caching(fd, ctx->vm_id, bo->size, placement, 0,
+					     DRM_XE_GEM_CPU_CACHING_WC, &bo->handle);
+		if (ret) {
+			int saved_errno = errno; /* capture before anything can clobber it */
+
+			bind->n_bufs = i;
+			if (saved_errno == ENOMEM || saved_errno == ENOSPC)

Again I doubt if xe_bo_create() returns ENOMEM/ENOSPC on failure. Please cross check in KMD implementation.

Quoted 197 lines
tests/intel/xe_vm.c +197 -0
+				igt_debug("%s allocation failed at buffer %d (OOM)\n", mem_type, i);
+			else
+				igt_assert_f(false, "%s allocation failed at buffer %d: %s",
+					     mem_type, i, strerror(saved_errno));
+			break;
+		}
+		bo->ptr = NULL;
+		bo->addr = *addr;
+		*addr += bo->size;
+		igt_debug("%s buffer %d created at 0x%016lx\n", mem_type, i, bo->addr);
+	}
+}
+
+static int fill_random_integers(struct gem_bo *int_bo, int ints_to_add)
+{
+	uint32_t expected_result = 0;
+
+	for (int i = 0; i < ints_to_add; i++) {
+		int random_int = rand() % 8;
+
+		int_bo->ptr[i] = random_int;
+		expected_result += random_int;
+
+		igt_debug("%d", random_int);
+		if (i + 1 != ints_to_add)
+			igt_debug(" + ");
+		else
+			igt_debug(" = ");
+	}
+	igt_debug("%d\n", expected_result);
+	return expected_result;
+}
+
+/*
+ * In concurrent VM bind stress tests, multiple threads simultaneously bind
+ * buffers to GPU virtual address space and submit batch operations. This
+ * creates significant GPU memory pressure where the kernel may transiently
+ * fail batch submission when:
+ *   - GPU page tables are being updated across multiple bindings
+ *   - GPU memory is fragmented across many concurrent buffer mappings
+ *   - Multiple processes compete for finite GPU resources
+ *
+ * Without retries, transient ENOMEM/ENOSPC failures cause false test failures.
+ * Retrying lets us distinguish temporary resource exhaustion from actual
+ * driver bugs. Non ENOMEM/ENOSPC errors still fail immediately and are properly
+ * reported with full errno context for debugging.
+ */
+static int xe_exec_with_retry(int fd, struct drm_xe_exec *exec, int max_retries)
+{
+	int rc = 0, retries;
+
+	for (retries = 1; retries < max_retries; retries++) {
+		rc = igt_ioctl(fd, DRM_IOCTL_XE_EXEC, exec);
+
+		if (!(rc && (errno == ENOMEM || errno == ENOSPC)))
+			break;
+
+		igt_warn("got %s, retrying (%d/%d)\n", strerror(errno), retries, max_retries);
+		usleep(100 * retries);
+	}
+
+	if (retries == max_retries)
+		igt_warn("gave up after %d retries\n", retries);
+
+	if (rc)
+		igt_warn("errno: %d (%s)\n", errno, strerror(errno));
+
+	return rc;
+}
+
+static void cleanup_bo_resources(int fd, struct gem_bo *bo)
+{
+	if (bo->ptr) {
+		igt_assert_eq(munmap(bo->ptr, bo->size), 0);
+		bo->ptr = NULL;
+	}
+	if (bo->handle)
+		gem_close(fd, bo->handle);
+}
+
+static void cleanup_sram_vram_objs(int fd, struct mem_bind_sync *vram_bind,
+				   struct mem_bind_sync *sram_bind)
+{
+	for (int i = 0; i < vram_bind->n_bufs; i++)
+		gem_close(fd, vram_bind->bufs[i].handle);
+	for (int i = 0; i < sram_bind->n_bufs; i++)
+		gem_close(fd, sram_bind->bufs[i].handle);
+	free(vram_bind->bufs);
+	free(sram_bind->bufs);
+	if (vram_bind->n_bufs)
+		free(vram_bind->binds_ufence);
+	if (sram_bind->n_bufs)
+		free(sram_bind->binds_ufence);
+}
+
+/**
+ * SUBTEST: oversubscribe-concurrent-bind
+ * Description: Test for oversubscribing the VM with multiple processes
+ * doing binds at the same time, and ensure they all complete successfully.
+ * Functionality: This check is for a specific bug where if multiple processes
+ * oversubscribe the VM, some of the binds may fail with  ENOMEM due to
+ * deadlock in the bind code.
+ * Test category: stress test
+ */
+static void test_vm_oversubscribe_concurrent_bind(int fd)
+{
+	#define MIN_BUFS_PER_PROC 2
+	#define MAX_THREADS 20
+	/*
+	 * Cap SRAM test usage on large-RAM platforms (e.g. PVC). On small-RAM
+	 * platforms (e.g. BMG with ~32 GB RAM) 50% of RAM is ~16 GB which is
+	 * below this cap, so behavior is unchanged. On large-RAM platforms
+	 * 50% can be hundreds of GB; cap it to a bounded value that still
+	 * provides meaningful memory pressure for the concurrent bind test.
+	 */
+	#define MAX_SRAM_TEST_SIZE GB(32)
+	int n_proc = 0, n_vram_bufs = 0, n_sram_bufs = 0;
+	uint32_t max_by_mem;
+	uint64_t total_vram_demand = 0;
+	uint64_t vram_size = xe_visible_available_vram_size(fd, 0);
+	uint64_t sram_avail = (uint64_t)igt_get_avail_ram_mb() << 20;
+	uint64_t target_vram = vram_size * 2;
+	uint64_t target_sram, total_vram_bufs, total_sram_bufs;
+	pthread_barrier_t *barrier;
+	pthread_barrierattr_t attr;
+	/*
+	 * Dynamically cap VRAM oversubscription so the overflow into system
+	 * RAM stays within 25% of available RAM. On small-VRAM platforms
+	 * (e.g. BMG) the 2x target fits within the cap and behavior is
+	 * unchanged; on large-VRAM platforms (e.g. PVC) this prevents OOM.
+	 */
+	target_vram = min(target_vram, vram_size + sram_avail / 4);
+	target_sram = min_t(uint64_t, sram_avail * 50 / 100,
+			    MAX_SRAM_TEST_SIZE);
+
+	total_vram_bufs = target_vram / GB(1);
+	total_sram_bufs = target_sram / GB(1);
+
+	/* determine concurrency from memory pressure */
+
+	max_by_mem = min(total_vram_bufs / MIN_BUFS_PER_PROC,
+			 total_sram_bufs / MIN_BUFS_PER_PROC);
+	n_proc = min_t(uint32_t, max_by_mem, MAX_THREADS);
+	igt_require_f(n_proc > 0, "Not enough VRAM/RAM for oversubscription test\n");
+
+	n_vram_bufs = max_t(int, 2, total_vram_bufs / n_proc);
+	n_sram_bufs = max_t(int, 2, total_sram_bufs / n_proc);
+	total_vram_demand = (uint64_t)n_proc * n_vram_bufs * GB(1);
+
+	igt_debug("VRAM size: %" PRIu64 "MB, System RAM available: %" PRIu64 "MB\n",
+		  vram_size >> 20, sram_avail >> 20);
+
+	igt_debug(" n_proc = %d\n", n_proc);
+	igt_debug("VRAM: %" PRIu64 "GB\n", vram_size >> 30);
+	igt_debug("VRAM demand: %" PRIu64 "MB (%.2fx oversubscription)\n",
+		  total_vram_demand >> 20, (double)total_vram_demand / vram_size);
+	igt_debug("Processes=%d VRAM_bufs=%d SRAM_bufs=%d\n", n_proc,
+		  n_vram_bufs, n_sram_bufs);
+
+	barrier = mmap(NULL, sizeof(pthread_barrier_t),
+		       PROT_READ | PROT_WRITE,
+		       MAP_SHARED | MAP_ANONYMOUS, -1, 0);
+	igt_assert(barrier != MAP_FAILED);
+	pthread_barrierattr_init(&attr);
+	pthread_barrierattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
+	pthread_barrier_init(barrier, &attr, n_proc);
+
+	igt_fork(child, n_proc) {
+		struct xe_test_ctx ctx = {0};
+		int rc;
+		uint64_t addr = 0x40000000;
+		int expected_result = 0, ints_to_add = 4;
+		int max_retries = 1024;
+		struct gem_bo integers_bo, result_bo, batch_bo, *vram_bufs, *sram_bufs;
+		int pos = 0;
+		struct mem_bind_sync vram_bind = {0};
+		struct mem_bind_sync sram_bind = {0};
+		struct drm_xe_sync batch_syncs[1];
+		struct drm_xe_exec exec;
+		struct gem_bo ufence_bo = {0};
+		int vram_bind_err = 0, sram_bind_err = 0;
+
+		vram_bufs = (struct gem_bo *)calloc(n_vram_bufs, sizeof(struct gem_bo));
+		sram_bufs = (struct gem_bo *)calloc(n_sram_bufs, sizeof(struct gem_bo));
+		srand(child);
+
+		igt_assert(vram_bufs && sram_bufs);
+
+		ctx.vm_id = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_SCRATCH_PAGE, 0);
+		create_exec_queue(fd, &ctx);
+		vram_bind.bufs = vram_bufs;
+		vram_bind.n_bufs = n_vram_bufs;
+		sram_bind.bufs = sram_bufs;
+		sram_bind.n_bufs = n_sram_bufs;
+
+		create_test_bos(fd, &ctx, &vram_bind, vram_memory(fd, 0), &addr);
+		create_test_bos(fd, &ctx, &sram_bind, system_memory(fd), &addr);

tests/intel/xe_vm.c static void test_get_property(int fd, void (*func)(int fd, uint32_t vm)) · line 3426

Quoted 10 lines
tests/intel/xe_vm.c +10 -0
+
+		if (!vram_bind.n_bufs && !sram_bind.n_bufs)
+			igt_skip("No BOs allocated; VRAM/SRAM unavailable, skipping\n");
+
+		pthread_barrier_wait(barrier);
+
+		if (vram_bind.n_bufs)
+			vram_bind.binds_ufence =
+				vm_bind_bo_batch(fd, &ctx, vram_bufs,
+						 vram_bind.n_bufs, &vram_bind_err);

No wait fence/signaling on vm_bind() completion?

tests/intel/xe_vm.c static void test_get_property(int fd, void (*func)(int fd, uint32_t vm)) · line 3431

Quoted 5 lines
tests/intel/xe_vm.c +5 -0
+
+		if (sram_bind.n_bufs)
+			sram_bind.binds_ufence =
+				vm_bind_bo_batch(fd, &ctx, sram_bufs,
+						 sram_bind.n_bufs, &sram_bind_err);

Same as above

tests/intel/xe_vm.c static void test_get_property(int fd, void (*func)(int fd, uint32_t vm)) · line 3437

Quoted 6 lines
tests/intel/xe_vm.c +6 -0
+
+		if (vram_bind_err) {
+			if (vram_bind_err == -ENOMEM || vram_bind_err == -ENOSPC) {
+				igt_debug("VRAM bind OOM (error: %d) - expected on oversubscription\n",
+					  vram_bind_err);
+				vram_bind.n_bufs = 0;

if bind() returns ENOMEM/ENOSPC then why we are continuing executing below implementation?

Quoted 112 lines
tests/intel/xe_vm.c +102 -0
+			} else {
+				igt_assert_f(0, "Unexpected VRAM bind error: %d", vram_bind_err);
+			}
+		}
+
+		/* Assert if there is any bind error in SRAM */
+		if (sram_bind_err)
+			igt_assert_f(0, "Unexpected SRAM bind error: %d", sram_bind_err);
+
+		integers_bo.size = ALIGN(sizeof(int) * ints_to_add, 4096);
+		integers_bo.handle = xe_bo_create_caching(fd, ctx.vm_id, integers_bo.size,
+							  system_memory(fd), 0,
+							  DRM_XE_GEM_CPU_CACHING_WC);
+		integers_bo.ptr = (int *)xe_bo_map(fd, integers_bo.handle, integers_bo.size);
+		integers_bo.addr = 0x100000;
+
+		expected_result = fill_random_integers(&integers_bo, ints_to_add);
+		igt_debug("%d\n", expected_result);
+
+		result_bo.size = ALIGN(sizeof(int), 4096);
+		result_bo.handle  = xe_bo_create_caching(fd, ctx.vm_id, result_bo.size,
+							 system_memory(fd), 0,
+							 DRM_XE_GEM_CPU_CACHING_WC);
+		result_bo.ptr = NULL;
+		result_bo.addr = 0x200000;
+
+		batch_bo.size = 4096;
+		batch_bo.handle = xe_bo_create_caching(fd, ctx.vm_id, batch_bo.size,
+						       system_memory(fd), 0,
+						       DRM_XE_GEM_CPU_CACHING_WC);
+
+		batch_bo.ptr = (int *)xe_bo_map(fd, batch_bo.handle, batch_bo.size);
+		batch_bo.addr = 0x300000;
+
+		pos = build_add_batch(&batch_bo, &integers_bo, &result_bo, ints_to_add);
+
+		igt_assert(pos * sizeof(int) <= batch_bo.size);
+
+		/* Wait for large bind operations to complete before binding small BOs */
+		if (vram_bind.n_bufs)
+			xe_wait_ufence(fd, vram_bind.binds_ufence, 1, 0, INT64_MAX);
+		if (sram_bind.n_bufs)
+			xe_wait_ufence(fd, sram_bind.binds_ufence, 1, 0, INT64_MAX);
+
+		xe_vm_bind_lr_sync(fd, ctx.vm_id, integers_bo.handle, 0, integers_bo.addr,
+				   integers_bo.size, 0);
+		xe_vm_bind_lr_sync(fd, ctx.vm_id, result_bo.handle, 0, result_bo.addr,
+				   result_bo.size, 0);
+		xe_vm_bind_lr_sync(fd, ctx.vm_id, batch_bo.handle, 0, batch_bo.addr,
+				   batch_bo.size, 0);
+
+		ufence_bo.size = 4096;
+		ufence_bo.handle = xe_bo_create_caching(fd, ctx.vm_id, ufence_bo.size,
+							system_memory(fd), 0,
+							DRM_XE_GEM_CPU_CACHING_WB);
+		ufence_bo.ptr = (int *)xe_bo_map(fd, ufence_bo.handle, ufence_bo.size);
+		ufence_bo.addr = 0x400000;
+		memset(ufence_bo.ptr, 0, ufence_bo.size);
+		xe_vm_bind_lr_sync(fd, ctx.vm_id, ufence_bo.handle, 0, ufence_bo.addr,
+				   ufence_bo.size, 0);
+
+		batch_syncs[0] = (struct drm_xe_sync){
+			.type = DRM_XE_SYNC_TYPE_USER_FENCE,
+			.flags = DRM_XE_SYNC_FLAG_SIGNAL,
+			.addr = ufence_bo.addr,
+			.timeline_value = 1,
+		};
+
+		exec = (struct drm_xe_exec) {
+			.exec_queue_id = ctx.exec_queue_id,
+			.num_syncs = 1,
+			.syncs = (uintptr_t)batch_syncs,
+			.address = batch_bo.addr,
+			.num_batch_buffer = 1,
+		};
+
+		rc = xe_exec_with_retry(fd, &exec, max_retries);
+		igt_assert_eq(rc, 0);
+		xe_wait_ufence(fd, (uint64_t *)ufence_bo.ptr, 1, ctx.exec_queue_id, INT64_MAX);
+		result_bo.ptr = (int *)xe_bo_map(fd, result_bo.handle, result_bo.size);
+		igt_assert(result_bo.ptr != MAP_FAILED);
+		igt_assert_eq(result_bo.ptr[0], expected_result);
+		cleanup_bo_resources(fd, &ufence_bo);
+		cleanup_bo_resources(fd, &result_bo);
+		cleanup_bo_resources(fd, &batch_bo);
+		cleanup_bo_resources(fd, &integers_bo);
+		cleanup_sram_vram_objs(fd, &vram_bind, &sram_bind);
+		xe_exec_queue_destroy(fd, ctx.exec_queue_id);
+		xe_vm_destroy(fd, ctx.vm_id);
+		close(fd);
+	}
+	igt_waitchildren();
+	pthread_barrier_destroy(barrier);
+	pthread_barrierattr_destroy(&attr);
+	igt_assert_eq(munmap(barrier, sizeof(pthread_barrier_t)), 0);
+}
+
  int igt_main()
  {
  	struct drm_xe_engine_class_instance *hwe, *hwe_non_copy = NULL;
@@ -3486,6 +3945,11 @@ int igt_main()
  		igt_assert(xe_visible_vram_size(fd, 0));
  		test_oom(fd);
  	}
+	igt_subtest("oversubscribe-concurrent-bind")
+	{
+		igt_require(xe_has_vram(fd));
+		test_vm_oversubscribe_concurrent_bind(fd);
+	}
 
  	for (const struct vm_get_property *f = xe_vm_get_property_tests; f->name; f++) {
  		igt_subtest_f("vm-get-property-%s", f->name)
#5 lore raw

Hi Nishit,

Please find inline comments

-----Original Message-----
From: Sharma, Nishit <[email protected]>
Sent: Thursday, June 11, 2026 1:54 PM
To: Thomas, Sobin <[email protected]>; [email protected]
Cc: Hellstrom, Thomas <[email protected]>
Subject: Re: [PATCH i-g-t v8] Add test for oversubscribing VRAM in multi process environment that creates VM, bind large BOs and submit workloads nearly simultaneously.

Quoted 185 lines · Sobin Thomas

Previous coverage lacked a scenario combining multi-process bind with VRAM oversubscription. This generates memory pressure with multi-process VM Bind activity and concurrent submission, exercising the bind pipeline under eviction pressure.

v2: Removed helper APIs usage clock_nanosleep and commented code.(Nishit)

v3: Refactored code to smaller functions.
Added check for available SRAM usage and keep the max process to 20.

v4: Remove explicit macros definition
Replace Bind ioctl with library calls.(Thomas)
v5: Remove unused query_mem_info
Fix xe_exec_with_retry (Thomas)
Rename align_to_page_size with ALIGN macro (kamil/Thomas)
v6: Fix vm_bind_bo_batch: move igt_assert(ufence) before first dereference
Fix create_test_bos: check errno instead of ret for ENOMEM/ENOSPC detection, since igt_ioctl returns -1 on failure. (Thomas)
v7: Save errno immediately in create_test_bos before it can be clobbered.
Handle non-ENOMEM/ENOSPC failures in create_test_bos. Remove dead code (retries == 0 check) in xe_exec_with_retry. Add igt_skip when both vram and sram n_bufs are 0.
Add MAP_FAILED check on result_bo.ptr after xe_bo_map. (Nishit)
v8: Add error check while performing vmbind.

---
  tests/intel/xe_vm.c | 464 ++++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 464 insertions(+)
tests/intel/xe_vm.c index renamed from tests/intel/xe_vm.c +0 -0

408bfdb71..ac2e335c0 100644

tests/intel/xe_vm.c +132 -0
@@ -21,6 +21,7 @@
  #include "xe/xe_spin.h"
  #include <string.h>
  #define USER_FENCE_VALUE 0xdeadbeefdeadbeefull
+#define GB(x) (1024ULL * 1024ULL * 1024ULL * (x))
 
  enum overcommit_stage {
  	EXPECT_NONE,
@@ -29,6 +30,93 @@ enum overcommit_stage {
  	EXPECT_EXEC,
  };
 
+struct gem_bo {
+	uint32_t handle;
+	uint64_t size;
+	int *ptr;
+	uint64_t addr;
+};
+
+struct xe_test_ctx {
+	uint32_t vm_id;
+	uint32_t exec_queue_id;
+};
+
+struct mem_bind_sync {
+	struct gem_bo *bufs;
+	int n_bufs;
+	uint64_t *binds_ufence;
+};
+
+static void create_exec_queue(int fd, struct xe_test_ctx *ctx) {
+	struct drm_xe_engine_class_instance *hwe;
+	struct drm_xe_engine_class_instance eci = { 0 };
+
+	/* Use first available engine */
+	xe_for_each_engine(fd, hwe) {
+		eci = *hwe;
+		break;
+	}
+	ctx->exec_queue_id = xe_exec_queue_create(fd, ctx->vm_id, &eci, 0); 
+}
+
+static int xe_vm_bind_array_get_err(int fd, uint32_t vm,
+				    struct drm_xe_vm_bind_op *bind_ops,
+				    uint32_t num_bind, struct drm_xe_sync *sync,
+				    uint32_t num_syncs)
+{
+	struct drm_xe_vm_bind bind = {
+		.vm_id = vm,
+		.num_binds = num_bind,
+		.vector_of_binds = (uintptr_t)bind_ops,
+		.num_syncs = num_syncs,
+		.syncs = (uintptr_t)sync,
+		.exec_queue_id = 0,
+	};
+
+	igt_assert(num_bind > 0);
+
+	if (igt_ioctl(fd, DRM_IOCTL_XE_VM_BIND, &bind))
+		return -errno;
+
+	return 0;
+}
+
+static uint64_t *
+vm_bind_bo_batch(int fd, struct xe_test_ctx *ctx, struct gem_bo *bos, 
+int size, int *out_err) {
+	uint64_t *ufence;
+	struct drm_xe_sync bind_sync;
+	struct drm_xe_vm_bind_op binds[size];
+	int i, ret;
+
+	ufence = calloc(1, sizeof(uint64_t));
+	igt_assert(ufence);
+	*ufence = 0;
+	bind_sync = (struct drm_xe_sync) {
+		.type = DRM_XE_SYNC_TYPE_USER_FENCE,
+		.flags = DRM_XE_SYNC_FLAG_SIGNAL,
+		.addr = to_user_pointer(ufence),
+		.timeline_value = 1,
+	};
+
+	for (i = 0; i < size; i++) {
+		binds[i] = (struct drm_xe_vm_bind_op) {
+			.obj = bos[i].handle,
+			.obj_offset = 0,
+			.range = bos[i].size,
+			.addr = bos[i].addr,
+			.op = DRM_XE_VM_BIND_OP_MAP,
+			.flags = 0,
+		};
+	}
+	ret = xe_vm_bind_array_get_err(fd, ctx->vm_id, binds, size, &bind_sync, 1);
+	if (out_err)
+		*out_err = ret;
+	return ufence;
+}
+
  static uint32_t
  addr_low(uint64_t addr)
  {
@@ -3073,6 +3161,377 @@ static void test_get_property(int fd, void (*func)(int fd, uint32_t vm))
  	xe_vm_destroy(fd, vm);
  }
 
+static int build_add_batch(struct gem_bo *batch_bo, struct gem_bo *integers_bo,
+			   struct gem_bo *result_bo, int ints_to_add) {
+	int pos = 0;
+	uint64_t tmp_addr;
+	#define GPR_RX_ADDR(x)		(0x600 + (x) * 8)
+
+	batch_bo->ptr[pos++] =  MI_LOAD_REGISTER_MEM_CMD | MI_LRI_LRM_CS_MMIO | 2;
+	batch_bo->ptr[pos++] = GPR_RX_ADDR(0);
+	tmp_addr = integers_bo->addr + 0 * sizeof(uint32_t);
+	batch_bo->ptr[pos++] = tmp_addr & 0xFFFFFFFF;
+	batch_bo->ptr[pos++] = (tmp_addr >> 32) & 0xFFFFFFFF;
+	for (int i = 1; i < ints_to_add; i++) {
+		/* r1 = integers_bo[i] */
+		batch_bo->ptr[pos++] =  MI_LOAD_REGISTER_MEM_CMD | MI_LRI_LRM_CS_MMIO | 2;
+		batch_bo->ptr[pos++] = GPR_RX_ADDR(1);
+		tmp_addr = integers_bo->addr + i * sizeof(uint32_t);
+		batch_bo->ptr[pos++] = tmp_addr & 0xFFFFFFFF;
+		batch_bo->ptr[pos++] = (tmp_addr >> 32) & 0xFFFFFFFF;
+		/* r0 = r0 + r1 */
+		batch_bo->ptr[pos++] = MI_MATH(4);
+		batch_bo->ptr[pos++] = MI_MATH_LOAD(MI_MATH_REG_SRCA, MI_MATH_REG(0));
+		batch_bo->ptr[pos++] = MI_MATH_LOAD(MI_MATH_REG_SRCB, MI_MATH_REG(1));
+		batch_bo->ptr[pos++] = MI_MATH_ADD;
+		batch_bo->ptr[pos++] = MI_MATH_STORE(MI_MATH_REG(0), MI_MATH_REG_ACCU);
+	}
+	/* result_bo[0] = r0 */
+	batch_bo->ptr[pos++] = MI_STORE_REGISTER_MEM_GEN8 | MI_LRI_LRM_CS_MMIO;
+	batch_bo->ptr[pos++] = GPR_RX_ADDR(0);
+	tmp_addr = result_bo->addr + 0 * sizeof(uint32_t);
+	batch_bo->ptr[pos++] = tmp_addr & 0xFFFFFFFF;
+	batch_bo->ptr[pos++] = (tmp_addr >> 32) & 0xFFFFFFFF;
+
+	batch_bo->ptr[pos++] = MI_BATCH_BUFFER_END;
+	while (pos % 4 != 0)
+		batch_bo->ptr[pos++] = MI_NOOP;
+	return pos;
+}
+
+static void create_test_bos(int fd, struct xe_test_ctx *ctx, struct mem_bind_sync *bind,
+			    uint32_t  placement, uint64_t *addr) {
+	const char *mem_type = (placement & vram_memory(fd, 0)) ? "VRAM" : "SRAM";
+	uint32_t ret;
+
+	for (int i = 0; i < bind->n_bufs; i++) {
+		struct gem_bo *bo = &bind->bufs[i];

tests/intel/xe_vm.c static void test_get_property(int fd, void (*func)(int fd, uint32_t vm)) · line 3218

Quoted 10 lines
tests/intel/xe_vm.c +10 -0
+
+		bo->size = GB(1);
+		ret = __xe_bo_create_caching(fd, ctx->vm_id, bo->size, placement, 0,
+					     DRM_XE_GEM_CPU_CACHING_WC, &bo->handle);
+		if (ret) {
+			int saved_errno = errno; /* capture before anything can clobber it 
+*/
+
+			bind->n_bufs = i;
+			if (saved_errno == ENOMEM || saved_errno == ENOSPC)

Again I doubt if xe_bo_create() returns ENOMEM/ENOSPC on failure. Please cross check in KMD implementation.

I investigated this with live kernel instrumentation (printk probes in ttm_bo_validate() and xe_gem_create_ioctl())

Xe_bo_create will call ttm apis.
Dmesg logs :

ttm_bo_alloc_resource returned -28 (-ENOSPC)
ttm_bo_validate got -ENOSPC, propagate=0 -> will return -ENOMEM (converted) xe_bo_create_user returned err=-12 (-ENOMEM)

ttm_bo_alloc_resource() does use -ENOSPC internally when VRAM is exhausted. However, ttm_bo_validate() converts it to -ENOMEM before returning, because the xe driver does not set TTM_ALLOCATION_PROPAGATE_ENOSPC on its ttm_device (see ttm_bo.c: bo->bdev->alloc_flags & TTM_ALLOCATION_PROPAGATE_ENOSPC).

The saved_errno == ENOMEM only needed check

Quoted 203 lines
tests/intel/xe_vm.c +203 -0
+				igt_debug("%s allocation failed at buffer %d (OOM)\n", mem_type, i);
+			else
+				igt_assert_f(false, "%s allocation failed at buffer %d: %s",
+					     mem_type, i, strerror(saved_errno));
+			break;
+		}
+		bo->ptr = NULL;
+		bo->addr = *addr;
+		*addr += bo->size;
+		igt_debug("%s buffer %d created at 0x%016lx\n", mem_type, i, bo->addr);
+	}
+}
+
+static int fill_random_integers(struct gem_bo *int_bo, int 
+ints_to_add) {
+	uint32_t expected_result = 0;
+
+	for (int i = 0; i < ints_to_add; i++) {
+		int random_int = rand() % 8;
+
+		int_bo->ptr[i] = random_int;
+		expected_result += random_int;
+
+		igt_debug("%d", random_int);
+		if (i + 1 != ints_to_add)
+			igt_debug(" + ");
+		else
+			igt_debug(" = ");
+	}
+	igt_debug("%d\n", expected_result);
+	return expected_result;
+}
+
+/*
+ * In concurrent VM bind stress tests, multiple threads 
+simultaneously bind
+ * buffers to GPU virtual address space and submit batch operations. 
+This
+ * creates significant GPU memory pressure where the kernel may 
+transiently
+ * fail batch submission when:
+ *   - GPU page tables are being updated across multiple bindings
+ *   - GPU memory is fragmented across many concurrent buffer mappings
+ *   - Multiple processes compete for finite GPU resources
+ *
+ * Without retries, transient ENOMEM/ENOSPC failures cause false test failures.
+ * Retrying lets us distinguish temporary resource exhaustion from 
+actual
+ * driver bugs. Non ENOMEM/ENOSPC errors still fail immediately and 
+are properly
+ * reported with full errno context for debugging.
+ */
+static int xe_exec_with_retry(int fd, struct drm_xe_exec *exec, int 
+max_retries) {
+	int rc = 0, retries;
+
+	for (retries = 1; retries < max_retries; retries++) {
+		rc = igt_ioctl(fd, DRM_IOCTL_XE_EXEC, exec);
+
+		if (!(rc && (errno == ENOMEM || errno == ENOSPC)))
+			break;
+
+		igt_warn("got %s, retrying (%d/%d)\n", strerror(errno), retries, max_retries);
+		usleep(100 * retries);
+	}
+
+	if (retries == max_retries)
+		igt_warn("gave up after %d retries\n", retries);
+
+	if (rc)
+		igt_warn("errno: %d (%s)\n", errno, strerror(errno));
+
+	return rc;
+}
+
+static void cleanup_bo_resources(int fd, struct gem_bo *bo) {
+	if (bo->ptr) {
+		igt_assert_eq(munmap(bo->ptr, bo->size), 0);
+		bo->ptr = NULL;
+	}
+	if (bo->handle)
+		gem_close(fd, bo->handle);
+}
+
+static void cleanup_sram_vram_objs(int fd, struct mem_bind_sync *vram_bind,
+				   struct mem_bind_sync *sram_bind) {
+	for (int i = 0; i < vram_bind->n_bufs; i++)
+		gem_close(fd, vram_bind->bufs[i].handle);
+	for (int i = 0; i < sram_bind->n_bufs; i++)
+		gem_close(fd, sram_bind->bufs[i].handle);
+	free(vram_bind->bufs);
+	free(sram_bind->bufs);
+	if (vram_bind->n_bufs)
+		free(vram_bind->binds_ufence);
+	if (sram_bind->n_bufs)
+		free(sram_bind->binds_ufence);
+}
+
+/**
+ * SUBTEST: oversubscribe-concurrent-bind
+ * Description: Test for oversubscribing the VM with multiple 
+processes
+ * doing binds at the same time, and ensure they all complete successfully.
+ * Functionality: This check is for a specific bug where if multiple 
+processes
+ * oversubscribe the VM, some of the binds may fail with  ENOMEM due 
+to
+ * deadlock in the bind code.
+ * Test category: stress test
+ */
+static void test_vm_oversubscribe_concurrent_bind(int fd) {
+	#define MIN_BUFS_PER_PROC 2
+	#define MAX_THREADS 20
+	/*
+	 * Cap SRAM test usage on large-RAM platforms (e.g. PVC). On small-RAM
+	 * platforms (e.g. BMG with ~32 GB RAM) 50% of RAM is ~16 GB which is
+	 * below this cap, so behavior is unchanged. On large-RAM platforms
+	 * 50% can be hundreds of GB; cap it to a bounded value that still
+	 * provides meaningful memory pressure for the concurrent bind test.
+	 */
+	#define MAX_SRAM_TEST_SIZE GB(32)
+	int n_proc = 0, n_vram_bufs = 0, n_sram_bufs = 0;
+	uint32_t max_by_mem;
+	uint64_t total_vram_demand = 0;
+	uint64_t vram_size = xe_visible_available_vram_size(fd, 0);
+	uint64_t sram_avail = (uint64_t)igt_get_avail_ram_mb() << 20;
+	uint64_t target_vram = vram_size * 2;
+	uint64_t target_sram, total_vram_bufs, total_sram_bufs;
+	pthread_barrier_t *barrier;
+	pthread_barrierattr_t attr;
+	/*
+	 * Dynamically cap VRAM oversubscription so the overflow into system
+	 * RAM stays within 25% of available RAM. On small-VRAM platforms
+	 * (e.g. BMG) the 2x target fits within the cap and behavior is
+	 * unchanged; on large-VRAM platforms (e.g. PVC) this prevents OOM.
+	 */
+	target_vram = min(target_vram, vram_size + sram_avail / 4);
+	target_sram = min_t(uint64_t, sram_avail * 50 / 100,
+			    MAX_SRAM_TEST_SIZE);
+
+	total_vram_bufs = target_vram / GB(1);
+	total_sram_bufs = target_sram / GB(1);
+
+	/* determine concurrency from memory pressure */
+
+	max_by_mem = min(total_vram_bufs / MIN_BUFS_PER_PROC,
+			 total_sram_bufs / MIN_BUFS_PER_PROC);
+	n_proc = min_t(uint32_t, max_by_mem, MAX_THREADS);
+	igt_require_f(n_proc > 0, "Not enough VRAM/RAM for oversubscription 
+test\n");
+
+	n_vram_bufs = max_t(int, 2, total_vram_bufs / n_proc);
+	n_sram_bufs = max_t(int, 2, total_sram_bufs / n_proc);
+	total_vram_demand = (uint64_t)n_proc * n_vram_bufs * GB(1);
+
+	igt_debug("VRAM size: %" PRIu64 "MB, System RAM available: %" PRIu64 "MB\n",
+		  vram_size >> 20, sram_avail >> 20);
+
+	igt_debug(" n_proc = %d\n", n_proc);
+	igt_debug("VRAM: %" PRIu64 "GB\n", vram_size >> 30);
+	igt_debug("VRAM demand: %" PRIu64 "MB (%.2fx oversubscription)\n",
+		  total_vram_demand >> 20, (double)total_vram_demand / vram_size);
+	igt_debug("Processes=%d VRAM_bufs=%d SRAM_bufs=%d\n", n_proc,
+		  n_vram_bufs, n_sram_bufs);
+
+	barrier = mmap(NULL, sizeof(pthread_barrier_t),
+		       PROT_READ | PROT_WRITE,
+		       MAP_SHARED | MAP_ANONYMOUS, -1, 0);
+	igt_assert(barrier != MAP_FAILED);
+	pthread_barrierattr_init(&attr);
+	pthread_barrierattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
+	pthread_barrier_init(barrier, &attr, n_proc);
+
+	igt_fork(child, n_proc) {
+		struct xe_test_ctx ctx = {0};
+		int rc;
+		uint64_t addr = 0x40000000;
+		int expected_result = 0, ints_to_add = 4;
+		int max_retries = 1024;
+		struct gem_bo integers_bo, result_bo, batch_bo, *vram_bufs, *sram_bufs;
+		int pos = 0;
+		struct mem_bind_sync vram_bind = {0};
+		struct mem_bind_sync sram_bind = {0};
+		struct drm_xe_sync batch_syncs[1];
+		struct drm_xe_exec exec;
+		struct gem_bo ufence_bo = {0};
+		int vram_bind_err = 0, sram_bind_err = 0;
+
+		vram_bufs = (struct gem_bo *)calloc(n_vram_bufs, sizeof(struct gem_bo));
+		sram_bufs = (struct gem_bo *)calloc(n_sram_bufs, sizeof(struct gem_bo));
+		srand(child);
+
+		igt_assert(vram_bufs && sram_bufs);
+
+		ctx.vm_id = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_SCRATCH_PAGE, 0);
+		create_exec_queue(fd, &ctx);
+		vram_bind.bufs = vram_bufs;
+		vram_bind.n_bufs = n_vram_bufs;
+		sram_bind.bufs = sram_bufs;
+		sram_bind.n_bufs = n_sram_bufs;
+
+		create_test_bos(fd, &ctx, &vram_bind, vram_memory(fd, 0), &addr);
+		create_test_bos(fd, &ctx, &sram_bind, system_memory(fd), &addr);

tests/intel/xe_vm.c static void test_get_property(int fd, void (*func)(int fd, uint32_t vm)) · line 3426

Quoted 10 lines
tests/intel/xe_vm.c +10 -0
+
+		if (!vram_bind.n_bufs && !sram_bind.n_bufs)
+			igt_skip("No BOs allocated; VRAM/SRAM unavailable, skipping\n");
+
+		pthread_barrier_wait(barrier);
+
+		if (vram_bind.n_bufs)
+			vram_bind.binds_ufence =
+				vm_bind_bo_batch(fd, &ctx, vram_bufs,
+						 vram_bind.n_bufs, &vram_bind_err);

No wait fence/signaling on vm_bind() completion?

Sobin -> wait fence is done but its done below , will be moving this up after vm_bind

tests/intel/xe_vm.c static void test_get_property(int fd, void (*func)(int fd, uint32_t vm)) · line 3431

Quoted 5 lines
tests/intel/xe_vm.c +5 -0
+
+		if (sram_bind.n_bufs)
+			sram_bind.binds_ufence =
+				vm_bind_bo_batch(fd, &ctx, sram_bufs,
+						 sram_bind.n_bufs, &sram_bind_err);

Same as above

tests/intel/xe_vm.c static void test_get_property(int fd, void (*func)(int fd, uint32_t vm)) · line 3437

Quoted 6 lines
tests/intel/xe_vm.c +6 -0
+
+		if (vram_bind_err) {
+			if (vram_bind_err == -ENOMEM || vram_bind_err == -ENOSPC) {
+				igt_debug("VRAM bind OOM (error: %d) - expected on oversubscription\n",
+					  vram_bind_err);
+				vram_bind.n_bufs = 0;

if bind() returns ENOMEM/ENOSPC then why we are continuing executing below implementation?

tests/intel/xe_vm.c static void test_get_property(int fd, void (*func)(int fd, uint32_t vm)) · line 3441

Quoted 4 lines
tests/intel/xe_vm.c +4 -0
+			} else {
+				igt_assert_f(0, "Unexpected VRAM bind error: %d", vram_bind_err);
+			}
+		}

Since we are oversubscribing in multiple threads, any process binding on VRAM can be causing the ENOMEM/ ENOSPC, initial thought process was to continue; If we want to focus on VRAM binding. We can assert if any error is observed while VRAM bind.
Will be modifying this in next revision.

Quoted 108 lines
tests/intel/xe_vm.c +98 -1
+
+		/* Assert if there is any bind error in SRAM */
+		if (sram_bind_err)
+			igt_assert_f(0, "Unexpected SRAM bind error: %d", sram_bind_err);
+
+		integers_bo.size = ALIGN(sizeof(int) * ints_to_add, 4096);
+		integers_bo.handle = xe_bo_create_caching(fd, ctx.vm_id, integers_bo.size,
+							  system_memory(fd), 0,
+							  DRM_XE_GEM_CPU_CACHING_WC);
+		integers_bo.ptr = (int *)xe_bo_map(fd, integers_bo.handle, integers_bo.size);
+		integers_bo.addr = 0x100000;
+
+		expected_result = fill_random_integers(&integers_bo, ints_to_add);
+		igt_debug("%d\n", expected_result);
+
+		result_bo.size = ALIGN(sizeof(int), 4096);
+		result_bo.handle  = xe_bo_create_caching(fd, ctx.vm_id, result_bo.size,
+							 system_memory(fd), 0,
+							 DRM_XE_GEM_CPU_CACHING_WC);
+		result_bo.ptr = NULL;
+		result_bo.addr = 0x200000;
+
+		batch_bo.size = 4096;
+		batch_bo.handle = xe_bo_create_caching(fd, ctx.vm_id, batch_bo.size,
+						       system_memory(fd), 0,
+						       DRM_XE_GEM_CPU_CACHING_WC);
+
+		batch_bo.ptr = (int *)xe_bo_map(fd, batch_bo.handle, batch_bo.size);
+		batch_bo.addr = 0x300000;
+
+		pos = build_add_batch(&batch_bo, &integers_bo, &result_bo, 
+ints_to_add);
+
+		igt_assert(pos * sizeof(int) <= batch_bo.size);
+
+		/* Wait for large bind operations to complete before binding small BOs */
+		if (vram_bind.n_bufs)
+			xe_wait_ufence(fd, vram_bind.binds_ufence, 1, 0, INT64_MAX);
+		if (sram_bind.n_bufs)
+			xe_wait_ufence(fd, sram_bind.binds_ufence, 1, 0, INT64_MAX);
+
+		xe_vm_bind_lr_sync(fd, ctx.vm_id, integers_bo.handle, 0, integers_bo.addr,
+				   integers_bo.size, 0);
+		xe_vm_bind_lr_sync(fd, ctx.vm_id, result_bo.handle, 0, result_bo.addr,
+				   result_bo.size, 0);
+		xe_vm_bind_lr_sync(fd, ctx.vm_id, batch_bo.handle, 0, batch_bo.addr,
+				   batch_bo.size, 0);
+
+		ufence_bo.size = 4096;
+		ufence_bo.handle = xe_bo_create_caching(fd, ctx.vm_id, ufence_bo.size,
+							system_memory(fd), 0,
+							DRM_XE_GEM_CPU_CACHING_WB);
+		ufence_bo.ptr = (int *)xe_bo_map(fd, ufence_bo.handle, ufence_bo.size);
+		ufence_bo.addr = 0x400000;
+		memset(ufence_bo.ptr, 0, ufence_bo.size);
+		xe_vm_bind_lr_sync(fd, ctx.vm_id, ufence_bo.handle, 0, ufence_bo.addr,
+				   ufence_bo.size, 0);
+
+		batch_syncs[0] = (struct drm_xe_sync){
+			.type = DRM_XE_SYNC_TYPE_USER_FENCE,
+			.flags = DRM_XE_SYNC_FLAG_SIGNAL,
+			.addr = ufence_bo.addr,
+			.timeline_value = 1,
+		};
+
+		exec = (struct drm_xe_exec) {
+			.exec_queue_id = ctx.exec_queue_id,
+			.num_syncs = 1,
+			.syncs = (uintptr_t)batch_syncs,
+			.address = batch_bo.addr,
+			.num_batch_buffer = 1,
+		};
+
+		rc = xe_exec_with_retry(fd, &exec, max_retries);
+		igt_assert_eq(rc, 0);
+		xe_wait_ufence(fd, (uint64_t *)ufence_bo.ptr, 1, ctx.exec_queue_id, INT64_MAX);
+		result_bo.ptr = (int *)xe_bo_map(fd, result_bo.handle, result_bo.size);
+		igt_assert(result_bo.ptr != MAP_FAILED);
+		igt_assert_eq(result_bo.ptr[0], expected_result);
+		cleanup_bo_resources(fd, &ufence_bo);
+		cleanup_bo_resources(fd, &result_bo);
+		cleanup_bo_resources(fd, &batch_bo);
+		cleanup_bo_resources(fd, &integers_bo);
+		cleanup_sram_vram_objs(fd, &vram_bind, &sram_bind);
+		xe_exec_queue_destroy(fd, ctx.exec_queue_id);
+		xe_vm_destroy(fd, ctx.vm_id);
+		close(fd);
+	}
+	igt_waitchildren();
+	pthread_barrier_destroy(barrier);
+	pthread_barrierattr_destroy(&attr);
+	igt_assert_eq(munmap(barrier, sizeof(pthread_barrier_t)), 0); }
+
  int igt_main()
  {
  	struct drm_xe_engine_class_instance *hwe, *hwe_non_copy = NULL; @@ 
-3486,6 +3945,11 @@ int igt_main()
  		igt_assert(xe_visible_vram_size(fd, 0));
  		test_oom(fd);
  	}
+	igt_subtest("oversubscribe-concurrent-bind")
+	{
+		igt_require(xe_has_vram(fd));
+		test_vm_oversubscribe_concurrent_bind(fd);
+	}
 
  	for (const struct vm_get_property *f = xe_vm_get_property_tests; f->name; f++) {
  		igt_subtest_f("vm-get-property-%s", f->name)
#6 lore raw
In reply to Sobin Thomas

Hi Sobin,
On 2026-06-09 at 05:22:20 +0000, Sobin Thomas wrote:

please keep subject as in prevoius patches, now it is too long and has no prefix, it shoule have

tests/intel/xe_vm: short description

Regards,
Kamil

Quoted 50 lines

Previous coverage lacked a scenario combining multi-process bind with VRAM oversubscription. This generates memory pressure with multi-process VM Bind activity and concurrent submission, exercising the bind pipeline under eviction pressure.

v2: Removed helper APIs usage clock_nanosleep and commented code.(Nishit)

v3: Refactored code to smaller functions.
Added check for available SRAM usage and keep the max process to 20.

v4: Remove explicit macros definition
Replace Bind ioctl with library calls.(Thomas)
v5: Remove unused query_mem_info
Fix xe_exec_with_retry (Thomas)
Rename align_to_page_size with ALIGN macro (kamil/Thomas)
v6: Fix vm_bind_bo_batch: move igt_assert(ufence) before first dereference
Fix create_test_bos: check errno instead of ret for ENOMEM/ENOSPC detection, since igt_ioctl returns -1 on failure. (Thomas)
v7: Save errno immediately in create_test_bos before it can be clobbered.
Handle non-ENOMEM/ENOSPC failures in create_test_bos. Remove dead code (retries == 0 check) in xe_exec_with_retry. Add igt_skip when both vram and sram n_bufs are 0.
Add MAP_FAILED check on result_bo.ptr after xe_bo_map. (Nishit)
v8: Add error check while performing vmbind.

---
 tests/intel/xe_vm.c | 464 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 464 insertions(+)
tests/intel/xe_vm.c +4 -0
index 408bfdb71..ac2e335c0 100644
@@ -21,6 +21,7 @@
 #include "xe/xe_spin.h"
 #include <string.h>
 #define USER_FENCE_VALUE 0xdeadbeefdeadbeefull
+#define GB(x) (1024ULL * 1024ULL * 1024ULL * (x))
 
 enum overcommit_stage {
 	EXPECT_NONE,
@@ -29,6 +30,93 @@ enum overcommit_stage {
 	EXPECT_EXEC,
 };
 
+struct gem_bo {
+	uint32_t handle;
+	uint64_t size;

tests/intel/xe_vm.c enum overcommit_stage { · line 45

Quoted 10 lines
tests/intel/xe_vm.c +10 -0
+	int *ptr;
+	uint64_t addr;
+};
+
+struct xe_test_ctx {
+	uint32_t vm_id;
+	uint32_t exec_queue_id;
+};
+
+struct mem_bind_sync {

Better struct mem_bind_array_sync {

Regards,
Kamil

[cut]