Skip to contentSkip to conversation

tests/intel: Add powergate info to GT C6 failures

PATCH New Sk Anirban 2 participants 2 messages May 19

lore
Share & tools
lore

Sk Anirban

author
#0 lore raw

PATCH 1/1 tests/intel: Add powergate info to GT C6 failures

Add xe_gt_dump_powergate_info() calls to xe_gt_is_in_c6() assertions to provide detailed power state information when GT C6 checks fail. This improves debugging by showing exact powergate status instead of just reporting that GT is not in C6.

---
 lib/xe/xe_gt.c                | 30 ++++++++++++++++++++++++++++--
 lib/xe/xe_gt.h                |  1 +
 tests/intel/xe_gt_freq.c      | 21 ++++++++++++++-------
 tests/intel/xe_pm_residency.c | 16 +++++++++++-----
 tests/intel/xe_pmu.c          |  4 +++-
 5 files changed, 57 insertions(+), 15 deletions(-)
lib/xe/xe_gt.c +28 -2
index 8f54b6e25..24fbab13d 100644
@@ -223,11 +223,37 @@ bool xe_gt_is_in_c6(int fd, int gt)
 	if (!strcmp(gt_c_state, "gt-c6"))
 		return true;
 
-	igt_debug("GT%d C-state is %s\n", gt, gt_c_state);
-
 	return false;
 }
 
+/**
+ * xe_gt_dump_powergate_info:
+ * @fd: pointer to xe drm fd
+ * @gt: gt number
+ *
+ * Print gt powergate_info debugfs details.
+ */
+const char *xe_gt_dump_powergate_info(int fd, int gt)
+{
+	static char str[1024];
+	char gt_c_state[16];
+	char path[64];
+	int gt_fd;
+
+	str[0] = '\0';
+	gt_fd = xe_sysfs_gt_open(fd, gt);
+	igt_assert(gt_fd >= 0);
+
+	snprintf(path, sizeof(path), "gt%d/powergate_info", gt);
+	igt_assert(igt_sysfs_scanf(gt_fd, "gtidle/idle_status", "%s", gt_c_state) == 1);
+	igt_debugfs_read(fd, path, str);
+	close(gt_fd);
+
+	igt_debug("GT%d C-state: %s\n", gt, gt_c_state);
+
+	return str;
+}
+
 /**
  * xe_gt_fill_engines_by_class:
  * @fd: pointer to xe drm fd
lib/xe/xe_gt.h +1 -0
index 93525ea35..e2177eb20 100644
@@ -21,6 +21,7 @@ void xe_post_hang_ring(int fd, igt_hang_t arg);
 int xe_gt_stats_get_count(int fd, int gt, const char *stat);
 
 bool xe_gt_is_in_c6(int fd, int gt);
+const char *xe_gt_dump_powergate_info(int fd, int gt);
 
 int xe_gt_fill_engines_by_class(int fd, int gt, int class,
 				struct drm_xe_engine_class_instance eci[static XE_MAX_ENGINE_INSTANCE]);
tests/intel/xe_gt_freq.c +14 -7
index 19306dc41..75d77e96f 100644
@@ -58,7 +58,8 @@ static void test_throttle_basic_api(int fd, int gt_id)
 	int gt_fd;
 
 	igt_assert_f(igt_wait(xe_gt_is_in_c6(fd, gt_id), 1000, 10),
-		     "GT %d should be in C6\n", gt_id);
+		     "GT %d should be in C6\nPower Gate info:\n%s\n",
+		     gt_id, xe_gt_dump_powergate_info(fd, gt_id));
 
 	gt_fd = xe_sysfs_gt_open(fd, gt_id);
 	igt_assert_lte(0, gt_fd);
@@ -146,7 +147,8 @@ static void test_freq_fixed(int fd, int gt_id, bool gt_idle)
 	if (gt_idle) {
 		/* Wait for GT to go in C6 as previous xe_gt_get_freq wakes up GT*/
 		igt_assert_f(igt_wait(xe_gt_is_in_c6(fd, gt_id), 1000, 10),
-			     "GT %d should be in C6\n", gt_id);
+			     "GT %d should be in C6\nPower Gate info:\n%s\n",
+			     gt_id, xe_gt_dump_powergate_info(fd, gt_id));
 		igt_assert(xe_gt_get_freq(fd, gt_id, "act") == 0);
 	} else {
 		igt_assert_eq_u32(xe_gt_get_freq(fd, gt_id, "act"), rpn);
@@ -161,7 +163,8 @@ static void test_freq_fixed(int fd, int gt_id, bool gt_idle)
 
 	if (gt_idle) {
 		igt_assert_f(igt_wait(xe_gt_is_in_c6(fd, gt_id), 1000, 10),
-			     "GT %d should be in C6\n", gt_id);
+			     "GT %d should be in C6\nPower Gate info:\n%s\n",
+			     gt_id, xe_gt_dump_powergate_info(fd, gt_id));
 		igt_assert(xe_gt_get_freq(fd, gt_id, "act") == 0);
 	} else {
 		act_freq = xe_gt_get_freq(fd, gt_id, "act");
@@ -180,7 +183,8 @@ static void test_freq_fixed(int fd, int gt_id, bool gt_idle)
 
 	if (gt_idle) {
 		igt_assert_f(igt_wait(xe_gt_is_in_c6(fd, gt_id), 1000, 10),
-			     "GT %d should be in C6\n", gt_id);
+			     "GT %d should be in C6\nPower Gate info:\n%s\n",
+			     gt_id, xe_gt_dump_powergate_info(fd, gt_id));
 		igt_assert(xe_gt_get_freq(fd, gt_id, "act") == 0);
 	}
 
@@ -211,7 +215,8 @@ static void test_freq_range(int fd, int gt_id, bool gt_idle)
 
 	if (gt_idle) {
 		igt_assert_f(igt_wait(xe_gt_is_in_c6(fd, gt_id), 1000, 10),
-			     "GT %d should be in C6\n", gt_id);
+			     "GT %d should be in C6\nPower Gate info:\n%s\n",
+			     gt_id, xe_gt_dump_powergate_info(fd, gt_id));
 		igt_assert(xe_gt_get_freq(fd, gt_id, "act") == 0);
 	} else {
 		act = xe_gt_get_freq(fd, gt_id, "act");
@@ -412,7 +417,8 @@ int igt_main()
 	igt_subtest("freq_fixed_idle") {
 		xe_for_each_gt(fd, gt) {
 			igt_require_f(igt_wait(xe_gt_is_in_c6(fd, gt), 1000, 10),
-				      "GT %d should be in C6\n", gt);
+				      "GT %d should be in C6\nPower Gate info:\n%s\n",
+				      gt, xe_gt_dump_powergate_info(fd, gt));
 			test_freq_fixed(fd, gt, true);
 		}
 	}
@@ -430,7 +436,8 @@ int igt_main()
 	igt_subtest("freq_range_idle") {
 		xe_for_each_gt(fd, gt) {
 			igt_require_f(igt_wait(xe_gt_is_in_c6(fd, gt), 1000, 10),
-				      "GT %d should be in C6\n", gt);
+				      "GT %d should be in C6\nPower Gate info:\n%s\n",
+				      gt, xe_gt_dump_powergate_info(fd, gt));
 			test_freq_range(fd, gt, true);
 		}
 	}
tests/intel/xe_pm_residency.c +11 -5
index bfae1f844..6fe5f83eb 100644
@@ -217,7 +217,9 @@ static void test_idle_residency(int fd, int gt, enum test_type flag)
 	unsigned long elapsed_ms, residency_start, residency_end;
 	struct timespec ts_start, ts_end;
 
-	igt_assert_f(igt_wait(xe_gt_is_in_c6(fd, gt), 1000, 1), "GT %d not in C6\n", gt);
+	igt_assert_f(igt_wait(xe_gt_is_in_c6(fd, gt), 1000, 1),
+		     "GT %d not in C6\nPower Gate info:\n%s\n",
+		     gt, xe_gt_dump_powergate_info(fd, gt));
 
 	if (flag == TEST_S2IDLE) {
 		clock_gettime(CLOCK_BOOTTIME, &ts_start);
@@ -318,7 +320,8 @@ static void toggle_gt_c6(int fd, int n)
 		/* check if all gts are in C0 after forcewake is acquired */
 		xe_for_each_gt(fd, gt)
 			igt_assert_f(!xe_gt_is_in_c6(fd, gt),
-				     "Forcewake acquired, GT %d should be in C0\n", gt);
+				     "Forcewake acquired, GT %d should be in C0\nPower Gate info:\n%s\n",
+				     gt, xe_gt_dump_powergate_info(fd, gt));
 
 		if (n == NUM_REPS)
 			measure_power(&gpu, &gt_c0_power);
@@ -327,7 +330,8 @@ static void toggle_gt_c6(int fd, int n)
 		/* check if all gts are in C6 after forcewake is released */
 		xe_for_each_gt(fd, gt)
 			igt_assert_f(igt_wait(xe_gt_is_in_c6(fd, gt), 1000, 1),
-				     "Forcewake released, GT %d should be in C6\n", gt);
+				     "Forcewake released, GT %d should be in C6\nPower Gate info:\n%s\n",
+				     gt, xe_gt_dump_powergate_info(fd, gt));
 
 		if (n == NUM_REPS)
 			measure_power(&gpu, &gt_c6_power);
@@ -393,7 +397,8 @@ static void cpg_gt_toggle(int fd)
 
 	xe_for_each_gt(fd, gt)
 		igt_skip_on_f(!igt_wait(xe_gt_is_in_c6(fd, gt), 1000, 10),
-			      "GT %d is not in C6\n", gt);
+			      "GT %d not in C6\nPower Gate info:\n%s\n", gt,
+				  xe_gt_dump_powergate_info(fd, gt));
 
 	fw_handle = igt_debugfs_open(fd, "forcewake_all", O_RDONLY);
 	igt_assert_lte(0, fw_handle);
@@ -581,7 +586,8 @@ int igt_main()
 		xe_for_each_gt(fd, gt)
 			igt_dynamic_f("gt%u", gt)
 				igt_assert_f(igt_wait(xe_gt_is_in_c6(fd, gt), 1000, 1),
-					     "GT %d not in C6\n", gt);
+					     "GT %d not in C6\nPower Gate info:\n%s\n",
+					     gt, xe_gt_dump_powergate_info(fd, gt));
 	}
 
 	igt_describe("Validate idle residency measured over suspend cycle is within the tolerance");
tests/intel/xe_pmu.c +3 -1
index fb4b871e7..5031772f0 100644
@@ -876,7 +876,9 @@ static void test_gt_c6_idle(int xe, unsigned int gt)
 
 	pmu_fd = open_pmu(xe, pmu_config);
 
-	igt_require_f(igt_wait(xe_gt_is_in_c6(xe, gt), 1000, 10), "GT %d should be in C6\n", gt);
+	igt_require_f(igt_wait(xe_gt_is_in_c6(xe, gt), 1000, 10),
+		      "GT %d should be in C6\nPower Gate info:\n%s\n",
+		      gt, xe_gt_dump_powergate_info(xe, gt));
 
 	/* While idle check full RC6. */
 	start = read_idle_residency(xe, gt);
Signature · 1 line
2.43.0
#1 lore raw

✗ Fi.CI.BUILD: failure for tests/intel: Add powergate info to GT C6 failures

== Series Details ==

== Series Details ==

Series: tests/intel: Add powergate info to GT C6 failures
URL : https://patchwork.freedesktop.org/series/166836/
State : failure

== Summary ==

Applying: tests/intel: Add powergate info to GT C6 failures Using index info to reconstruct a base tree...
M tests/intel/xe_pm_residency.c
Falling back to patching base and 3-way merge... Auto-merging tests/intel/xe_pm_residency.c
CONFLICT (content): Merge conflict in tests/intel/xe_pm_residency.c Patch failed at 0001 tests/intel: Add powergate info to GT C6 failures When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".