Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] tests/intel: Avoid stale errno
@ 2026-09-04 10:00 Sk Anirban
  2026-09-04 10:58 ` ✓ Xe.CI.BAT: success for " Patchwork
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Sk Anirban @ 2026-09-04 10:00 UTC (permalink / raw)
  To: igt-dev
  Cc: anshuman.gupta, badal.nilawar, riana.tauro, karthik.poosa,
	raag.jadav, soham.purkait, mallesh.koujalagi, kamil.konieczny,
	Sk Anirban

Commit <e311ed2c7> ("lib/igt_core: do not reset errno in igt_gettime")
removed an incidental errno reset that used to mask stale errno at
subtest entry. Now a stale errno from an earlier, unrelated probe can
survive into a later assertion failure and gets printed as a
misleading "Last errno" hint, e.g. in xe_gt_freq's throttle_basic_api:

  CRITICAL: Failed assertion: !strcmp(throttle_reasons, "none")
  CRITICAL: Last errno: 2, No such file or directory
  CRITICAL: GT 0 is throttled due to: pl4

The real cause is the GT being throttled; "Last errno: 2" is stale
and unrelated, making triage confusing.

Fix this by clearing errno right where it is known to go stale.

v2: Update fix path (Kamil)

Signed-off-by: Sk Anirban <sk.anirban@intel.com>
---
 lib/xe/xe_gt.c                | 1 +
 tests/intel/xe_gt_freq.c      | 1 +
 tests/intel/xe_pm.c           | 1 +
 tests/intel/xe_pm_residency.c | 1 +
 tests/intel/xe_pmu.c          | 1 +
 5 files changed, 5 insertions(+)

diff --git a/lib/xe/xe_gt.c b/lib/xe/xe_gt.c
index 8f54b6e25..3d8b4f68a 100644
--- a/lib/xe/xe_gt.c
+++ b/lib/xe/xe_gt.c
@@ -224,6 +224,7 @@ bool xe_gt_is_in_c6(int fd, int gt)
 		return true;
 
 	igt_debug("GT%d C-state is %s\n", gt, gt_c_state);
+	errno = 0;
 
 	return false;
 }
diff --git a/tests/intel/xe_gt_freq.c b/tests/intel/xe_gt_freq.c
index 19306dc41..886537862 100644
--- a/tests/intel/xe_gt_freq.c
+++ b/tests/intel/xe_gt_freq.c
@@ -397,6 +397,7 @@ int igt_main()
 			stash_min[gt] = xe_gt_get_freq(fd, gt, "min");
 			stash_max[gt] = xe_gt_get_freq(fd, gt, "max");
 		}
+		errno = 0;
 	}
 
 	igt_subtest("throttle_basic_api") {
diff --git a/tests/intel/xe_pm.c b/tests/intel/xe_pm.c
index 7faba7c2b..543f46f5b 100644
--- a/tests/intel/xe_pm.c
+++ b/tests/intel/xe_pm.c
@@ -990,6 +990,7 @@ int igt_main()
 
 		igt_install_exit_handler(igt_drm_debug_mask_reset_exit_handler);
 		update_debug_mask_if_ci(DRM_UT_KMS);
+		errno = 0;
 	}
 
 	for (const struct s_state *s = s_states; s->name; s++) {
diff --git a/tests/intel/xe_pm_residency.c b/tests/intel/xe_pm_residency.c
index bfae1f844..e976048a9 100644
--- a/tests/intel/xe_pm_residency.c
+++ b/tests/intel/xe_pm_residency.c
@@ -574,6 +574,7 @@ int igt_main()
 
 		igt_require(!IS_PONTEVECCHIO(xe_dev_id(fd)));
 		igt_require(xe_sysfs_gt_has_node(fd, 0, "gtidle"));
+		errno = 0;
 	}
 
 	igt_describe("Validate GT C6 on idle");
diff --git a/tests/intel/xe_pmu.c b/tests/intel/xe_pmu.c
index a8ceac46c..5b098c45c 100644
--- a/tests/intel/xe_pmu.c
+++ b/tests/intel/xe_pmu.c
@@ -1076,6 +1076,7 @@ int igt_main()
 		xe_perf_device(fd, xe_device, sizeof(xe_device));
 		num_engines = xe_number_engines(fd);
 		has_engine_active_ticks = has_event(xe_device, "engine-active-ticks");
+		errno = 0;
 	}
 
 	igt_describe("Validate PMU gt-c6 residency counters when idle");
-- 
2.43.0


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

end of thread, other threads:[~2026-09-07 10:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-04 10:00 [PATCH v2] tests/intel: Avoid stale errno Sk Anirban
2026-09-04 10:58 ` ✓ Xe.CI.BAT: success for " Patchwork
2026-09-04 11:15 ` ✓ i915.CI.BAT: " Patchwork
2026-09-04 21:26 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-09-07 10:30   ` Anirban, Sk
2026-09-04 23:04 ` ✗ i915.CI.Full: " Patchwork
2026-09-07  9:42 ` [PATCH v2] " Kamil Konieczny
2026-09-07 10:33   ` Anirban, Sk

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