[igt-dev] [PATCH i-g-t 5/9] tests/perf_pmu: Add trailing edge idle test variants

Chris Wilson chris at chris-wilson.co.uk
Fri Feb 2 20:45:23 UTC 2018


Quoting Tvrtko Ursulin (2018-02-02 18:37:50)
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> 
> Additional set of tests which stops the batch and sleeps for a bit
> before sampling the counter in order to test that the busyness stop
> being recorded correctly.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> Suggested-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
>  tests/perf_pmu.c | 81 +++++++++++++++++++++++++++++++++++++++++++++-----------
>  1 file changed, 66 insertions(+), 15 deletions(-)
> 
> diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
> index 3faa04a4f68a..27f32b8a1602 100644
> --- a/tests/perf_pmu.c
> +++ b/tests/perf_pmu.c
> @@ -131,6 +131,21 @@ static unsigned int e2ring(int gem_fd, const struct intel_execution_engine2 *e)
>  }
>  
>  #define TEST_BUSY (1)
> +#define FLAG_SYNC (2)
> +#define TEST_TRAILING_IDLE (4)
> +
> +static void end_spin(int fd, igt_spin_t *spin, unsigned int flags)
> +{
> +       if (!spin)
> +               return;
> +
> +       igt_spin_batch_end(spin);
> +
> +       if (flags & FLAG_SYNC)
> +               gem_sync(fd, spin->handle);
> +       else
> +               usleep(batch_duration_ns / 5000);

Split this to

	if (flags & FLAG_SYNC)
		gem_sync();
	
	if (flags & TEST_TRAILING_IDLE)
		usleep();

That keeps it descriptive.

> +}
>  
>  static void
>  single(int gem_fd, const struct intel_execution_engine2 *e, unsigned int flags)
> @@ -149,9 +164,11 @@ single(int gem_fd, const struct intel_execution_engine2 *e, unsigned int flags)
>  
>         val = pmu_read_single(fd);
>         slept = measured_usleep(batch_duration_ns / 1000);
> +       if (spin && (flags & TEST_TRAILING_IDLE))
> +               end_spin(gem_fd, spin, flags);

Can simplify and miss the first if (spin) here as end_spin does it for
you. And later again in no_sema()

Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris


More information about the igt-dev mailing list