From patchwork Tue Jan 7 09:46:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kuoppala X-Patchwork-Id: 3446911 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 12E069F374 for ; Tue, 7 Jan 2014 09:46:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2909B20115 for ; Tue, 7 Jan 2014 09:46:46 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id D6E232010B for ; Tue, 7 Jan 2014 09:46:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B95CCFA6A9; Tue, 7 Jan 2014 01:46:43 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id F3F9CFA6A9 for ; Tue, 7 Jan 2014 01:46:41 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 07 Jan 2014 01:46:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.95,618,1384329600"; d="scan'208";a="435016867" Received: from rosetta.fi.intel.com (HELO rosetta) ([10.237.72.60]) by orsmga001.jf.intel.com with ESMTP; 07 Jan 2014 01:46:39 -0800 Received: by rosetta (Postfix, from userid 1000) id 2630A81E14; Tue, 7 Jan 2014 11:46:51 +0200 (EET) From: Mika Kuoppala To: intel-gfx@lists.freedesktop.org Date: Tue, 7 Jan 2014 11:46:37 +0200 Message-Id: <1389087997-2099-1-git-send-email-mika.kuoppala@intel.com> X-Mailer: git-send-email 1.7.9.5 Subject: [Intel-gfx] [PATCH] tests/gem_reset_stats: add subtest hang_all_rings X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Check that we can hang each individual engine Signed-off-by: Mika Kuoppala --- tests/gem_reset_stats.c | 54 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 49 insertions(+), 5 deletions(-) diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c index 0515605..a85f486 100644 --- a/tests/gem_reset_stats.c +++ b/tests/gem_reset_stats.c @@ -160,7 +160,7 @@ static int gem_exec(int fd, struct drm_i915_gem_execbuffer2 *execbuf) return 0; } -static int exec_valid(int fd, int ctx) +static int exec_valid_ring(int fd, int ctx, int ring) { struct drm_i915_gem_execbuffer2 execbuf; struct drm_i915_gem_exec_object2 exec; @@ -186,7 +186,7 @@ static int exec_valid(int fd, int ctx) execbuf.num_cliprects = 0; execbuf.DR1 = 0; execbuf.DR4 = 0; - execbuf.flags = 0; + execbuf.flags = ring; i915_execbuffer2_set_context_id(execbuf, ctx); execbuf.rsvd2 = 0; @@ -197,6 +197,11 @@ static int exec_valid(int fd, int ctx) return exec.handle; } +static int exec_valid(int fd, int ctx) +{ + return exec_valid_ring(fd, ctx, 0); +} + static void stop_rings(void) { int fd; @@ -211,7 +216,7 @@ static void stop_rings(void) #define BUFSIZE (4 * 1024) #define ITEMS (BUFSIZE >> 2) -static int inject_hang(int fd, int ctx) +static int inject_hang_ring(int fd, int ctx, int ring) { struct drm_i915_gem_execbuffer2 execbuf; struct drm_i915_gem_exec_object2 exec; @@ -249,7 +254,7 @@ static int inject_hang(int fd, int ctx) execbuf.num_cliprects = 0; execbuf.DR1 = 0; execbuf.DR4 = 0; - execbuf.flags = 0; + execbuf.flags = ring; i915_execbuffer2_set_context_id(execbuf, ctx); execbuf.rsvd2 = 0; @@ -290,7 +295,7 @@ static int inject_hang(int fd, int ctx) execbuf.num_cliprects = 0; execbuf.DR1 = 0; execbuf.DR4 = 0; - execbuf.flags = 0; + execbuf.flags = ring; i915_execbuffer2_set_context_id(execbuf, ctx); execbuf.rsvd2 = 0; @@ -305,6 +310,11 @@ static int inject_hang(int fd, int ctx) return exec.handle; } +static int inject_hang(int fd, int ctx) +{ + return inject_hang_ring(fd, ctx, 0); +} + static int _assert_reset_status(int fd, int ctx, int status) { int rs; @@ -908,6 +918,37 @@ static void test_params(void) close(fd); } +static void test_hang_all_rings(void) +{ + for (unsigned i = 0; i < NUM_RINGS; i++) { + int fd, count, h1, h2; + const struct target_ring *ring = &rings[i]; + + fd = drm_open_any(); + igt_assert(fd >= 0); + + assert_reset_status(fd, 0, RS_NO_ERROR); + count = get_reset_count(fd, 0); + + if (!ring->avail || (ring->avail && ring->avail(fd))) { + h1 = exec_valid_ring(fd, 0, ring->exec); + assert(h1 >= 0); + + h2 = inject_hang_ring(fd, 0, ring->exec); + assert(h2 >= 0); + + gem_sync(fd, h2); + + igt_assert(get_reset_count(fd, 0) == count + 1); + + gem_close(fd, h1); + gem_close(fd, h2); + + close(fd); + + } + } +} igt_main { @@ -960,6 +1001,9 @@ igt_main test_close_pending_fork(false); } + igt_subtest("hang-all-rings") + test_hang_all_rings(); + igt_subtest("params") test_params(); }