[Intel-gfx] [PATCH i-g-t] i915/gem_eio: Reduce amount of incidental work after the delayed hang

Chris Wilson chris at chris-wilson.co.uk
Tue Oct 8 11:16:28 UTC 2019


Since we time how long it takes for the waiter to be woken upon
injecting the hang, we want to avoid as much distractions as possible
along the critical path.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/i915/gem_eio.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/tests/i915/gem_eio.c b/tests/i915/gem_eio.c
index 892f3657c..aa73b4deb 100644
--- a/tests/i915/gem_eio.c
+++ b/tests/i915/gem_eio.c
@@ -27,6 +27,7 @@
  *
  */
 
+#include <sched.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -223,16 +224,20 @@ struct hang_ctx {
 static void hang_handler(union sigval arg)
 {
 	struct hang_ctx *ctx = arg.sival_ptr;
+	struct timespec *ts = ctx->ts;
+	int dir = ctx->debugfs;
 
 	igt_debug("hang delay = %.2fus\n",
 		  igt_nsec_elapsed(&ctx->delay) / 1000.0);
-
-	igt_nsec_elapsed(ctx->ts);
-	igt_assert(igt_sysfs_set(ctx->debugfs, "i915_wedged", "-1"));
-
 	igt_assert_eq(timer_delete(ctx->timer), 0);
-	close(ctx->debugfs);
 	free(ctx);
+
+	igt_nsec_elapsed(ts);
+	igt_assert(igt_sysfs_set(dir, "i915_wedged", "-1"));
+	/* -> wake up gem_sync() in check_wait() */
+
+	sched_yield();
+	close(dir);
 }
 
 static void hang_after(int fd, unsigned int us, struct timespec *ts)
-- 
2.23.0



More information about the Intel-gfx mailing list