From patchwork Fri Oct 13 20:49:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Argenziano X-Patchwork-Id: 10005897 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 6151760325 for ; Fri, 13 Oct 2017 20:50:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5222F2912F for ; Fri, 13 Oct 2017 20:50:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 50C9A2918D; Fri, 13 Oct 2017 20:50:19 +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 4C87B2917A for ; Fri, 13 Oct 2017 20:50:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C8E5B6EBF0; Fri, 13 Oct 2017 20:50:17 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8D25F6EBF0 for ; Fri, 13 Oct 2017 20:50:16 +0000 (UTC) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP; 13 Oct 2017 13:50:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,372,1503385200"; d="scan'208";a="162935292" Received: from relo-linux-2.fm.intel.com ([10.1.27.122]) by fmsmga006.fm.intel.com with ESMTP; 13 Oct 2017 13:50:15 -0700 From: Antonio Argenziano To: intel-gfx@lists.freedesktop.org Date: Fri, 13 Oct 2017 13:49:29 -0700 Message-Id: <20171013204929.1748-2-antonio.argenziano@intel.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171013204929.1748-1-antonio.argenziano@intel.com> References: <20171013204929.1748-1-antonio.argenziano@intel.com> Subject: [Intel-gfx] [PATCH i-g-t v2 2/2] tests/gem_reset_stats: Add client ban 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-Virus-Scanned: ClamAV using ClamSMTP A client that submits 'bad' contexts will be banned eventually while other clients are not affected. Add a test for this. v2 - Do not use a fixed number of contexts to ban client (Chris) Signed-off-by: Antonio Argenziano Cc: Michel Thierry Cc: Chris Wilson --- tests/gem_reset_stats.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c index edc40767..da309237 100644 --- a/tests/gem_reset_stats.c +++ b/tests/gem_reset_stats.c @@ -438,6 +438,61 @@ static void test_ban_ctx(const struct intel_execution_engine *e) close(fd); } +static void test_client_ban(const struct intel_execution_engine *e) +{ + int fd_bad,fd_good; + struct local_drm_i915_reset_stats rs_bad, rs_good; + int ban, ctx_bans_retry = 10; + int client_ban, client_bans_retry = 10; + uint32_t ctx_bad; + uint32_t test_ctx; + int active_count = 0; + + fd_bad = drm_open_driver(DRIVER_INTEL); + fd_good = drm_open_driver(DRIVER_INTEL); + + assert_reset_status(fd_bad, fd_bad, 0, RS_NO_ERROR); + assert_reset_status(fd_good, fd_good, 0, RS_NO_ERROR); + + while (client_bans_retry--) { + client_ban = __gem_context_create(fd_bad, &ctx_bad); + if (client_ban == -EIO) + break; + + noop(fd_bad, ctx_bad, e); + assert_reset_status(fd_bad, fd_bad, ctx_bad, RS_NO_ERROR); + + ctx_bans_retry = 10; + active_count = 0; + while (ctx_bans_retry--) { + inject_hang(fd_bad, ctx_bad, e, BAN); + active_count++; + + ban = noop(fd_bad, ctx_bad, e); + if (ban == -EIO) + break; + } + + igt_assert_eq(ban, -EIO); + + assert_reset_status(fd_bad, fd_bad, ctx_bad, RS_BATCH_ACTIVE); + igt_assert_eq(gem_reset_stats(fd_bad, ctx_bad, &rs_bad), 0); + igt_assert_eq(rs_bad.batch_active, active_count); + + igt_debug("retrying for client ban (%d)\n", client_bans_retry); + } + + igt_assert_eq(__gem_context_create(fd_bad, &test_ctx), -EIO); + + igt_assert_lt(0, noop(fd_good, 0, e)); + assert_reset_status(fd_good, fd_good, 0, RS_NO_ERROR); + igt_assert_eq(gem_reset_stats(fd_good, 0, &rs_good), 0); + igt_assert_eq(rs_good.batch_active, 0); + + close(fd_bad); + close(fd_good); +} + static void test_unrelated_ctx(const struct intel_execution_engine *e) { int fd1,fd2; @@ -817,6 +872,9 @@ igt_main igt_subtest_f("ban-ctx-%s", e->name) RUN_CTX_TEST(test_ban_ctx(e)); + igt_subtest_f("ban-client-%s", e->name) + RUN_CTX_TEST(test_client_ban(e)); + igt_subtest_f("reset-count-%s", e->name) RUN_TEST(test_reset_count(e, false));