summaryrefslogtreecommitdiff
path: root/lib/ioctl_wrappers.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2018-01-03 18:09:09 +0000
committerArkadiusz Hiler <arkadiusz.hiler@intel.com>2018-01-04 13:40:06 +0200
commit6db24416fdcdf5571125f9005089241cc6ba2652 (patch)
treec6e6a13e4dd1c19c0a5cb67336b1b865c363b463 /lib/ioctl_wrappers.c
parent253f8c09f9bb986938c3e7590438228996bd150b (diff)
lib/gem: Reset the global seqno at the start of each test
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 and incompletes in CI if they do. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Diffstat (limited to 'lib/ioctl_wrappers.c')
-rw-r--r--lib/ioctl_wrappers.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 118dcefe..39e8469e 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;