From patchwork Fri Nov 7 15:20:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kuoppala X-Patchwork-Id: 5253761 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 97865C11AC for ; Fri, 7 Nov 2014 15:18:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CA4762012E for ; Fri, 7 Nov 2014 15:18:28 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 06D1C20125 for ; Fri, 7 Nov 2014 15:18:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5BF336E95E; Fri, 7 Nov 2014 07:18:27 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id AB81A6E95E for ; Fri, 7 Nov 2014 07:18:26 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 07 Nov 2014 07:18:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,333,1413270000"; d="scan'208";a="628362528" Received: from rosetta.fi.intel.com (HELO rosetta) ([10.237.72.83]) by fmsmga002.fm.intel.com with ESMTP; 07 Nov 2014 07:18:01 -0800 Received: by rosetta (Postfix, from userid 1000) id 9002B80052; Fri, 7 Nov 2014 17:20:51 +0200 (EET) From: Mika Kuoppala To: intel-gfx@lists.freedesktop.org Date: Fri, 7 Nov 2014 17:20:48 +0200 Message-Id: <1415373648-5003-1-git-send-email-mika.kuoppala@intel.com> X-Mailer: git-send-email 1.9.1 Subject: [Intel-gfx] [PATCH] tests/gem_reset_stats: add defer-hangcheck 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-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 to see if one can fool hangcheck by keeping non hanging ring busy Cc: Chris Wilson Signed-off-by: Mika Kuoppala --- tests/gem_reset_stats.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c index 3f5a01f..6473cf3 100644 --- a/tests/gem_reset_stats.c +++ b/tests/gem_reset_stats.c @@ -1019,6 +1019,45 @@ static void test_params(void) } +static void defer_hangcheck(int ring_num) +{ + int fd, count_start, count_end; + int seconds = 30; + const struct target_ring *next_ring; + fd = drm_open_any(); + igt_assert(fd >= 0); + + do { + next_ring = &rings[(++ring_num) % NUM_RINGS]; + + if (next_ring->present(fd)) + break; + + } while(next_ring != current_ring); + + igt_skip_on(next_ring == current_ring); + + count_start = get_reset_count(fd, 0); + igt_assert(count_start >= 0); + + igt_assert(inject_hang_ring(fd, 0, current_ring->exec, true)); + while (--seconds) { + igt_assert(exec_valid_ring(fd, 0, next_ring->exec)); + + count_end = get_reset_count(fd, 0); + igt_assert(count_end >= 0); + + if (count_end > count_start) + return; + + sleep(1); + } + + igt_assert(count_end > count_start); + + close(fd); +} + static bool gem_has_hw_contexts(int fd) { struct local_drm_i915_gem_context_create create; @@ -1159,5 +1198,9 @@ igt_main igt_subtest_f("close-pending-fork-reverse-%s", name) RUN_TEST(test_close_pending_fork(true)); + + igt_subtest_f("defer-hangcheck-%s", name) + RUN_TEST(defer_hangcheck(i)); + } }