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, ville.syrjala@intel.com,
jani.nikula@intel.com, Sk Anirban <sk.anirban@intel.com>
Subject: [PATCH v3] tests/intel/xe_pm_residency: Fix suspend duration calculation
Date: Tue, 31 Mar 2026 16:08:17 +0530 [thread overview]
Message-ID: <20260331103816.2489563-2-sk.anirban@intel.com> (raw)
Calculate actual suspend duration using CLOCK_BOOTTIME instead of
relying on the autoresume delay approximation. This ensures accurate
validation of idle residency measurements during suspend cycles.
v2: Use CLOCK_BOOTTIME (Ville)
Use Fixes (Jani)
v3: Use igt_time_elapsed (Riana)
Remove check (Riana)
Fixes: 5c85b336f75b ("tests/xe: Add a test that validates residency during s2idle")
Signed-off-by: Sk Anirban <sk.anirban@intel.com>
---
tests/intel/xe_pm_residency.c | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/tests/intel/xe_pm_residency.c b/tests/intel/xe_pm_residency.c
index 61b63ed4f..70dcf432e 100644
--- a/tests/intel/xe_pm_residency.c
+++ b/tests/intel/xe_pm_residency.c
@@ -215,18 +215,18 @@ static unsigned long read_idle_residency(int fd, int gt)
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);
if (flag == TEST_S2IDLE) {
- /*
- * elapsed time during suspend is approximately equal to autoresume delay
- * when a full suspend cycle(SUSPEND_TEST_NONE) is used.
- */
- elapsed_ms = igt_get_autoresume_delay(SUSPEND_STATE_FREEZE);
+ clock_gettime(CLOCK_BOOTTIME, &ts_start);
residency_start = read_idle_residency(fd, gt);
igt_system_suspend_autoresume(SUSPEND_STATE_FREEZE, SUSPEND_TEST_NONE);
residency_end = read_idle_residency(fd, gt);
+ clock_gettime(CLOCK_BOOTTIME, &ts_end);
+
+ elapsed_ms = igt_time_elapsed(&ts_start, &ts_end) * 1000;
}
if (flag == TEST_IDLE) {
@@ -238,14 +238,6 @@ static void test_idle_residency(int fd, int gt, enum test_type flag)
igt_info("Measured %lums of idle residency in %lums\n",
residency_end - residency_start, elapsed_ms);
- /*
- * When suspended (system or runtime suspend), device needs to be woken up to read
- * residency. Idle residency may increase during resume thus being greater than
- * elapsed ms.
- */
- if ((residency_end - residency_start) >= elapsed_ms)
- return;
-
assert_within_epsilon(residency_end - residency_start, elapsed_ms, tolerance);
}
--
2.43.0
next reply other threads:[~2026-03-31 10:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-31 10:38 Sk Anirban [this message]
2026-03-31 14:15 ` ✓ Xe.CI.BAT: success for tests/intel/xe_pm_residency: Fix suspend duration calculation (rev3) Patchwork
2026-03-31 14:34 ` ✓ i915.CI.BAT: " Patchwork
2026-03-31 18:15 ` ✓ Xe.CI.FULL: " Patchwork
2026-04-01 4:42 ` ✗ i915.CI.Full: failure " Patchwork
2026-04-02 6:42 ` [PATCH v3] tests/intel/xe_pm_residency: Fix suspend duration calculation Tauro, Riana
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=20260331103816.2489563-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=jani.nikula@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 \
--cc=ville.syrjala@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