Message ID | 1465391238-32737-2-git-send-email-mika.kuoppala@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
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@chris-wilson.co.uk> > Signed-off-by: Mika Kuoppala <mika.kuoppala@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
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; + +static double elapsed(const struct timespec *start, const struct timespec *end) +{ + return ((end->tv_sec - start->tv_sec) + + (end->tv_nsec - start->tv_nsec)*1e-9); +} + +static double elapsed_from_hang_injection(void) +{ + struct timespec now; + + clock_gettime(CLOCK_MONOTONIC, &now); + + return elapsed(&ts_injected, &now); +} + #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); + 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); + for (i = 0; i < num_fds; i++) assert_reset_status(i, fd[i], 0, RS_NO_ERROR);
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@chris-wilson.co.uk> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com> --- tests/gem_reset_stats.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)