From patchwork Thu Jan 21 10:50:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 12035549 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14C0DC433E0 for ; Thu, 21 Jan 2021 10:50:16 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 70E1F23433 for ; Thu, 21 Jan 2021 10:50:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 70E1F23433 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=chris-wilson.co.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A1519891BB; Thu, 21 Jan 2021 10:50:14 +0000 (UTC) Received: from fireflyinternet.com (unknown [77.68.26.236]) by gabe.freedesktop.org (Postfix) with ESMTPS id E8338891C3; Thu, 21 Jan 2021 10:50:12 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 23658655-1500050 for multiple; Thu, 21 Jan 2021 10:50:05 +0000 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Thu, 21 Jan 2021 10:50:05 +0000 Message-Id: <20210121105005.963616-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t] i915/gem_ctx_persistence: Check for accidental banning X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: igt-dev@lists.freedesktop.org, Chris Wilson Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Check that closing many contexts does not cause a ban. Signed-off-by: Chris Wilson --- tests/i915/gem_ctx_persistence.c | 48 ++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/tests/i915/gem_ctx_persistence.c b/tests/i915/gem_ctx_persistence.c index 1b7d18525..b51a9fcc7 100644 --- a/tests/i915/gem_ctx_persistence.c +++ b/tests/i915/gem_ctx_persistence.c @@ -1065,6 +1065,51 @@ static void smoketest(int i915) gem_quiescent_gpu(i915); } +static void many_contexts(int i915) +{ + const struct intel_execution_engine2 *e; + igt_spin_t *spin; + + cleanup(i915); + + /* + * Perform many peristent kills from the same client. These should not + * cause the client to be banned, which in turn prevents us from + * creating new contexts, and submitting new execbuf. + */ + + spin = igt_spin_new(i915, .flags = IGT_SPIN_NO_PREEMPTION); + igt_spin_end(spin); + + igt_until_timeout(30) { + __for_each_physical_engine(i915, e) { + int64_t timeout = NSEC_PER_SEC; + uint32_t ctx; + + ctx = gem_context_clone_with_engines(i915, 0); + gem_context_set_persistence(i915, ctx, false); + + igt_spin_reset(spin); + spin->execbuf.rsvd1 = ctx; + spin->execbuf.flags &= ~63; + spin->execbuf.flags |= e->flags; + gem_execbuf(i915, &spin->execbuf); + gem_context_destroy(i915, ctx); + + igt_assert_eq(gem_wait(i915, spin->handle, &timeout), 0); + } + } + + /* And check we can still submit to the default context -- no bans! */ + igt_spin_reset(spin); + spin->execbuf.rsvd1 = 0; + spin->execbuf.flags &= ~63; + gem_execbuf(i915, &spin->execbuf); + + igt_spin_free(i915, spin); + gem_quiescent_gpu(i915); +} + static void replace_engines(int i915, const struct intel_execution_engine2 *e) { I915_DEFINE_CONTEXT_PARAM_ENGINES(engines, 1) = { @@ -1398,6 +1443,9 @@ igt_main } } + igt_subtest("many-contexts") + many_contexts(i915); + igt_subtest("smoketest") smoketest(i915); }