Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sk Anirban <sk.anirban@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: anshuman.gupta@intel.com, badal.nilawar@intel.com,
	riana.tauro@intel.com, karthik.poosa@intel.com,
	raag.jadav@intel.com, soham.purkait@intel.com,
	mallesh.koujalagi@intel.com, kamil.konieczny@intel.com,
	Sk Anirban <sk.anirban@intel.com>
Subject: [PATCH v2] tests/intel: Avoid stale errno
Date: Fri,  4 Sep 2026 15:30:43 +0530	[thread overview]
Message-ID: <20260904100042.583658-2-sk.anirban@intel.com> (raw)

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


             reply	other threads:[~2026-09-04 10:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04 10:00 Sk Anirban [this message]
2026-09-04 10:58 ` ✓ Xe.CI.BAT: success for tests/intel: Avoid stale errno 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

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=20260904100042.583658-2-sk.anirban@intel.com \
    --to=sk.anirban@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=badal.nilawar@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@intel.com \
    --cc=karthik.poosa@intel.com \
    --cc=mallesh.koujalagi@intel.com \
    --cc=raag.jadav@intel.com \
    --cc=riana.tauro@intel.com \
    --cc=soham.purkait@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