Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Sokolowski <jan.sokolowski@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Jan Sokolowski <jan.sokolowski@intel.com>
Subject: [PATCH i-g-t v3 1/1] tests/intel/xe_eudebug: refactor exec-queue-placements test
Date: Fri, 17 Jan 2025 08:20:55 +0000	[thread overview]
Message-ID: <20250117082055.154635-1-jan.sokolowski@intel.com> (raw)

In some cases, ccs_mode_all_engines can fail,
which will cause test fixture to not execute properly
and put the rest of the tests in an unstable state. Also,
ccs_mode_all_engines changes the state of the card for
other tests as well, thus it should clean after itself too,
which until now it didn't do.

Refactor exec-queue-placements test so that all possible
failure paths are serviced, and add a proper cleanup method,
ccs_mode_restore.

Signed-off-by: Jan Sokolowski <jan.sokolowski@intel.com>
---

v2: Forgot proper path in title
v3: More changes. Moved test back to where it originally was

---

 tests/intel/xe_eudebug.c | 41 ++++++++++++++++++++++++++++++++++------
 1 file changed, 35 insertions(+), 6 deletions(-)

diff --git a/tests/intel/xe_eudebug.c b/tests/intel/xe_eudebug.c
index 91e9ae885..9787183ed 100644
--- a/tests/intel/xe_eudebug.c
+++ b/tests/intel/xe_eudebug.c
@@ -2797,7 +2797,7 @@ static void ccs_mode_all_engines(int num_gt)
 
 		igt_assert(igt_sysfs_printf(gt_fd, "ccs_mode", "%u", num_slices) > 0);
 		igt_assert(igt_sysfs_scanf(gt_fd, "ccs_mode", "%u", &ccs_mode) > 0);
-		igt_assert(num_slices == ccs_mode);
+		igt_require(num_slices == ccs_mode);
 		close(gt_fd);
 	}
 
@@ -2805,6 +2805,25 @@ static void ccs_mode_all_engines(int num_gt)
 	igt_require(num_gts_with_ccs_mode > 0);
 }
 
+static void ccs_mode_restore(int num_gt)
+{
+	int fd, gt, gt_fd, ccs_mode, num_slices;
+
+	for (gt = 0; gt < num_gt; gt++) {
+		fd = drm_open_driver(DRIVER_XE);
+		gt_fd = xe_sysfs_gt_open(fd, gt);
+		close(fd);
+
+		if (igt_sysfs_scanf(gt_fd, "num_cslices", "%u", &num_slices) <= 0)
+			continue;
+
+		igt_assert(igt_sysfs_printf(gt_fd, "ccs_mode", "%u", 1) > 0);
+		igt_assert(igt_sysfs_scanf(gt_fd, "ccs_mode", "%u", &ccs_mode) > 0);
+		igt_assert(ccs_mode == 1);
+		close(gt_fd);
+	}
+}
+
 igt_main
 {
 	bool was_enabled;
@@ -2920,16 +2939,26 @@ igt_main
 		test_empty_discovery(fd, DISCOVERY_DESTROY_RESOURCES, 16);
 
 	igt_subtest_group {
-		igt_fixture {
+		bool restore_ccs = false;
+
+		igt_subtest("exec-queue-placements") {
 			drm_close_driver(fd);
+			fd = -1;
 			ccs_mode_all_engines(gt_count);
+			restore_ccs = true;
 			fd = drm_open_driver(DRIVER_XE);
-		}
-
-		igt_subtest("exec-queue-placements")
 			test_basic_sessions(fd, EXEC_QUEUES_PLACEMENTS, 1, true);
+		}
+		igt_fixture {
+			if (restore_ccs) {
+				drm_close_driver(fd);
+				fd = -1;
+				ccs_mode_restore(gt_count);
+			}
+			if (fd == -1)
+				fd = drm_open_driver(DRIVER_XE);
+		}
 	}
-
 	igt_fixture {
 		xe_eudebug_enable(fd, was_enabled);
 		drm_close_driver(fd);
-- 
2.34.1


             reply	other threads:[~2025-01-17  8:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-17  8:20 Jan Sokolowski [this message]
2025-01-17 11:04 ` ✗ i915.CI.BAT: failure for series starting with [i-g-t,v3,1/1] tests/intel/xe_eudebug: refactor exec-queue-placements test Patchwork
2025-01-17 12:01 ` [PATCH i-g-t v3 1/1] " Manszewski, Christoph
2025-01-17 18:21 ` ✗ Xe.CI.Full: failure for series starting with [i-g-t,v3,1/1] " Patchwork
2025-01-20  6:18 ` ✓ Xe.CI.BAT: success for series starting with [i-g-t,v3,1/1] tests/intel/xe_eudebug: refactor exec-queue-placements test (rev2) Patchwork
2025-01-20  6:19 ` ✓ i915.CI.BAT: " Patchwork
2025-01-20  8:06 ` ✗ Xe.CI.Full: failure " Patchwork
2025-01-20 16:00 ` ✗ i915.CI.Full: " 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=20250117082055.154635-1-jan.sokolowski@intel.com \
    --to=jan.sokolowski@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /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