From patchwork Wed Nov 20 14:58:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kuoppala X-Patchwork-Id: 3213391 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 5ECFC9F26C for ; Wed, 20 Nov 2013 14:58:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 46F8A20767 for ; Wed, 20 Nov 2013 14:58:44 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 23EAD20770 for ; Wed, 20 Nov 2013 14:58:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 224FA10692F; Wed, 20 Nov 2013 06:58:41 -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 E2C4A105F41 for ; Wed, 20 Nov 2013 06:58:30 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 20 Nov 2013 06:58:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.93,535,1378882800"; d="scan'208";a="438563019" Received: from rosetta.fi.intel.com (HELO rosetta) ([10.237.72.60]) by orsmga002.jf.intel.com with ESMTP; 20 Nov 2013 06:58:29 -0800 Received: by rosetta (Postfix, from userid 1000) id 6029880070; Wed, 20 Nov 2013 16:58:33 +0200 (EET) From: Mika Kuoppala To: intel-gfx@lists.freedesktop.org Date: Wed, 20 Nov 2013 16:58:16 +0200 Message-Id: <1384959497-25533-2-git-send-email-mika.kuoppala@intel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1384959497-25533-1-git-send-email-mika.kuoppala@intel.com> References: <1384959497-25533-1-git-send-email-mika.kuoppala@intel.com> Subject: [Intel-gfx] [PATCH 2/3] tests/gem_reset_stats: stop rings after injecting 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.7 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 make driver report a simulated hang in dmesg. Suggested-by: Daniel Vetter Signed-off-by: Mika Kuoppala --- tests/gem_reset_stats.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c index a7497f3..9e52b60 100644 --- a/tests/gem_reset_stats.c +++ b/tests/gem_reset_stats.c @@ -42,6 +42,7 @@ #include "intel_batchbuffer.h" #include "intel_gpu_tools.h" #include "rendercopy.h" +#include "igt_debugfs.h" #define RS_NO_ERROR 0 #define RS_BATCH_ACTIVE (1 << 0) @@ -73,6 +74,8 @@ struct local_drm_i915_gem_context_destroy { #define CONTEXT_DESTROY_IOCTL DRM_IOWR(DRM_COMMAND_BASE + 0x2e, struct local_drm_i915_gem_context_destroy) #define GET_RESET_STATS_IOCTL DRM_IOWR(DRM_COMMAND_BASE + 0x32, struct local_drm_i915_reset_stats) +static igt_debugfs_t dfs; + static uint32_t context_create(int fd) { struct local_drm_i915_gem_context_create create; @@ -192,6 +195,17 @@ static int exec_valid(int fd, int ctx) return exec.handle; } +static void stop_rings(void) +{ + int fd; + + fd = igt_debugfs_open(&dfs, "i915_ring_stop", O_WRONLY); + igt_assert(fd >= 0); + + igt_assert(write(fd, "0xff", 4) == 4); + close(fd); +} + #define BUFSIZE (4 * 1024) #define ITEMS (BUFSIZE >> 2) @@ -284,6 +298,8 @@ static int inject_hang(int fd, int ctx) free(buf); + stop_rings(); + return exec.handle; } @@ -743,6 +759,8 @@ igt_main igt_skip("Kernel is too old, or contexts not supported: %s\n", strerror(errno)); + assert(igt_debugfs_init(&dfs) == 0); + close(fd); }