All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 2/2] igt/gem_reset_stats: Add time constraints on hang detection
Date: Wed,  8 Jun 2016 16:07:18 +0300	[thread overview]
Message-ID: <1465391238-32737-2-git-send-email-mika.kuoppala@intel.com> (raw)
In-Reply-To: <1465391238-32737-1-git-send-email-mika.kuoppala@intel.com>

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;
+
+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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-06-08 13:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-08 13:07 [PATCH 1/2] lib/gt: Omit illegal instruction on hang injection with gen 8+ Mika Kuoppala
2016-06-08 13:07 ` Mika Kuoppala [this message]
2016-06-08 13:59   ` [PATCH 2/2] igt/gem_reset_stats: Add time constraints on hang detection Chris Wilson
2016-06-08 13:54 ` [PATCH 1/2] lib/gt: Omit illegal instruction on hang injection with gen 8+ Chris Wilson
2016-06-23  8:49 ` ✗ Ro.CI.BAT: failure for series starting with [1/2] " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1465391238-32737-2-git-send-email-mika.kuoppala@intel.com \
    --to=mika.kuoppala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.