public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] tests/xe/xe_fault_injection: add split/skip bind coverage
@ 2026-03-17 18:47 Matthew Auld
  2026-03-18  1:19 ` ✓ Xe.CI.BAT: success for " Patchwork
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Matthew Auld @ 2026-03-17 18:47 UTC (permalink / raw)
  To: igt-dev; +Cc: Matthew Brost

We were missing something for having to unwind a vector of binds where
there is splitting, as well as skipping.

Should explode with a dmesg WARN without the required kernel fix.

Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/7602
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
---
 tests/intel/xe_fault_injection.c | 87 ++++++++++++++++++++++++++++++++
 1 file changed, 87 insertions(+)

diff --git a/tests/intel/xe_fault_injection.c b/tests/intel/xe_fault_injection.c
index 4f4a7922c..c69303ba6 100644
--- a/tests/intel/xe_fault_injection.c
+++ b/tests/intel/xe_fault_injection.c
@@ -478,6 +478,89 @@ vm_bind_fail(int fd, const char pci_slot[], const char function_name[])
 	igt_assert_eq(simple_vm_bind(fd, vm), 0);
 }
 
+static int
+simple_vm_bind_null(int fd, uint32_t vm)
+{
+	struct drm_xe_sync syncobj = {
+		.type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		.flags = DRM_XE_SYNC_FLAG_SIGNAL,
+		.handle = syncobj_create(fd, 0),
+	};
+	struct drm_xe_vm_bind bind = {
+		.vm_id = vm,
+		.num_binds = 1,
+		.bind.range = SZ_2G,
+		.bind.addr = 0,
+		.bind.op = DRM_XE_VM_BIND_OP_MAP,
+		.bind.pat_index = intel_get_pat_idx_uc(fd),
+		.bind.flags = DRM_XE_VM_BIND_FLAG_NULL,
+		.num_syncs = 1,
+		.syncs = (uintptr_t)&syncobj,
+	};
+
+        return igt_ioctl(fd, DRM_IOCTL_XE_VM_BIND, &bind);
+}
+
+static int
+vm_unmap_map_split_vector_null(int fd, uint32_t vm)
+{
+	struct drm_xe_sync syncobj = {
+		.type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		.flags = DRM_XE_SYNC_FLAG_SIGNAL,
+		.handle = syncobj_create(fd, 0),
+	};
+        struct drm_xe_vm_bind_op ops[] = {
+            {
+                .range = SZ_2G,
+                .addr = 0,
+                .op = DRM_XE_VM_BIND_OP_MAP,
+                .pat_index = intel_get_pat_idx_wb(fd),
+                .flags = DRM_XE_VM_BIND_FLAG_NULL,
+            },
+            {
+                .range = SZ_2M,
+                .addr = SZ_1G - SZ_2M,
+                .op = DRM_XE_VM_BIND_OP_UNMAP,
+            },
+        };
+        struct drm_xe_vm_bind bind = {
+		.vm_id = vm,
+		.num_binds = sizeof(ops)/sizeof(struct drm_xe_vm_bind_op),
+		.vector_of_binds = (uintptr_t)&ops,
+		.num_syncs = 1,
+		.syncs = (uintptr_t)&syncobj,
+	};
+
+	return igt_ioctl(fd, DRM_IOCTL_XE_VM_BIND, &bind);
+}
+/**
+ * SUBTEST: vm-bind-split-unwind-fail-%s
+ * Description: inject an error in function %arg[1] used in vm bind IOCTL
+ *		to make it fail
+ * Functionality: fault
+ *
+ * arg[1]:
+ * @vm_bind_ioctl_ops_create:		vm_bind_ioctl_ops_create
+ * @vm_bind_ioctl_ops_execute:		vm_bind_ioctl_ops_execute
+ * @xe_pt_update_ops_prepare:		xe_pt_update_ops_prepare
+ * @xe_pt_update_ops_run:		xe_pt_update_ops_run
+ * @xe_vma_ops_alloc:			xe_vma_ops_alloc
+ * @xe_sync_entry_parse:		xe_sync_entry_parse
+ */
+static void
+vm_bind_split_unwind_fail(int fd, const char pci_slot[], const char function_name[])
+{
+	uint32_t vm = xe_vm_create(fd, 0, 0);
+
+	igt_assert_eq(simple_vm_bind_null(fd, vm), 0);
+
+	/* See: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/7602 */
+	injection_list_add(function_name);
+	set_retval(function_name, INJECT_ERRNO);
+	igt_assert(vm_unmap_map_split_vector_null(fd, vm) != 0);
+	injection_list_remove(function_name);
+}
+
 /**
  * SUBTEST: oa-add-config-fail-%s
  * Description: inject an error in function %arg[1] used in oa add config IOCTL to make it fail
@@ -644,6 +727,10 @@ int igt_main_args("I:", NULL, help_str, opt_handler, NULL)
 		igt_subtest_f("vm-bind-fail-%s", s->name)
 			vm_bind_fail(fd, pci_slot, s->name);
 
+	for (const struct section *s = vm_bind_fail_functions; s->name; s++)
+		igt_subtest_f("vm-bind-split-unwind-fail-%s", s->name)
+			vm_bind_split_unwind_fail(fd, pci_slot, s->name);
+
 	for (const struct section *s = exec_queue_create_fail_functions; s->name; s++)
 		igt_subtest_f("exec-queue-create-fail-%s", s->name)
 			xe_for_each_engine(fd, hwe)
-- 
2.53.0


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

end of thread, other threads:[~2026-03-27 23:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-17 18:47 [PATCH i-g-t] tests/xe/xe_fault_injection: add split/skip bind coverage Matthew Auld
2026-03-18  1:19 ` ✓ Xe.CI.BAT: success for " Patchwork
2026-03-18  1:35 ` ✓ i915.CI.BAT: " Patchwork
2026-03-19 14:16 ` ✓ Xe.CI.FULL: " Patchwork
2026-03-26 22:54 ` ✓ Xe.CI.BAT: success for tests/xe/xe_fault_injection: add split/skip bind coverage (rev2) Patchwork
2026-03-26 22:58 ` ✓ i915.CI.BAT: " Patchwork
2026-03-27 15:59 ` ✓ Xe.CI.FULL: " Patchwork
2026-03-27 23:03 ` ✗ i915.CI.Full: failure " Patchwork

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