From: "Tauro, Riana" <riana.tauro@intel.com>
To: Sk Anirban <sk.anirban@intel.com>, <igt-dev@lists.freedesktop.org>
Cc: <anshuman.gupta@intel.com>, <badal.nilawar@intel.com>,
<karthik.poosa@intel.com>, <raag.jadav@intel.com>,
<soham.purkait@intel.com>, <mallesh.koujalagi@intel.com>
Subject: Re: [PATCH v2] tests/intel/xe_pm_residency: Fix suspend duration calculation
Date: Mon, 30 Mar 2026 16:56:01 +0530 [thread overview]
Message-ID: <e3b22647-b9e2-4c85-a10b-562cc036cea6@intel.com> (raw)
In-Reply-To: <20260326092956.2154139-2-sk.anirban@intel.com>
On 3/26/2026 2:59 PM, Sk Anirban wrote:
> 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)
>
> 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 | 19 ++++++++++++++-----
> 1 file changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/tests/intel/xe_pm_residency.c b/tests/intel/xe_pm_residency.c
> index 61b63ed4f..f2b802273 100644
> --- a/tests/intel/xe_pm_residency.c
> +++ b/tests/intel/xe_pm_residency.c
> @@ -215,18 +215,27 @@ 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;
> + long elapsed_sec, elapsed_nsec;
>
> 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_sec = ts_end.tv_sec - ts_start.tv_sec;
> + elapsed_nsec = ts_end.tv_nsec - ts_start.tv_nsec;
> +
> + if (elapsed_nsec < 0) {
> + elapsed_sec--;
> + elapsed_nsec += NSEC_PER_SEC;
>
> You could use igt_time_elapsed. Also remove the below check that hid the bug.
> It shouldn't be needed when boot time is used
>
> Thanks
> Riana
>
> + }
> +
> + elapsed_ms = (elapsed_sec * MSEC_PER_SEC) + (elapsed_nsec / NSEC_PER_MSEC);
> }
>
> if (flag == TEST_IDLE) {
prev parent reply other threads:[~2026-03-30 11:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-26 9:29 [PATCH v2] tests/intel/xe_pm_residency: Fix suspend duration calculation Sk Anirban
2026-03-26 21:16 ` ✓ Xe.CI.BAT: success for tests/intel/xe_pm_residency: Fix suspend duration calculation (rev2) Patchwork
2026-03-26 21:31 ` ✓ i915.CI.BAT: " Patchwork
2026-03-27 12:49 ` ✓ Xe.CI.FULL: " Patchwork
2026-03-27 20:40 ` ✓ i915.CI.Full: " Patchwork
2026-03-30 11:26 ` Tauro, Riana [this message]
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=e3b22647-b9e2-4c85-a10b-562cc036cea6@intel.com \
--to=riana.tauro@intel.com \
--cc=anshuman.gupta@intel.com \
--cc=badal.nilawar@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=karthik.poosa@intel.com \
--cc=mallesh.koujalagi@intel.com \
--cc=raag.jadav@intel.com \
--cc=sk.anirban@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