Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH igt 1/2] igt/pm_rc6_residency: Replace hard-coded sleep before rc6 with a probe
Date: Tue, 5 Dec 2017 12:12:04 +0000	[thread overview]
Message-ID: <a21f7875-31f2-8647-0769-d462af12f32c@linux.intel.com> (raw)
In-Reply-To: <20171205105602.16135-1-chris@chris-wilson.co.uk>


On 05/12/2017 10:56, Chris Wilson wrote:
> Instead of trying to sleep for 2 evaluations intervals and then assuming
> that rc6 is working, poll the rc6 residency instead.
> 
> References: https://bugs.freedesktop.org/show_bug.cgi?id=104099
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>   tests/pm_rc6_residency.c | 33 ++++++++++++++-------------------
>   1 file changed, 14 insertions(+), 19 deletions(-)
> 
> diff --git a/tests/pm_rc6_residency.c b/tests/pm_rc6_residency.c
> index 3f6860199..16f4b1421 100644
> --- a/tests/pm_rc6_residency.c
> +++ b/tests/pm_rc6_residency.c
> @@ -122,9 +122,6 @@ static void measure_residencies(int devid, unsigned int mask,
>   	struct residencies end = { };
>   	int retry;
>   
> -	if (!mask)
> -		return;
> -
>   	/*
>   	 * Retry in case of counter wrap-around. We simply re-run the
>   	 * measurement, since the valid counter range is different on
> @@ -168,17 +165,18 @@ static void measure_residencies(int devid, unsigned int mask,
>   	res->rc6 += res->rc6p;
>   }
>   
> -static unsigned long rc6_enable_us(void)
> +static bool wait_for_rc6(void)
>   {
> -	/*
> -	 * To know how long we need to wait for the device to enter rc6 once
> -	 * idle, we need to look at GEN6_RC_EVALUATION_INTERVAL. Currently,
> -	 * this is set to 125000 (12500 * 1280ns or 0.16s) on all platforms.
> -	 * We must complete at least one EI with activity below the
> -	 * per-platform threshold for RC6 to kick. Therefore, we must wait
> -	 * at least 2 EI cycles, before we can expect rc6 to start ticking.
> -	 */
> -	return 2 * 160 * 1000;
> +	struct timespec tv = {};
> +	unsigned long start, now;
> +
> +	start = read_rc6_residency("rc6");
> +	do {
> +		usleep(50);
> +		now = read_rc6_residency("rc6");
> +	} while (now == start && !igt_seconds_elapsed(&tv));
> +
> +	return now != start;
>   }
>   
>   igt_main
> @@ -198,19 +196,17 @@ igt_main
>   
>   		/* Make sure rc6 counters are running */
>   		igt_drop_caches_set(fd, DROP_IDLE);
> -		usleep(rc6_enable_us());
> +		igt_require(wait_for_rc6());
>   
>   		close(fd);
>   
>   		rc6_enabled = get_rc6_enabled_mask();
> -		igt_require(rc6_enabled);
> +		igt_require(rc6_enabled & RC6_ENABLED);
>   	}
>   
>   	igt_subtest("rc6-accuracy") {
>   		struct residencies res;
>   
> -		igt_require(rc6_enabled & RC6_ENABLED);
> -
>   		measure_residencies(devid, rc6_enabled, &res);
>   		residency_accuracy(res.rc6, res.duration, "rc6");
>   	}
> @@ -218,8 +214,7 @@ igt_main
>   	igt_subtest("media-rc6-accuracy") {
>   		struct residencies res;
>   
> -		igt_require((rc6_enabled & RC6_ENABLED) &&
> -			    (IS_VALLEYVIEW(devid) || IS_CHERRYVIEW(devid)));
> +		igt_require(IS_VALLEYVIEW(devid) || IS_CHERRYVIEW(devid));
>   
>   		measure_residencies(devid, rc6_enabled, &res);
>   		residency_accuracy(res.media_rc6, res.duration, "media_rc6");
> 

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-12-05 12:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-05 10:56 [PATCH igt 1/2] igt/pm_rc6_residency: Replace hard-coded sleep before rc6 with a probe Chris Wilson
2017-12-05 10:56 ` [PATCH igt 2/2] igt/perf_pmu: " Chris Wilson
2017-12-05 12:05   ` Tvrtko Ursulin
2017-12-05 12:16     ` Chris Wilson
2017-12-05 11:51 ` ✓ Fi.CI.BAT: success for series starting with [1/2] igt/pm_rc6_residency: " Patchwork
2017-12-05 12:12 ` Tvrtko Ursulin [this message]
2017-12-05 12:53 ` ✗ Fi.CI.IGT: warning " 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=a21f7875-31f2-8647-0769-d462af12f32c@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /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