Commit 4f082c35 authored by Chris Wilson's avatar Chris Wilson 😣

igt/gem_eio: Install an exithandler to unwedge the device after failure

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.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102616Signed-off-by: Chris Wilson's avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Arkadiusz Hiler's avatarArkadiusz Hiler <arkadiusz.hiler@intel.com>
parent 20631542
......@@ -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);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment