Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
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 2/3] tests/xe_exec_compute_mode: Add workload subtests with suspend variants
Date: Thu, 21 May 2026 16:34:38 +0200	[thread overview]
Message-ID: <20260521143439.6927-3-thomas.hellstrom@linux.intel.com> (raw)
In-Reply-To: <20260521143439.6927-1-thomas.hellstrom@linux.intel.com>

Refactor lr_mode_workload() into run_lr_workload() taking an
igt_suspend_state argument, using SUSPEND_STATE_NONE as a sentinel for
the no-suspend case.  Register all variants from a single table:

  lr-mode-workload         (no suspend, 30s stress)
  s2idle-lr-mode-workload  (SUSPEND_STATE_FREEZE)
  s3-lr-mode-workload      (SUSPEND_STATE_S3)
  s4-lr-mode-workload      (SUSPEND_STATE_DISK)

The suspend variants perform a full suspend/resume cycle while the
preemptible spinner is running, then assert the workload resumes and can
be cleanly stopped.

Assisted-by: GitHub_Copilot:claude-sonnet-4.6
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
---
 tests/intel/xe_exec_compute_mode.c | 46 ++++++++++++++++++++++++++----
 1 file changed, 40 insertions(+), 6 deletions(-)

diff --git a/tests/intel/xe_exec_compute_mode.c b/tests/intel/xe_exec_compute_mode.c
index 869f8fbe1..8fc9bb912 100644
--- a/tests/intel/xe_exec_compute_mode.c
+++ b/tests/intel/xe_exec_compute_mode.c
@@ -322,12 +322,26 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 }
 
 #define LR_SPINNER_TIME 30
+#define SUSPEND_STATE_NONE ((enum igt_suspend_state)-1)
+
 /**
  * SUBTEST: lr-mode-workload
  * Description: Stress preemptible LR mode workload for 30s.
  * Test category: functionality test
+ *
+ * SUBTEST: s2idle-lr-mode-workload
+ * Description: Suspend to idle (s2idle) with a preemptible LR mode workload running.
+ * Test category: functionality test
+ *
+ * SUBTEST: s3-lr-mode-workload
+ * Description: Suspend to RAM (s3) with a preemptible LR mode workload running.
+ * Test category: functionality test
+ *
+ * SUBTEST: s4-lr-mode-workload
+ * Description: Suspend to disk (s4) with a preemptible LR mode workload running.
+ * Test category: functionality test
  */
-static void lr_mode_workload(int fd)
+static void run_lr_workload(int fd, enum igt_suspend_state s_state)
 {
 	struct drm_xe_sync sync = {
 		.type = DRM_XE_SYNC_TYPE_USER_FENCE,
@@ -376,8 +390,15 @@ static void lr_mode_workload(int fd)
 	xe_exec(fd, &exec);
 	xe_spin_wait_started(spin);
 
-	/* Collect and check timestamps before stopping the spinner */
-	sleep(LR_SPINNER_TIME);
+	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(LR_SPINNER_TIME);
+	}
+
+	/* Collect and check timestamps - workload should still be running */
 	ts_1 = spin->timestamp;
 	sleep(1);
 	ts_2 = spin->timestamp;
@@ -462,9 +483,22 @@ int igt_main()
 					  s->flags);
 	}
 
-	igt_subtest("lr-mode-workload")
-		lr_mode_workload(fd);
-
+	{
+		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("%slr-mode-workload", s->name)
+				run_lr_workload(fd, s->state);
+	}
 
 	igt_fixture()
 		drm_close_driver(fd);
-- 
2.54.0


  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 ` Thomas Hellström [this message]
2026-05-21 14:34 ` [PATCH i-g-t 3/3] tests/xe_exec_fault_mode: Add fault-mode workload subtests with suspend variants Thomas Hellström
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 2/3] tests/xe_exec_compute_mode: Add 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-3-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