[Intel-gfx] [PATCH igt] tests/gem_spin_batch: Add multiengine test

Chris Wilson chris at chris-wilson.co.uk
Thu Apr 13 12:41:38 UTC 2017


On Thu, Apr 13, 2017 at 01:02:37PM +0300, Mika Kuoppala wrote:
> Parallel spin on all engines.
> 
> Signed-off-by: Mika Kuoppala <mika.kuoppala at intel.com>
> ---
>  tests/gem_spin_batch.c | 31 +++++++++++++++++++++++++++++--
>  1 file changed, 29 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/gem_spin_batch.c b/tests/gem_spin_batch.c
> index baf796a..a22da32 100644
> --- a/tests/gem_spin_batch.c
> +++ b/tests/gem_spin_batch.c
> @@ -32,7 +32,7 @@
>  		     "'%s' != '%s' (%lld not within %d%% tolerance of %lld)\n",\
>  		     #x, #ref, (long long)x, tolerance, (long long)ref)
>  
> -static void basic(int fd, unsigned int engine, unsigned int timeout_sec)
> +static void spin(int fd, unsigned int engine, unsigned int timeout_sec)
>  {
>  	const uint64_t timeout_100ms = 100000000LL;
>  	unsigned long loops = 0;
> @@ -63,6 +63,30 @@ static void basic(int fd, unsigned int engine, unsigned int timeout_sec)
>  	igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0);
>  }
>  
> +static void spin_exit_handler(int sig)
> +{
> +	igt_fixture {

Should not be required?

> +		igt_terminate_spin_batches();
> +	}
> +}
> +
> +static void spin_on_all_engines(int fd, unsigned int timeout_sec)
> +{
> +	unsigned engine;
> +
> +	for_each_engine(fd, engine) {
> +		if (engine == 0)
> +			continue;
> +
> +		igt_fork(child, 1) {
> +			igt_install_exit_handler(spin_exit_handler);

Ok. The existing igt_terminate_spin_batches() is tied into the exit
handler of the parent process (from quiescent_gpu_at_exit).

> +			spin(fd, engine, timeout_sec);
> +		}
> +	}
> +
> +	igt_waitchildren();
> +}
> +
>  igt_main
>  {
>  	const struct intel_execution_engine *e;
> @@ -82,9 +106,12 @@ igt_main
>  			continue;
>  
>  		igt_subtest_f("basic-%s", e->name)
> -			basic(fd, e->exec_id, 3);
> +			spin(fd, e->exec_id, 3);
>  	}
>  
> +	igt_subtest("multiengine")

I would call this spin-each, to try and differentiate this
spin on each engine independently from a second variant that shared a
single batch between all engines (spin-all).

That make take some tweaks to igt_spin_batch (hmm, actually should not be
that difficult...) and might be worth doing just in case there's a
diffference in TLB behaviour or whatnot.

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

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list