From patchwork Tue Apr 3 11:36:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10320977 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 7C23560390 for ; Tue, 3 Apr 2018 11:36:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 741862880D for ; Tue, 3 Apr 2018 11:36:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 687A528830; Tue, 3 Apr 2018 11:36:57 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 D707E2880D for ; Tue, 3 Apr 2018 11:36:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3F11E6E181; Tue, 3 Apr 2018 11:36:55 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7DA7B6E181 for ; Tue, 3 Apr 2018 11:36:54 +0000 (UTC) Received: by mail-wm0-x241.google.com with SMTP id r82so34830300wme.0 for ; Tue, 03 Apr 2018 04:36:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ursulin-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=y6KAu3kd89CUx4YaGCnDhYHFPNBwqIkl+t2KOq5ixt0=; b=NfpgeQF0lLAAFfTEVqhu3K/Zn4Awci5ycDVNBGfKJLP+4EX/xV6MS45D8EBdd16+Hg zQO4aZOHivhSHEvy+BXebIV25gO1U1bUNgBg7IPd0dfqvVeHI500Jf8qsEIufbSnfm+W /ElrbLrN5nWLEmNOHpqhtOuIkDqDOq6hfX/24EicW3sXVXwGaTTCWxURVO63mUcLVNxJ U/KzU8EDd2KKABhNtrlpL03XAPq/NkbQ7ZJY6WAoICquFGus5a4YsfnNQdETiBSlv+/A Y6/y0g/Vfzu3mBgXMWkVTc8CQuRzTh+8TkotiWHrbeD5V8lue57+ZkuXDPcIUwaOh64d 1pBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=y6KAu3kd89CUx4YaGCnDhYHFPNBwqIkl+t2KOq5ixt0=; b=gID1dqcD8G9AStX1F7R2TGgt0xpX+OyLvhTUakrPbH5ul7uhIAKV6wpOvaC9VKP8TQ ZdfuVgb19D7Jtlm0pS4gQbgjZqczgdKC9O/bgr9s8oHJnvC79gP4LMObFCbSvHSwlKdP T3XUtv9ujCSKlouimEPHlkv9v6gkW4DjlsGElOF+I2g6jjKC/ZytZr+hZf66t1ukgxLX 20d0lgtNcc6OELURycaeYWmH+XLrDHCOTAHRPDzgRl1NM7HWV8EzOqrSCUmlDQGMU5bK OK7OSLtjBgb3zxrmUBOrV5eqrCKa0woTbl9QftkBcWFgNjEPA76Ckyl1PvBcySgA9h6H hGOg== X-Gm-Message-State: ALQs6tDFgX4KgP/8ddjL9e+hNQnbkUW+OlikHkYwaO0rmRZcTKcv5T+B NauiqGLb0IZIkEYc9nqBk8FPIg== X-Google-Smtp-Source: AIpwx49jbXFvNwUvjQNJ3jvU7tYtq9JfRgrZaExEBxhvvi8Y136A5QJBe3H42bDb2j1anXycwHQwmw== X-Received: by 10.28.112.8 with SMTP id l8mr3713244wmc.47.1522755412978; Tue, 03 Apr 2018 04:36:52 -0700 (PDT) Received: from localhost.localdomain ([95.146.144.186]) by smtp.gmail.com with ESMTPSA id p4sm3198139wrf.27.2018.04.03.04.36.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Apr 2018 04:36:52 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Tue, 3 Apr 2018 12:36:44 +0100 Message-Id: <20180403113644.6855-1-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180329130528.8302-2-tvrtko.ursulin@linux.intel.com> References: <20180329130528.8302-2-tvrtko.ursulin@linux.intel.com> Subject: [Intel-gfx] [PATCH i-g-t v2 2/2] tests/gem_eio: Add reset and unwedge stress testing 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: Intel-gfx@lists.freedesktop.org MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Tvrtko Ursulin Reset and unwedge stress testing is supposed to trigger wedging or resets at incovenient times and then re-use the context so either the context or driver tracking might get confused and break. v2: * Renamed for more sensible naming. * Added some comments to explain what the test is doing. (Chris Wilson) Signed-off-by: Tvrtko Ursulin Reviewed-by: Chris Wilson --- tests/gem_eio.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/tests/gem_eio.c b/tests/gem_eio.c index b7c5047f0816..9599e73db736 100644 --- a/tests/gem_eio.c +++ b/tests/gem_eio.c @@ -591,6 +591,74 @@ static void test_inflight_internal(int fd, unsigned int wait) close(fd); } +/* + * Verify that we can submit and execute work after unwedging the GPU. + */ +static void test_reset_stress(int fd, unsigned int flags) +{ + uint32_t ctx0 = gem_context_create(fd); + + igt_until_timeout(5) { + struct drm_i915_gem_execbuffer2 execbuf = { }; + struct drm_i915_gem_exec_object2 obj = { }; + uint32_t bbe = MI_BATCH_BUFFER_END; + igt_spin_t *hang; + unsigned int i; + uint32_t ctx; + + gem_quiescent_gpu(fd); + + igt_require(i915_reset_control(flags & TEST_WEDGE ? + false : true)); + + ctx = context_create_safe(fd); + + /* + * Start executing a spin batch with some queued batches + * against a different context after it. + */ + hang = spin_sync(fd, ctx0, 0); + + obj.handle = gem_create(fd, 4096); + gem_write(fd, obj.handle, 0, &bbe, sizeof(bbe)); + + execbuf.buffers_ptr = to_user_pointer(&obj); + execbuf.buffer_count = 1; + execbuf.rsvd1 = ctx0; + + for (i = 0; i < 10; i++) + gem_execbuf(fd, &execbuf); + + /* Wedge after a small delay. */ + igt_assert_eq(__check_wait(fd, obj.handle, 100e3), 0); + + /* Unwedge by forcing a reset. */ + igt_assert(i915_reset_control(true)); + trigger_reset(fd); + + gem_quiescent_gpu(fd); + + /* + * Verify that we are able to submit work after unwedging from + * both contexts. + */ + execbuf.rsvd1 = ctx; + for (i = 0; i < 5; i++) + gem_execbuf(fd, &execbuf); + + execbuf.rsvd1 = ctx0; + for (i = 0; i < 5; i++) + gem_execbuf(fd, &execbuf); + + gem_sync(fd, obj.handle); + igt_spin_batch_free(fd, hang); + gem_context_destroy(fd, ctx); + gem_close(fd, obj.handle); + } + + gem_context_destroy(fd, ctx0); +} + static int fd = -1; static void @@ -635,6 +703,12 @@ igt_main igt_subtest("in-flight-suspend") test_inflight_suspend(fd); + igt_subtest("reset-stress") + test_reset_stress(fd, 0); + + igt_subtest("unwedge-stress") + test_reset_stress(fd, TEST_WEDGE); + igt_subtest_group { const struct { unsigned int wait;