From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
"Matthew Brost" <matthew.brost@intel.com>,
"Francois Dugast" <francois.dugast@intel.com>,
"Matthew Auld" <matthew.auld@intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>
Subject: [PATCH i-g-t 3/3] tests/xe_exec_fault_mode: Add fault-mode workload subtests with suspend variants
Date: Thu, 21 May 2026 16:34:39 +0200 [thread overview]
Message-ID: <20260521143439.6927-4-thomas.hellstrom@linux.intel.com> (raw)
In-Reply-To: <20260521143439.6927-1-thomas.hellstrom@linux.intel.com>
Add run_fault_workload() using SUSPEND_STATE_NONE as a sentinel for the
no-suspend case. All variants are registered from a single table:
fault-mode-workload (no suspend, 30s stress)
s2idle-fault-mode-workload (SUSPEND_STATE_FREEZE)
s3-fault-mode-workload (SUSPEND_STATE_S3)
s4-fault-mode-workload (SUSPEND_STATE_DISK)
The suspend variants perform a full suspend/resume cycle while the
preemptible spinner is running on an LR+fault-mode VM, then assert the
workload resumes and can be cleanly stopped.
To support the new code, include xe/xe_spin.h and hoist USER_FENCE_VALUE
to file scope.
Assisted-by: GitHub_Copilot:claude-sonnet-4.6
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
---
tests/intel/xe_exec_fault_mode.c | 123 ++++++++++++++++++++++++++++++-
1 file changed, 122 insertions(+), 1 deletion(-)
diff --git a/tests/intel/xe_exec_fault_mode.c b/tests/intel/xe_exec_fault_mode.c
index 3e92dfbd9..c0a067f04 100644
--- a/tests/intel/xe_exec_fault_mode.c
+++ b/tests/intel/xe_exec_fault_mode.c
@@ -21,9 +21,11 @@
#include "xe/xe_ioctl.h"
#include "xe/xe_query.h"
+#include "xe/xe_spin.h"
#include <string.h>
#define MAX_N_EXEC_QUEUES 16
+#define USER_FENCE_VALUE 0xdeadbeefdeadbeefull
#define USERPTR (0x1 << 0)
#define REBIND (0x1 << 1)
@@ -145,7 +147,6 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
uint32_t vm;
uint64_t addr = 0x1a0000;
uint64_t sync_addr = 0x101a0000;
-#define USER_FENCE_VALUE 0xdeadbeefdeadbeefull
struct drm_xe_sync sync[1] = {
{ .type = DRM_XE_SYNC_TYPE_USER_FENCE, .flags = DRM_XE_SYNC_FLAG_SIGNAL,
.timeline_value = USER_FENCE_VALUE },
@@ -453,6 +454,109 @@ test_exec_main(int fd, int n_exec_queues, int n_execs, unsigned int flags)
}
}
+#define SUSPEND_STATE_NONE ((enum igt_suspend_state)-1)
+
+/**
+ * SUBTEST: fault-mode-workload
+ * Description: Stress preemptible fault mode workload for 30s.
+ * Test category: functionality test
+ *
+ * SUBTEST: s2idle-fault-mode-workload
+ * Description: Suspend to idle (s2idle) with a preemptible fault mode workload running.
+ * Test category: functionality test
+ *
+ * SUBTEST: s3-fault-mode-workload
+ * Description: Suspend to RAM (s3) with a preemptible fault mode workload running.
+ * Test category: functionality test
+ *
+ * SUBTEST: s4-fault-mode-workload
+ * Description: Suspend to disk (s4) with a preemptible fault mode workload running.
+ * Test category: functionality test
+ */
+static void run_fault_workload(int fd, enum igt_suspend_state s_state)
+{
+ struct drm_xe_sync sync = {
+ .type = DRM_XE_SYNC_TYPE_USER_FENCE,
+ .flags = DRM_XE_SYNC_FLAG_SIGNAL,
+ .timeline_value = USER_FENCE_VALUE,
+ };
+ struct drm_xe_exec exec = {
+ .num_batch_buffer = 1,
+ .num_syncs = 1,
+ .syncs = to_user_pointer(&sync),
+ };
+ struct xe_spin *spin;
+ struct drm_xe_engine *engine;
+ uint64_t vm_sync;
+ size_t bo_size;
+ uint32_t vm;
+ uint32_t exec_queue;
+ uint64_t spin_addr;
+ uint64_t ahnd;
+ uint32_t bo;
+ uint32_t ts_1, ts_2;
+
+ vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_LR_MODE |
+ DRM_XE_VM_CREATE_FLAG_FAULT_MODE, 0);
+ ahnd = intel_allocator_open(fd, 0, INTEL_ALLOCATOR_RELOC);
+ bo_size = xe_bb_size(fd, sizeof(*spin));
+ engine = xe_find_engine_by_class(fd, DRM_XE_ENGINE_CLASS_COPY);
+ igt_assert(engine);
+
+ bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, engine->instance.gt_id),
+ DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
+ spin = xe_bo_map(fd, bo, bo_size);
+
+ exec_queue = xe_exec_queue_create(fd, vm, &engine->instance, 0);
+ spin_addr = intel_allocator_alloc_with_strategy(ahnd, bo, bo_size, 0,
+ ALLOC_STRATEGY_LOW_TO_HIGH);
+
+ sync.addr = to_user_pointer(&vm_sync);
+ xe_vm_bind_async(fd, vm, 0, bo, 0, spin_addr, bo_size, &sync, 1);
+ xe_wait_ufence(fd, &vm_sync, USER_FENCE_VALUE, 0, NSEC_PER_SEC);
+
+ xe_spin_init_opts(spin, .addr = spin_addr, .write_timestamp = true,
+ .preempt = true);
+ sync.addr = spin_addr + (char *)&spin->exec_sync - (char *)spin;
+ exec.exec_queue_id = exec_queue;
+ exec.address = spin_addr;
+ xe_exec(fd, &exec);
+ xe_spin_wait_started(spin);
+
+ if (s_state != SUSPEND_STATE_NONE) {
+ enum igt_suspend_test test = s_state == SUSPEND_STATE_DISK ?
+ SUSPEND_TEST_DEVICES : SUSPEND_TEST_NONE;
+ igt_system_suspend_autoresume(s_state, test);
+ } else {
+ sleep(30);
+ }
+
+ /* Collect and check timestamps - workload should still be running */
+ ts_1 = spin->timestamp;
+ sleep(1);
+ ts_2 = spin->timestamp;
+ igt_assert_neq_u32(ts_1, ts_2);
+
+ xe_spin_end(spin);
+ xe_wait_ufence(fd, &spin->exec_sync, USER_FENCE_VALUE, 0, NSEC_PER_SEC);
+
+ /* Check timestamps to make sure spinner is stopped */
+ ts_1 = spin->timestamp;
+ sleep(1);
+ ts_2 = spin->timestamp;
+ igt_assert_eq_u32(ts_1, ts_2);
+
+ sync.addr = to_user_pointer(&vm_sync);
+ xe_vm_unbind_async(fd, vm, 0, 0, spin_addr, bo_size, &sync, 1);
+ xe_wait_ufence(fd, &vm_sync, USER_FENCE_VALUE, 0, NSEC_PER_SEC);
+ munmap(spin, bo_size);
+ gem_close(fd, bo);
+
+ xe_exec_queue_destroy(fd, exec_queue);
+ xe_vm_destroy(fd, vm);
+ put_ahnd(ahnd);
+}
+
int igt_main()
{
struct drm_xe_engine_class_instance *hwe;
@@ -589,6 +693,23 @@ int igt_main()
xe_for_each_engine(fd, hwe)
test_exec(fd, hwe, 1, 1, ENABLE_SCRATCH | INVALID_VA);
+ {
+ static const struct {
+ const char *name;
+ enum igt_suspend_state state;
+ } suspend_states[] = {
+ { "", SUSPEND_STATE_NONE },
+ { "s2idle-", SUSPEND_STATE_FREEZE },
+ { "s3-", SUSPEND_STATE_S3 },
+ { "s4-", SUSPEND_STATE_DISK },
+ { NULL },
+ };
+
+ for (const __typeof__(*suspend_states) *s = suspend_states; s->name; s++)
+ igt_subtest_f("%sfault-mode-workload", s->name)
+ run_fault_workload(fd, s->state);
+ }
+
igt_fixture() {
drm_close_driver(fd);
}
--
2.54.0
next prev parent reply other threads:[~2026-05-21 14:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-21 14:34 [PATCH RESEND i-g-t 0/3] xe: Test LR and fault mode workloads across suspend/resume Thomas Hellström
2026-05-21 14:34 ` [PATCH i-g-t 1/3] tests/xe_exec_compute_mode: Make lr-mode-workload spinner preemptible Thomas Hellström
2026-05-21 14:34 ` [PATCH i-g-t 2/3] tests/xe_exec_compute_mode: Add workload subtests with suspend variants Thomas Hellström
2026-05-21 14:34 ` Thomas Hellström [this message]
2026-05-21 23:54 ` ✓ Xe.CI.BAT: success for xe: Test LR and fault mode workloads across suspend/resume (rev2) Patchwork
2026-05-22 0:06 ` ✗ i915.CI.BAT: failure " Patchwork
2026-05-22 6:56 ` ✓ Xe.CI.FULL: success " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2026-05-21 14:16 [PATCH i-g-t 0/3] xe: Test LR and fault mode workloads across suspend/resume Thomas Hellström
2026-05-21 14:16 ` [PATCH i-g-t 3/3] tests/xe_exec_fault_mode: Add fault-mode workload subtests with suspend variants Thomas Hellström
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=20260521143439.6927-4-thomas.hellstrom@linux.intel.com \
--to=thomas.hellstrom@linux.intel.com \
--cc=francois.dugast@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=matthew.auld@intel.com \
--cc=matthew.brost@intel.com \
--cc=rodrigo.vivi@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