public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.auld@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Matthew Brost <matthew.brost@intel.com>
Subject: [PATCH i-g-t] tests/xe/xe_fault_injection: add split/skip bind coverage
Date: Tue, 17 Mar 2026 18:47:36 +0000	[thread overview]
Message-ID: <20260317184735.67051-2-matthew.auld@intel.com> (raw)

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


             reply	other threads:[~2026-03-17 18:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-17 18:47 Matthew Auld [this message]
2026-03-18  1:19 ` ✓ Xe.CI.BAT: success for tests/xe/xe_fault_injection: add split/skip bind coverage 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260317184735.67051-2-matthew.auld@intel.com \
    --to=matthew.auld@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox