From patchwork Tue Jan 21 15:40:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kuoppala X-Patchwork-Id: 3518761 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1421DC02DC for ; Tue, 21 Jan 2014 15:40:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EF8002013D for ; Tue, 21 Jan 2014 15:40:18 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E3C1D200E5 for ; Tue, 21 Jan 2014 15:40:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B06B6F9CFD; Tue, 21 Jan 2014 07:40:16 -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 84C11F9CFD for ; Tue, 21 Jan 2014 07:40:15 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 21 Jan 2014 07:40:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.95,696,1384329600"; d="scan'208";a="470162349" Received: from rosetta.fi.intel.com (HELO rosetta) ([10.237.72.60]) by orsmga002.jf.intel.com with ESMTP; 21 Jan 2014 07:40:14 -0800 Received: by rosetta (Postfix, from userid 1000) id D72748009C; Tue, 21 Jan 2014 17:40:13 +0200 (EET) From: Mika Kuoppala To: intel-gfx@lists.freedesktop.org Date: Tue, 21 Jan 2014 17:40:08 +0200 Message-Id: <1390318808-20748-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: stop only one ring when submitting hang 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.8 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 If we stop all the rings, we can end up blaming the innocent rings on hangcheck. Reference: https://bugs.freedesktop.org/show_bug.cgi?id=73652 Signed-off-by: Mika Kuoppala --- tests/gem_reset_stats.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c index 034a298..331d954 100644 --- a/tests/gem_reset_stats.c +++ b/tests/gem_reset_stats.c @@ -237,20 +237,37 @@ static int exec_valid(int fd, int ctx) return exec_valid_ring(fd, ctx, current_ring->exec); } -static void stop_rings(void) +static void stop_rings(const int mask) { int fd; + char buf[80]; + igt_assert((mask & ~((1 << NUM_RINGS) - 1)) == 0); + igt_assert(snprintf(buf, sizeof(buf), "0x%02x", mask) == 4); fd = igt_debugfs_open(&dfs, "i915_ring_stop", O_WRONLY); igt_assert(fd >= 0); - igt_assert(write(fd, "0xff", 4) == 4); + igt_assert(write(fd, buf, 4) == 4); close(fd); } #define BUFSIZE (4 * 1024) #define ITEMS (BUFSIZE >> 2) +static int ring_to_mask(int ring) +{ + for (unsigned i = 0; i < NUM_RINGS; i++) { + const struct target_ring *r = &rings[i]; + + if (r->exec == ring) + return (1 << i); + } + + igt_assert(0); + + return -1; +} + static int inject_hang_ring(int fd, int ctx, int ring) { struct drm_i915_gem_execbuffer2 execbuf; @@ -340,7 +357,7 @@ static int inject_hang_ring(int fd, int ctx, int ring) free(buf); - stop_rings(); + stop_rings(ring_to_mask(ring)); return exec.handle; }