[Intel-gfx] [PATCH 2/2] igt/gem_reset_stats: Add time constraints on hang detection
Mika Kuoppala
mika.kuoppala at linux.intel.com
Wed Jun 8 13:07:18 UTC 2016
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;
+
+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);
--
2.7.4
More information about the Intel-gfx
mailing list