Try to reset the GPU from within igt_require_gem() if we notice we are
starting with a wedged device. If it remains wedged, the test definitely
cannot run. We leave a warning in place to highlight the potentially
suspect result, which will keep the flip-flops alive in CI!

Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
---
 lib/ioctl_wrappers.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 10d958726..5d2c82099 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -1428,14 +1428,20 @@ void igt_require_gem(int fd)
         * sequences of batches.
         */
        err = igt_debugfs_dir(fd);
-       if (err != -1) {
-               igt_sysfs_printf(err, "i915_next_seqno", "1");
-               close(err);
+       igt_require(err >= 0);
+
+       if (ioctl(fd, DRM_IOCTL_I915_GEM_THROTTLE)) {
+               igt_warn("Found wedged device, trying to reset and continue\n");
+               igt_sysfs_set(err, "i915_wedged", "-1");
        }
+       igt_sysfs_set(err, "i915_next_seqno", "1");
+
+       close(err);
 
        err = 0;
        if (ioctl(fd, DRM_IOCTL_I915_GEM_THROTTLE))
                err = -errno;
+
        close(fd);
 
        igt_require_f(err == 0, "Unresponsive i915/GEM device\n");
-- 
2.16.1

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

Reply via email to