Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Subject: Re: [Intel-gfx] [PATCH 2/4] drm/i915/selftests: Skip energy consumption tests if not controlling freq
Date: Mon, 20 Apr 2020 14:05:00 +0300	[thread overview]
Message-ID: <87v9lumn8j.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20200420090914.14679-2-chris@chris-wilson.co.uk>

Chris Wilson <chris@chris-wilson.co.uk> writes:

> If we can not manipulate the frequency with RPS, then comparing min/max
> power consumption is pointless / misleading. We will leave the warning
> about not being able to control the frequency selection via RPS to other
> tests so as not to confuse this more specialised check.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/gt/selftest_rps.c | 37 ++++++++++++++++----------
>  1 file changed, 23 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/selftest_rps.c b/drivers/gpu/drm/i915/gt/selftest_rps.c
> index b1a435db1edc..149a3de86cb9 100644
> --- a/drivers/gpu/drm/i915/gt/selftest_rps.c
> +++ b/drivers/gpu/drm/i915/gt/selftest_rps.c
> @@ -485,26 +485,21 @@ static u64 __measure_power(int duration_ms)
>  	return div64_u64(1000 * 1000 * dE, dt);
>  }
>  
> -static u64 measure_power_at(struct intel_rps *rps, int freq)
> +static u64 measure_power_at(struct intel_rps *rps, int *freq)
>  {
>  	u64 x[5];
>  	int i;
>  
>  	mutex_lock(&rps->lock);
>  	GEM_BUG_ON(!rps->active);
> -	intel_rps_set(rps, freq);
> +	intel_rps_set(rps, *freq);
>  	mutex_unlock(&rps->lock);
>  
>  	msleep(20); /* more than enough time to stabilise! */
>  
> -	i = read_cagf(rps);
> -	if (i != freq)
> -		pr_notice("Running at %x [%uMHz], not target %x [%uMHz]\n",
> -			  i, intel_gpu_freq(rps, i),
> -			  freq, intel_gpu_freq(rps, freq));
> -
>  	for (i = 0; i < 5; i++)
>  		x[i] = __measure_power(5);
> +	*freq = read_cagf(rps);
>  
>  	/* A simple triangle filter for better result stability */
>  	sort(x, 5, sizeof(*x), cmp_u64, NULL);
> @@ -542,7 +537,10 @@ int live_rps_power(void *arg)
>  
>  	for_each_engine(engine, gt, id) {
>  		struct i915_request *rq;
> -		u64 min, max;
> +		struct {
> +			u64 power;
> +			int freq;

Typelocking the hw reprentation might have some benefits.

Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>

> +		} min, max;
>  
>  		if (!intel_engine_can_store_dword(engine))
>  			continue;
> @@ -565,16 +563,27 @@ int live_rps_power(void *arg)
>  			break;
>  		}
>  
> -		max = measure_power_at(rps, rps->max_freq);
> -		min = measure_power_at(rps, rps->min_freq);
> +		max.freq = rps->max_freq;
> +		max.power = measure_power_at(rps, &max.freq);
> +
> +		min.freq = rps->min_freq;
> +		min.power = measure_power_at(rps, &min.freq);
>  
>  		igt_spinner_end(&spin);
>  
>  		pr_info("%s: min:%llumW @ %uMHz, max:%llumW @ %uMHz\n",
>  			engine->name,
> -			min, intel_gpu_freq(rps, rps->min_freq),
> -			max, intel_gpu_freq(rps, rps->max_freq));
> -		if (11 * min > 10 * max) {
> +			min.power, intel_gpu_freq(rps, min.freq),
> +			max.power, intel_gpu_freq(rps, max.freq));
> +
> +		if (10 * min.freq >= 9 * max.freq) {
> +			pr_notice("Could not control frequency, ran at [%d:%uMHz, %d:%uMhz]\n",
> +				  min.freq, intel_gpu_freq(rps, min.freq),
> +				  max.freq, intel_gpu_freq(rps, max.freq));
> +			continue;
> +		}
> +
> +		if (11 * min.power > 10 * max.power) {
>  			pr_err("%s: did not conserve power when setting lower frequency!\n",
>  			       engine->name);
>  			err = -EINVAL;
> -- 
> 2.20.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2020-04-20 11:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-20  9:09 [Intel-gfx] [PATCH 1/4] drm/i915/selftests: Verify frequency scaling with RPS Chris Wilson
2020-04-20  9:09 ` [Intel-gfx] [PATCH 2/4] drm/i915/selftests: Skip energy consumption tests if not controlling freq Chris Wilson
2020-04-20 11:05   ` Mika Kuoppala [this message]
2020-04-20  9:09 ` [Intel-gfx] [PATCH 3/4] drm/i915/selftests: Check RPS controls Chris Wilson
2020-04-20 16:41   ` Mika Kuoppala
2020-04-20  9:09 ` [Intel-gfx] [PATCH 4/4] drm/i915/selftests: Split RPS frequency measurement Chris Wilson
2020-04-20 16:51   ` Mika Kuoppala
2020-04-20 10:00 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [1/4] drm/i915/selftests: Verify frequency scaling with RPS Patchwork
2020-04-20 10:54 ` [Intel-gfx] [PATCH 1/4] " Mika Kuoppala
2020-04-20 11:02   ` Chris Wilson
2020-04-20 12:54     ` Mika Kuoppala
2020-04-20 13:08       ` Chris Wilson
2020-04-20 11:12 ` [Intel-gfx] ✓ Fi.CI.BAT: success for series starting with [1/4] " Patchwork
2020-04-20 15:54 ` [Intel-gfx] ✗ Fi.CI.IGT: 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=87v9lumn8j.fsf@gaia.fi.intel.com \
    --to=mika.kuoppala@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