From patchwork Mon May 14 08:02:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10397403 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 7D7BE600D0 for ; Mon, 14 May 2018 08:03:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6FEB31FE82 for ; Mon, 14 May 2018 08:03:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6493B28A04; Mon, 14 May 2018 08:03:18 +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=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, 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 24E8C1FE82 for ; Mon, 14 May 2018 08:03:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 46D8E89C69; Mon, 14 May 2018 08:03:17 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id AFED589C55; Mon, 14 May 2018 08:03:14 +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 11692953-1500050 for multiple; Mon, 14 May 2018 09:02:59 +0100 Received: by haswell.alporthouse.com (sSMTP sendmail emulation); Mon, 14 May 2018 09:03:00 +0100 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Mon, 14 May 2018 09:02:49 +0100 Message-Id: <20180514080251.11224-4-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180514080251.11224-1-chris@chris-wilson.co.uk> References: <20180514080251.11224-1-chris@chris-wilson.co.uk> X-Originating-IP: 78.156.65.138 X-Country: code=GB country="United Kingdom" ip=78.156.65.138 Subject: [Intel-gfx] [PATCH i-g-t 4/6] igt/gem_eio: Exercise banning X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 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 MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP If we trigger "too many" resets, the context and even the file, will be banend and subsequent execbufs should fail with -EIO. Signed-off-by: Chris Wilson Reviewed-by: Tvrtko Ursulin --- tests/gem_eio.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/tests/gem_eio.c b/tests/gem_eio.c index 6455c6acd..4720b47b5 100644 --- a/tests/gem_eio.c +++ b/tests/gem_eio.c @@ -250,6 +250,52 @@ static int __check_wait(int fd, uint32_t bo, unsigned int wait) return ret; } +static void __test_banned(int fd) +{ + struct drm_i915_gem_exec_object2 obj = { + .handle = gem_create(fd, 4096), + }; + struct drm_i915_gem_execbuffer2 execbuf = { + .buffers_ptr = to_user_pointer(&obj), + .buffer_count = 1, + }; + const uint32_t bbe = MI_BATCH_BUFFER_END; + unsigned long count = 0; + + gem_write(fd, obj.handle, 0, &bbe, sizeof(bbe)); + + gem_quiescent_gpu(fd); + igt_require(i915_reset_control(true)); + + igt_until_timeout(5) { + igt_spin_t *hang; + + if (__gem_execbuf(fd, &execbuf) == -EIO) { + igt_info("Banned after causing %lu hangs\n", count); + igt_assert(count > 1); + return; + } + + /* Trigger a reset, making sure we are detected as guilty */ + hang = spin_sync(fd, 0, 0); + trigger_reset(fd); + igt_spin_batch_free(fd, hang); + + count++; + } + + igt_assert_f(false, + "Ran for 5s, %lu hangs without being banned\n", + count); +} + +static void test_banned(int fd) +{ + fd = gem_reopen_driver(fd); + __test_banned(fd); + close(fd); +} + #define TEST_WEDGE (1) static void test_wait(int fd, unsigned int flags, unsigned int wait) @@ -693,6 +739,9 @@ igt_main igt_subtest("execbuf") test_execbuf(fd); + igt_subtest("banned") + test_banned(fd); + igt_subtest("suspend") test_suspend(fd, SUSPEND_STATE_MEM);