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 4/5] igt/perf_pmu: Measure the reference batch for all-busy-check-all
Date: Fri, 22 Dec 2017 13:24:10 +0000	[thread overview]
Message-ID: <41efe00f-4888-e2c5-e7b0-b92b41328568@linux.intel.com> (raw)
In-Reply-To: <20171222110323.21230-4-chris@chris-wilson.co.uk>


On 22/12/2017 11:03, Chris Wilson wrote:
> Don't rely on the timer being precise when we can sleep for a known
> duration.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>   tests/perf_pmu.c | 38 ++++++++++++++++++++++++++------------
>   1 file changed, 26 insertions(+), 12 deletions(-)
> 
> diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
> index b3b289656..d88287c17 100644
> --- a/tests/perf_pmu.c
> +++ b/tests/perf_pmu.c
> @@ -288,36 +288,50 @@ all_busy_check_all(int gem_fd, const unsigned int num_engines)
>   	const struct intel_execution_engine2 *e;
>   	uint64_t val[num_engines];
>   	int fd[num_engines];
> -	igt_spin_t *spin[num_engines];
> +	unsigned long slept;
> +	igt_spin_t *spin = NULL;
>   	unsigned int i;
>   
>   	i = 0;
> -	fd[0] = -1;
>   	for_each_engine_class_instance(fd, e) {
>   		if (!gem_has_engine(gem_fd, e->class, e->instance))
>   			continue;
>   
> -		fd[i] = open_group(I915_PMU_ENGINE_BUSY(e->class, e->instance),
> -				   fd[0]);
> -
> -		spin[i] = igt_spin_batch_new(gem_fd, 0, e2ring(gem_fd, e), 0);
> -		igt_spin_batch_set_timeout(spin[i], batch_duration_ns);
> +		if (spin) {
> +			struct drm_i915_gem_exec_object2 obj = {
> +				.handle = spin->handle
> +			};
> +			struct drm_i915_gem_execbuffer2 eb = {
> +				.buffer_count = 1,
> +				.buffers_ptr = to_user_pointer(&obj),
> +				.flags = e2ring(gem_fd, e),
> +			};
> +			gem_execbuf(gem_fd, &eb);
> +		} else {
> +			spin = igt_spin_batch_new(gem_fd, 0,
> +						  e2ring(gem_fd, e), 0);
> +		}
>   
> -		i++;
> +		val[i++] = I915_PMU_ENGINE_BUSY(e->class, e->instance);
>   	}
> +	igt_assert(i == num_engines);
>   
> +	fd[0] = -1;
>   	for (i = 0; i < num_engines; i++)
> -		gem_sync(gem_fd, spin[i]->handle);
> +		fd[i] = open_group(val[i], fd[0]);
> +
> +	slept = measured_usleep(batch_duration_ns / 1000);
> +	igt_spin_batch_end(spin);
>   
>   	pmu_read_multi(fd[0], num_engines, val);
>   	log_busy(fd[0], num_engines, val);
>   
> -	for (i = 0; i < num_engines; i++)
> -		igt_spin_batch_free(gem_fd, spin[i]);
> +	igt_spin_batch_free(gem_fd, spin);
>   	close(fd[0]);
>   
>   	for (i = 0; i < num_engines; i++)
> -		assert_within_epsilon(val[i], batch_duration_ns, tolerance);
> +		assert_within_epsilon(val[i], slept, tolerance);
> +	gem_quiescent_gpu(gem_fd);
>   }
>   
>   static void
> 

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

  reply	other threads:[~2017-12-22 13:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-22 11:03 [PATCH igt 1/5] igt/perf_pmu: Tighten busy measurement Chris Wilson
2017-12-22 11:03 ` [PATCH igt 2/5] igt/perf_pmu: Tighten measurements for most-busy Chris Wilson
2017-12-22 13:21   ` Tvrtko Ursulin
2017-12-22 11:03 ` [PATCH igt 3/5] igt/perf_pmu: Measure the reference batch for busy-check-all Chris Wilson
2017-12-22 13:22   ` Tvrtko Ursulin
2017-12-22 11:03 ` [PATCH igt 4/5] igt/perf_pmu: Measure the reference batch for all-busy-check-all Chris Wilson
2017-12-22 13:24   ` Tvrtko Ursulin [this message]
2017-12-22 11:03 ` [PATCH igt 5/5] igt/perf_pmu: Speed up frequency measurement Chris Wilson
2017-12-22 13:27   ` Tvrtko Ursulin
2017-12-22 12:33 ` ✓ Fi.CI.BAT: success for series starting with [1/5] igt/perf_pmu: Tighten busy measurement Patchwork
2017-12-22 13:18 ` [PATCH igt 1/5] " Tvrtko Ursulin
2017-12-22 13:49 ` ✓ Fi.CI.IGT: success for series starting with [1/5] " 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=41efe00f-4888-e2c5-e7b0-b92b41328568@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