public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] tests/intel/xe_configfs: Reset configfs group after each subtest
@ 2026-02-04 16:03 Nitin Gote
  2026-02-04 17:51 ` ✓ Xe.CI.BAT: success for " Patchwork
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Nitin Gote @ 2026-02-04 16:03 UTC (permalink / raw)
  To: igt-dev; +Cc: michal.wajdeczko, Nitin Gote

The xe_configfs test uses a shared configfs group across all subtests.
When subtests modify configfs attributes without resetting them, the
modified values persist and affect subsequent subtests. For example,
ctx-restore-mid-bb reports register value mismatches due to stale
batch buffer data from previous subtests.

Fix by removing the configfs device directory after each subtest and
letting the next subtest recreate it to get default values as
hardcoded in the driver.

Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/6204
Signed-off-by: Nitin Gote <nitin.r.gote@intel.com>
---
v1->v2:
  Instead of manually resetting each attribute,
  it's cleaner to remove and recreate the configfs group after
  each subtests. (Michal)

 tests/intel/xe_configfs.c | 47 +++++++++++++++++++++++++++++++--------
 1 file changed, 38 insertions(+), 9 deletions(-)

diff --git a/tests/intel/xe_configfs.c b/tests/intel/xe_configfs.c
index d2dfd2e87..aa3435392 100644
--- a/tests/intel/xe_configfs.c
+++ b/tests/intel/xe_configfs.c
@@ -361,7 +361,6 @@ int igt_main()
 
 		configfs_fd = igt_configfs_open("xe");
 		igt_require(configfs_fd != -1);
-		configfs_device_fd = create_device_configfs_group(configfs_fd);
 		igt_install_exit_handler(restore);
 	}
 
@@ -369,39 +368,69 @@ int igt_main()
 	igt_subtest("survivability-mode") {
 		igt_require(IS_BATTLEMAGE(devid));
 		igt_require_f(!is_vf_device, "survivability mode not supported in VF\n");
+		configfs_device_fd = create_device_configfs_group(configfs_fd);
 		test_survivability_mode(configfs_device_fd);
+		close(configfs_device_fd);
+		igt_fs_remove_dir(configfs_fd, bus_addr);
 	}
 
 	igt_describe("Validate engines_allowed with invalid options");
-	igt_subtest("engines-allowed-invalid")
+	igt_subtest("engines-allowed-invalid") {
+		configfs_device_fd = create_device_configfs_group(configfs_fd);
 		test_engines_allowed_invalid(configfs_device_fd);
+		close(configfs_device_fd);
+		igt_fs_remove_dir(configfs_fd, bus_addr);
+	}
 
 	igt_describe("Validate engines_allowed");
-	igt_subtest("engines-allowed")
+	igt_subtest("engines-allowed") {
+		configfs_device_fd = create_device_configfs_group(configfs_fd);
 		test_engines_allowed(configfs_device_fd);
+		close(configfs_device_fd);
+		igt_fs_remove_dir(configfs_fd, bus_addr);
+	}
 
 	igt_describe("Validate gt_types_allowed");
-	igt_subtest("gt-types-allowed")
+	igt_subtest("gt-types-allowed") {
+		configfs_device_fd = create_device_configfs_group(configfs_fd);
 		test_gt_types_allowed(configfs_device_fd);
+		close(configfs_device_fd);
+		igt_fs_remove_dir(configfs_fd, bus_addr);
+	}
 
 	igt_describe("Validate ctx_restore_post_bb with invalid options");
-	igt_subtest("ctx-restore-post-bb-invalid")
+	igt_subtest("ctx-restore-post-bb-invalid") {
+		configfs_device_fd = create_device_configfs_group(configfs_fd);
 		test_ctx_restore_invalid(configfs_device_fd, "post");
+		close(configfs_device_fd);
+		igt_fs_remove_dir(configfs_fd, bus_addr);
+	}
 
 	igt_describe("Validate ctx_restore_post_bb");
-	igt_subtest("ctx-restore-post-bb")
+	igt_subtest("ctx-restore-post-bb") {
+		configfs_device_fd = create_device_configfs_group(configfs_fd);
 		test_ctx_restore(configfs_device_fd, "post");
+		close(configfs_device_fd);
+		igt_fs_remove_dir(configfs_fd, bus_addr);
+	}
 
 	igt_describe("Validate ctx_restore_mid_bb with invalid options");
-	igt_subtest("ctx-restore-mid-bb-invalid")
+	igt_subtest("ctx-restore-mid-bb-invalid") {
+		configfs_device_fd = create_device_configfs_group(configfs_fd);
 		test_ctx_restore_invalid(configfs_device_fd, "mid");
+		close(configfs_device_fd);
+		igt_fs_remove_dir(configfs_fd, bus_addr);
+	}
 
 	igt_describe("Validate ctx_restore_mid_bb");
-	igt_subtest("ctx-restore-mid-bb")
+	igt_subtest("ctx-restore-mid-bb") {
+		configfs_device_fd = create_device_configfs_group(configfs_fd);
 		test_ctx_restore(configfs_device_fd, "mid");
+		close(configfs_device_fd);
+		igt_fs_remove_dir(configfs_fd, bus_addr);
+	}
 
 	igt_fixture() {
-		close(configfs_device_fd);
 		close(configfs_fd);
 	}
 }
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread
* [PATCH] tests/intel/xe_configfs: Reset configfs group after each subtest
@ 2026-02-09 13:18 Nitin Gote
  2026-02-11 11:50 ` Kamil Konieczny
  0 siblings, 1 reply; 11+ messages in thread
From: Nitin Gote @ 2026-02-09 13:18 UTC (permalink / raw)
  To: igt-dev, kamil.konieczny; +Cc: michal.wajdeczko, Nitin Gote

The xe_configfs test uses a shared configfs group across all subtests.
When subtests modify configfs attributes without resetting them, the
modified values persist and affect subsequent subtests. For example,
ctx-restore-mid-bb reports register value mismatches due to stale
batch buffer data from previous subtests.

Fix by removing the configfs device directory after each subtest and
letting the next subtest recreate it to get default values as
hardcoded in the driver.

Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/6204
Signed-off-by: Nitin Gote <nitin.r.gote@intel.com>
---
Hi Kamil,
Thank you for the review, I used helper function
in v3 version.

v2->v3: Use helper function (Kamil)
v1->v2:
  Instead of manually resetting each attribute,
  it's cleaner to remove and recreate the configfs group after
  each subtests. (Michal)

 tests/intel/xe_configfs.c | 45 +++++++++++++++++++++++++++++++--------
 1 file changed, 36 insertions(+), 9 deletions(-)

diff --git a/tests/intel/xe_configfs.c b/tests/intel/xe_configfs.c
index d2dfd2e87..59c9359f5 100644
--- a/tests/intel/xe_configfs.c
+++ b/tests/intel/xe_configfs.c
@@ -346,6 +346,12 @@ static int create_device_configfs_group(int configfs_fd)
 	return configfs_device_fd;
 }
 
+static void close_configfs_group(int configfs_fd, int configfs_device_fd)
+{
+	close(configfs_device_fd);
+	igt_fs_remove_dir(configfs_fd, bus_addr);
+}
+
 int igt_main()
 {
 	int fd, configfs_fd, configfs_device_fd;
@@ -361,7 +367,6 @@ int igt_main()
 
 		configfs_fd = igt_configfs_open("xe");
 		igt_require(configfs_fd != -1);
-		configfs_device_fd = create_device_configfs_group(configfs_fd);
 		igt_install_exit_handler(restore);
 	}
 
@@ -369,39 +374,61 @@ int igt_main()
 	igt_subtest("survivability-mode") {
 		igt_require(IS_BATTLEMAGE(devid));
 		igt_require_f(!is_vf_device, "survivability mode not supported in VF\n");
+		configfs_device_fd = create_device_configfs_group(configfs_fd);
 		test_survivability_mode(configfs_device_fd);
+		close_configfs_group(configfs_fd, configfs_device_fd);
 	}
 
 	igt_describe("Validate engines_allowed with invalid options");
-	igt_subtest("engines-allowed-invalid")
+	igt_subtest("engines-allowed-invalid") {
+		configfs_device_fd = create_device_configfs_group(configfs_fd);
 		test_engines_allowed_invalid(configfs_device_fd);
+		close_configfs_group(configfs_fd, configfs_device_fd);
+	}
 
 	igt_describe("Validate engines_allowed");
-	igt_subtest("engines-allowed")
+	igt_subtest("engines-allowed") {
+		configfs_device_fd = create_device_configfs_group(configfs_fd);
 		test_engines_allowed(configfs_device_fd);
+		close_configfs_group(configfs_fd, configfs_device_fd);
+	}
 
 	igt_describe("Validate gt_types_allowed");
-	igt_subtest("gt-types-allowed")
+	igt_subtest("gt-types-allowed") {
+		configfs_device_fd = create_device_configfs_group(configfs_fd);
 		test_gt_types_allowed(configfs_device_fd);
+		close_configfs_group(configfs_fd, configfs_device_fd);
+	}
 
 	igt_describe("Validate ctx_restore_post_bb with invalid options");
-	igt_subtest("ctx-restore-post-bb-invalid")
+	igt_subtest("ctx-restore-post-bb-invalid") {
+		configfs_device_fd = create_device_configfs_group(configfs_fd);
 		test_ctx_restore_invalid(configfs_device_fd, "post");
+		close_configfs_group(configfs_fd, configfs_device_fd);
+	}
 
 	igt_describe("Validate ctx_restore_post_bb");
-	igt_subtest("ctx-restore-post-bb")
+	igt_subtest("ctx-restore-post-bb") {
+		configfs_device_fd = create_device_configfs_group(configfs_fd);
 		test_ctx_restore(configfs_device_fd, "post");
+		close_configfs_group(configfs_fd, configfs_device_fd);
+	}
 
 	igt_describe("Validate ctx_restore_mid_bb with invalid options");
-	igt_subtest("ctx-restore-mid-bb-invalid")
+	igt_subtest("ctx-restore-mid-bb-invalid") {
+		configfs_device_fd = create_device_configfs_group(configfs_fd);
 		test_ctx_restore_invalid(configfs_device_fd, "mid");
+		close_configfs_group(configfs_fd, configfs_device_fd);
+	}
 
 	igt_describe("Validate ctx_restore_mid_bb");
-	igt_subtest("ctx-restore-mid-bb")
+	igt_subtest("ctx-restore-mid-bb") {
+		configfs_device_fd = create_device_configfs_group(configfs_fd);
 		test_ctx_restore(configfs_device_fd, "mid");
+		close_configfs_group(configfs_fd, configfs_device_fd);
+	}
 
 	igt_fixture() {
-		close(configfs_device_fd);
 		close(configfs_fd);
 	}
 }
-- 
2.50.1


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

end of thread, other threads:[~2026-02-11 11:51 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-04 16:03 [PATCH] tests/intel/xe_configfs: Reset configfs group after each subtest Nitin Gote
2026-02-04 17:51 ` ✓ Xe.CI.BAT: success for " Patchwork
2026-02-04 18:09 ` ✓ i915.CI.BAT: " Patchwork
2026-02-05  4:20 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-02-09  7:15   ` Gote, Nitin R
2026-02-09  9:00     ` Ravali, JupallyX
2026-02-05  7:10 ` ✗ i915.CI.Full: " Patchwork
2026-02-09  8:11 ` ✓ i915.CI.Full: success " Patchwork
2026-02-09 11:24 ` [PATCH] " Kamil Konieczny
  -- strict thread matches above, loose matches on Subject: below --
2026-02-09 13:18 Nitin Gote
2026-02-11 11:50 ` Kamil Konieczny

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