summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMika Kuoppala <mika.kuoppala@intel.com>2016-06-08 15:59:04 +0300
committerMika Kuoppala <mika.kuoppala@intel.com>2016-06-09 15:14:16 +0300
commitbc570aad9b20de5f48c00a8b958b8868739f2b42 (patch)
treeb47dad7bd886488212c8f68b4a3e0e5ad94cf2b1
parentb5ef40e6e580c2f2f342f2334d694d4c84e6c9c4 (diff)
igt/gem_reset_stats: Add time constraints on hang detection
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. v2: use igt_seconds_elapsed() (Chris) Cc: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--tests/gem_reset_stats.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c
index 27bc6c9c..3b4974f9 100644
--- a/tests/gem_reset_stats.c
+++ b/tests/gem_reset_stats.c
@@ -148,6 +148,8 @@ 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 +158,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 +242,8 @@ static void test_rs(const struct intel_execution_engine *e,
assert_reset_status(i, fd[i], 0, RS_BATCH_PENDING);
}
+ igt_assert(igt_seconds_elapsed(&ts_injected) <= 30);
+
for (i = 0; i < num_fds; i++)
close(fd[i]);
}
@@ -290,6 +296,8 @@ static void test_rs_ctx(const struct intel_execution_engine *e,
}
sync_gpu();
+ igt_assert(igt_seconds_elapsed(&ts_injected) <= 30);
+
for (i = 0; i < num_fds; i++)
assert_reset_status(i, fd[i], 0, RS_NO_ERROR);