[PATCH igt] lib/gem: Reset the global seqno at the start of each test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When we require GEM, reset the global seqno. This gives each test a
clean slate to work with, and avoids left-over state from previous tests
impacting on the next. In particular, somes tests may be setting up long
sequence of stalling batches not expecting to hit a seqno wraparound
(leftover from, for example, gem_exec_whisper), causing long GPU hangs if
they do.

Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
---
 lib/ioctl_wrappers.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 118dcefe7..39e8469e3 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -52,6 +52,7 @@
 #include "intel_chipset.h"
 #include "intel_io.h"
 #include "igt_debugfs.h"
+#include "igt_sysfs.h"
 #include "config.h"
 
 #ifdef HAVE_VALGRIND
@@ -1411,7 +1412,8 @@ void igt_require_gem(int fd)
 
 	igt_require_intel(fd);
 
-	/* We only want to use the throttle-ioctl for its -EIO reporting
+	/*
+	 * We only want to use the throttle-ioctl for its -EIO reporting
 	 * of a wedged device, not for actually waiting on outstanding
 	 * requests! So create a new drm_file for the device that is clean.
 	 */
@@ -1419,6 +1421,18 @@ void igt_require_gem(int fd)
 	fd = open(path, O_RDWR);
 	igt_assert_lte(0, fd);
 
+	/*
+	 * Reset the global seqno at the start of each test. This ensures that
+	 * the test will not wrap unless it explicitly sets up seqno wrapping
+	 * itself, which avoids accidentally hanging when setting up long
+	 * sequences of batches.
+	 */
+	err = igt_debugfs_dir(fd);
+	if (err != -1) {
+		igt_sysfs_printf(err, "i915_next_seqno", "1");
+		close(err);
+	}
+
 	err = 0;
 	if (ioctl(fd, DRM_IOCTL_I915_GEM_THROTTLE))
 		err = -errno;
-- 
2.15.1

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




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux