All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH igt] lib/gem: Reset the global seqno at the start of each test
Date: Sat, 23 Dec 2017 15:39:02 +0000	[thread overview]
Message-ID: <20171223153902.19709-1-chris@chris-wilson.co.uk> (raw)

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@chris-wilson.co.uk>
---
 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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

             reply	other threads:[~2017-12-23 15:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-23 15:39 Chris Wilson [this message]
2017-12-23 16:20 ` ✓ Fi.CI.BAT: success for lib/gem: Reset the global seqno at the start of each test (rev2) Patchwork
2017-12-23 17:32 ` ✗ Fi.CI.IGT: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2017-12-22 22:04 [PATCH igt] lib/gem: Reset the global seqno at the start of each test Chris Wilson
2018-02-08 14:09 ` Joonas Lahtinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171223153902.19709-1-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.