From patchwork Thu Feb 23 19:44:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michel Thierry X-Patchwork-Id: 9588893 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 E480B604A2 for ; Thu, 23 Feb 2017 19:44:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1E7028773 for ; Thu, 23 Feb 2017 19:44:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C6780288A0; Thu, 23 Feb 2017 19:44:26 +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 8C8E528773 for ; Thu, 23 Feb 2017 19:44:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C075C6EB22; Thu, 23 Feb 2017 19:44:25 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id 85AD26EB20 for ; Thu, 23 Feb 2017 19:44:22 +0000 (UTC) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Feb 2017 11:44:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.35,198,1484035200"; d="scan'208"; a="1134035323" Received: from relo-linux-11.sc.intel.com ([10.3.160.214]) by fmsmga002.fm.intel.com with ESMTP; 23 Feb 2017 11:44:21 -0800 From: Michel Thierry To: intel-gfx@lists.freedesktop.org Date: Thu, 23 Feb 2017 11:44:21 -0800 Message-Id: <20170223194421.28463-5-michel.thierry@intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170223194421.28463-1-michel.thierry@intel.com> References: <20170223194421.28463-1-michel.thierry@intel.com> Subject: [Intel-gfx] [PATCH i-g-t 2/2] tests/drv_hangman: watchdog tests 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 Test watchdog triggered resets. Signed-off-by: Michel Thierry --- tests/drv_hangman.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/tests/drv_hangman.c b/tests/drv_hangman.c index 51bdbdaa..ba230f65 100644 --- a/tests/drv_hangman.c +++ b/tests/drv_hangman.c @@ -126,13 +126,21 @@ static bool uses_cmd_parser(void) static void check_error_state(const char *expected_ring_name, uint64_t expected_offset, - const uint32_t *batch) + const uint32_t *batch, + bool watchdog) { bool cmd_parser = uses_cmd_parser(); FILE *file = open_error(); char *line = NULL; + const char *watchdog_hang_reason = "reason: Watchdog timeout"; size_t line_size = 0; + if (watchdog) { + /* NOTE: expected engine name check happens later */ + if (getline(&line, &line_size, file) > 0) + igt_assert(strstr(line, watchdog_hang_reason)); + } + while (getline(&line, &line_size, file) > 0) { char *dashes; uint32_t gtt_offset_upper, gtt_offset_lower; @@ -180,21 +188,29 @@ static void check_error_state(const char *expected_ring_name, } static void test_error_state_capture(unsigned ring_id, - const char *ring_name) + const char *ring_name, + bool watchdog) { uint32_t *batch; igt_hang_t hang; uint64_t offset; + unsigned flags = HANG_ALLOW_CAPTURE; + igt_skip_on_f(watchdog && ring_id == I915_EXEC_BLT, + "no official watchdog support in BLT engine\n"); igt_require(gem_has_ring(device, ring_id)); clear_error_state(); + assert_error_state_clear(); - hang = igt_hang_ctx(device, 0, ring_id, HANG_ALLOW_CAPTURE, &offset); + if (watchdog) + flags |= HANG_USE_WATCHDOG; + + hang = igt_hang_ctx(device, 0, ring_id, flags, &offset); batch = gem_mmap__cpu(device, hang.handle, 0, 4096, PROT_READ); gem_set_domain(device, hang.handle, I915_GEM_DOMAIN_CPU, 0); igt_post_hang_ring(device, hang); - check_error_state(ring_name, offset, batch); + check_error_state(ring_name, offset, batch, watchdog); munmap(batch, 4096); } @@ -259,7 +275,11 @@ igt_main igt_subtest_f("error-state-capture-%s", e->name) test_error_state_capture(e->exec_id | e->flags, - e->full_name); + e->full_name, false); + + igt_subtest_f("watchdog-%s", e->name) + test_error_state_capture(e->exec_id | e->flags, + e->full_name, true); } igt_subtest("hangcheck-unterminated")