Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Yao, Jia" <jia.yao@intel.com>
To: Zongyao Bai <zongyao.bai@intel.com>, <igt-dev@lists.freedesktop.org>
Cc: <shuicheng.lin@intel.com>
Subject: Re: [PATCH 2/3] tests/intel/xe_pm_residency: Wait for stable C6 before measuring
Date: Wed, 2 Dec 2026 15:14:13 -0800	[thread overview]
Message-ID: <632064b7-4384-45a6-b233-6263490f03fe@intel.com> (raw)
In-Reply-To: <20261119005009.364632-3-zongyao.bai@intel.com>

LGTM.

Reviewed-by: Jia Yao <jia.yao@intel.com>

On 11/18/2026 4:50 PM, Zongyao Bai wrote:
> test_idle_residency() (idle-residency and gt-c6-freeze) waited only once
> for xe_gt_is_in_c6() and then immediately started the 3s measurement. If
> the GT had just visited C6 while deferred cleanup work from the previously
> executed test was still running (observed after xe_pat@pat-index-auto,
> which leaves ~1s of GT activity at fd close), the measurement window
> included that activity and the test failed with residency well below 90%.
>
> Wait for 500ms of uninterrupted C6 (with the residency counter following)
> before opening the measurement window, using xe_gt_wait_c6_stable(). This
> also removes the dependency on test execution order.
>
> In toggle-gt-c6 do the same only once, before sampling the C6 power; the
> other repetitions only check the C0/C6 transitions and keep the quick
> single-shot wait.
>
> Signed-off-by: Zongyao Bai <zongyao.bai@intel.com>
> ---
>   tests/intel/xe_pm_residency.c | 21 ++++++++++++++++++---
>   1 file changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/tests/intel/xe_pm_residency.c b/tests/intel/xe_pm_residency.c
> index c5240378a..3f97e882d 100644
> --- a/tests/intel/xe_pm_residency.c
> +++ b/tests/intel/xe_pm_residency.c
> @@ -28,6 +28,8 @@
>   
>   #define NUM_REPS 16 /* No of Repetitions */
>   #define SLEEP_DURATION 3 /* in seconds */
> +#define C6_STABLE_MS 500 /* GT must stay in C6 this long before measuring */
> +#define C6_STABLE_TIMEOUT_MS 5000
>   
>   const double tolerance = 0.1;
>   int fw_handle = -1;
> @@ -217,9 +219,14 @@ 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) ||
> +	/*
> +	 * A single visit to C6 is not enough: deferred work of previous
> +	 * tests may still wake the GT up after it, which would be accounted
> +	 * in the measurement below. Wait for a stable C6 window first.
> +	 */
> +	igt_assert_f(xe_gt_wait_c6_stable(fd, gt, C6_STABLE_MS, C6_STABLE_TIMEOUT_MS) ||
>   		     xe_gt_dump_debug_info(fd, gt),
> -		     "GT %d not in C6\n", gt);
> +		     "GT %d not in stable C6\n", gt);
>   
>   	if (flag == TEST_S2IDLE) {
>   		clock_gettime(CLOCK_BOOTTIME, &ts_start);
> @@ -332,8 +339,16 @@ static void toggle_gt_c6(int fd, int n)
>   				     xe_gt_dump_debug_info(fd, gt),
>   				     "Forcewake released, GT %d should be in C6\n", gt);
>   
> -		if (n == NUM_REPS)
> +		if (n == NUM_REPS) {
> +			/* Only the power sample needs the GT to be really idle */
> +			xe_for_each_gt(fd, gt)
> +				igt_assert_f(xe_gt_wait_c6_stable(fd, gt, C6_STABLE_MS,
> +								  C6_STABLE_TIMEOUT_MS) ||
> +					     xe_gt_dump_debug_info(fd, gt),
> +					     "Forcewake released, GT %d should be in stable C6\n", gt);
> +
>   			measure_power(&gpu, &gt_c6_power);
> +		}
>   	} while (--n);
>   
>   	igt_power_close(&gpu);

  reply	other threads:[~2026-12-02 23:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19  0:50 [PATCH 0/3] tests/intel/xe_pm_residency: Wait for a stable C6 before measuring residency Zongyao Bai
2026-11-19  0:50 ` [PATCH 1/3] lib/xe/xe_gt: Add xe_gt_wait_c6_stable() Zongyao Bai
2026-12-02 23:16   ` Yao, Jia
2026-11-19  0:50 ` [PATCH 2/3] tests/intel/xe_pm_residency: Wait for stable C6 before measuring Zongyao Bai
2026-12-02 23:14   ` Yao, Jia [this message]
2026-11-19  0:50 ` [PATCH 3/3] tests/intel/xe_pmu: Wait for stable C6 in gt-c6-idle Zongyao Bai
2026-12-02 23:16   ` Yao, Jia
2026-11-19  7:10 ` ✓ Xe.CI.BAT: success for tests/intel/xe_pm_residency: Wait for a stable C6 before measuring residency Patchwork
2026-11-19 13:06 ` ✓ i915.CI.BAT: " Patchwork
2026-11-20 10:20 ` ✓ Xe.CI.FULL: " Patchwork
2026-11-20 13:29 ` ✗ i915.CI.Full: failure " Patchwork

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=632064b7-4384-45a6-b233-6263490f03fe@intel.com \
    --to=jia.yao@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=shuicheng.lin@intel.com \
    --cc=zongyao.bai@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