From patchwork Sat Dec 23 15:39:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10131621 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B40FF60318 for ; Sat, 23 Dec 2017 15:39:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E961728F68 for ; Sat, 23 Dec 2017 15:39:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD4582972D; Sat, 23 Dec 2017 15:39:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CEA7528F68 for ; Sat, 23 Dec 2017 15:39:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5098C6E195; Sat, 23 Dec 2017 15:39:13 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id 114926E195 for ; Sat, 23 Dec 2017 15:39:11 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 10107291-1500050 for multiple; Sat, 23 Dec 2017 15:39:03 +0000 Received: by haswell.alporthouse.com (sSMTP sendmail emulation); Sat, 23 Dec 2017 15:39:02 +0000 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Sat, 23 Dec 2017 15:39:02 +0000 Message-Id: <20171223153902.19709-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.15.1 X-Originating-IP: 78.156.65.138 X-Country: code=GB country="United Kingdom" ip=78.156.65.138 Subject: [Intel-gfx] [PATCH igt] lib/gem: Reset the global seqno at the start of each test X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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;