[Intel-gfx] [CI 3/3] igt/gem_eio: Install an exithandler to unwedge the device after failure

Chris Wilson chris at chris-wilson.co.uk
Mon Sep 11 11:06:29 UTC 2017


Under normal conditions, we try to repair the damage we inflict to the
GPU, but if we fail we don't. Make sure that if the test does die, we do
try to restore normal operation by using an atexit handler.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
---
 tests/gem_eio.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/tests/gem_eio.c b/tests/gem_eio.c
index 15120842..207a9ef9 100644
--- a/tests/gem_eio.c
+++ b/tests/gem_eio.c
@@ -220,14 +220,27 @@ static void test_inflight(int fd)
 	trigger_reset(fd);
 }
 
+static int fd = -1;
+
+static void
+exit_handler(int sig)
+{
+	i915_reset_control(true);
+	igt_force_gpu_reset(fd);
+}
+
 igt_main
 {
-	int fd = -1;
 
 	igt_skip_on_simulation();
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_INTEL);
+
+		igt_require(i915_reset_control(true));
+		igt_force_gpu_reset(fd);
+		igt_install_exit_handler(exit_handler);
+
 		igt_require_gem(fd);
 		igt_require_hang_ring(fd, I915_EXEC_DEFAULT);
 	}
@@ -243,7 +256,4 @@ igt_main
 
 	igt_subtest("in-flight")
 		test_inflight(fd);
-
-	igt_fixture
-		close(fd);
 }
-- 
2.14.1



More information about the Intel-gfx mailing list