[Intel-gfx] [PATCH 2/2] igt/gem_reset_stats: Add time constraints on hang detection

Chris Wilson chris at chris-wilson.co.uk
Wed Jun 8 13:59:24 UTC 2016


On Wed, Jun 08, 2016 at 04:07:18PM +0300, Mika Kuoppala wrote:
> Make sure that injected hang is detected below time threshold.
> This ensures that we fail if hang was of no-progress type instead
> of a stuck engine.
> 
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> Signed-off-by: Mika Kuoppala <mika.kuoppala at intel.com>
> ---
>  tests/gem_reset_stats.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c
> index 27bc6c9cfb59..74c102d3fd7d 100644
> --- a/tests/gem_reset_stats.c
> +++ b/tests/gem_reset_stats.c
> @@ -148,6 +148,23 @@ static int gem_reset_status(int fd, int ctx_id)
>  	return RS_NO_ERROR;
>  }
>  
> +static struct timespec ts_injected;
> +
>  #define BAN HANG_ALLOW_BAN
>  #define ASYNC 2
>  static void inject_hang(int fd, uint32_t ctx,
> @@ -156,6 +173,8 @@ static void inject_hang(int fd, uint32_t ctx,
>  {
>  	igt_hang_ring_t hang;
>  
> +	clock_gettime(CLOCK_MONOTONIC, &ts_injected);
> +
>  	hang = igt_hang_ctx(fd, ctx, e->exec_id | e->flags, flags & BAN, NULL);
>  	if ((flags & ASYNC) == 0)
>  		igt_post_hang_ring(fd, hang);
> @@ -238,6 +257,8 @@ static void test_rs(const struct intel_execution_engine *e,
>  			assert_reset_status(i, fd[i], 0, RS_BATCH_PENDING);
>  	}
>  
> +	igt_assert(elapsed_from_hang_injection() < 31.0);
igt_assert(igt_seconds_elapsed(&ts_injected) <= 30);
> +
>  	for (i = 0; i < num_fds; i++)
>  		close(fd[i]);
>  }
> @@ -290,6 +311,8 @@ static void test_rs_ctx(const struct intel_execution_engine *e,
>  	}
>  	sync_gpu();
>  

> +	igt_assert(elapsed_from_hang_injection() < 31.0);
igt_assert(igt_seconds_elapsed(&ts_injected) <= 30);
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list