From patchwork Thu Mar 1 09:38:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10250633 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 B7026602B5 for ; Thu, 1 Mar 2018 09:38:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A56F328FDF for ; Thu, 1 Mar 2018 09:38:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9708128FF6; Thu, 1 Mar 2018 09:38:59 +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 1915F28FDF for ; Thu, 1 Mar 2018 09:38:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E848B6E466; Thu, 1 Mar 2018 09:38:57 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wr0-x244.google.com (mail-wr0-x244.google.com [IPv6:2a00:1450:400c:c0c::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id AC06F6E466 for ; Thu, 1 Mar 2018 09:38:56 +0000 (UTC) Received: by mail-wr0-x244.google.com with SMTP id w77so5352705wrc.6 for ; Thu, 01 Mar 2018 01:38:56 -0800 (PST) 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=MEL+R7R/hjlKP+lpxve2m6kAjGvAc3URWmPjRDQFm7s=; b=eAwsjYtC+MAdWw449lOE2T6UvqXSrc5wSMnZxbHtVzHmeW1M1qYe/O+XnXMY22jeKm qDNnuHPACC3jdwOUS0KHvg+3hm445PHCCyobntKakkNrPvZ0XJbdRyqHMggP2jcWgPUB jeC47MDA4+xPW3K3Q6sp358TIVD1FxZ6gvheOrDcjqU3wf93TTqaQnYu1nCaBNM7RtcW iDIJpVb0IGXd3mdYts0pOGovx04DInPIALZ8o3R7VtGnSf5Tl1f39I3x7uiArgtGcCE4 /xFx4iuWRo64tj7j57b4ghjqe7NFKCv0z/mna33SFlv4eSwlnSTXcmY4K14TlU32cUrp 2IGA== 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=MEL+R7R/hjlKP+lpxve2m6kAjGvAc3URWmPjRDQFm7s=; b=HgdxwxXC78e12niX42p2jhM3OcN/8hUNhuy1tUB04icVBRk+Eer4FkQ9bk3rIF2YqO flcIZ435WTMfK0MPAN8WeGBZroYsDC/MR6U2V3uYI+Me3DIKGcoOwVOhwQImwU1QT2HS 0M696ejJU4BLCnIO8OD1iyZduwD3TsnepwgOdjwBjvQvTrBSp2lV+Blo9Du9hsUYuQXq Ba/pfPLFeRbuV9SB8PAotSUFe4YP3brIn5FZbMC0kEkk6bvZR+mDk0q4MNpM/2it44xg IZtQPKZU3ag3rOxLHEOQJGaKrhLKaGCYRBx46lbxZl9yhvZoAzcE59f9GXTuiLNOJdnp ivwQ== X-Gm-Message-State: APf1xPBMi0uU/Vq8vvAJGdtlPV3KJh56v+L5sT3TgYJmwsLSnGYfkTXO TD4KnkMUn4CyTJhyG8Vf+mMD3D6g X-Google-Smtp-Source: AG47ELuGkSlqw0sIW3B8gm1hZacmdxNbejPkvLQnzZVCAj9w1/mfvcUy7eiVRujPRTW30X9GkA5Vwg== X-Received: by 10.223.164.215 with SMTP id h23mr1091667wrb.38.1519897135220; Thu, 01 Mar 2018 01:38:55 -0800 (PST) Received: from localhost.localdomain ([95.146.144.186]) by smtp.gmail.com with ESMTPSA id a67sm8063447wrc.13.2018.03.01.01.38.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Mar 2018 01:38:54 -0800 (PST) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Thu, 1 Mar 2018 09:38:46 +0000 Message-Id: <20180301093846.23154-1-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <151989642449.32001.12793046046680965046@mail.alporthouse.com> References: <151989642449.32001.12793046046680965046@mail.alporthouse.com> Subject: [Intel-gfx] [PATCH i-g-t v3] tests/perf_pmu: Test busyness reporting in face of GPU hangs 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 Verify that the reported busyness is in line with what would we expect from a batch which causes a hang and gets kicked out from the engine. v2: Change to explicit igt_force_gpu_reset instead of guessing when a spin batch will hang. (Chris Wilson) v3: Assert and comment test expectations. (Chris Wilson) Signed-off-by: Tvrtko Ursulin Reviewed-by: Chris Wilson --- tests/perf_pmu.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c index 3bbb18d2f216..4713c98c5d22 100644 --- a/tests/perf_pmu.c +++ b/tests/perf_pmu.c @@ -168,6 +168,7 @@ static unsigned int e2ring(int gem_fd, const struct intel_execution_engine2 *e) #define TEST_TRAILING_IDLE (4) #define TEST_RUNTIME_PM (8) #define FLAG_LONG (16) +#define FLAG_HANG (32) static void end_spin(int fd, igt_spin_t *spin, unsigned int flags) { @@ -204,11 +205,35 @@ single(int gem_fd, const struct intel_execution_engine2 *e, unsigned int flags) end_spin(gem_fd, spin, flags); val = pmu_read_single(fd) - val; - end_spin(gem_fd, spin, FLAG_SYNC); + if (flags & FLAG_HANG) + igt_force_gpu_reset(gem_fd); + else + end_spin(gem_fd, spin, FLAG_SYNC); + + assert_within_epsilon(val, flags & TEST_BUSY ? slept : 0.f, tolerance); + + /* Check for idle after hang. */ + if (flags & FLAG_HANG) { + /* Sleep for a bit for reset unwind to settle. */ + usleep(500e3); + /* + * Ensure batch was executing before reset, meaning it must be + * idle by now. Unless it did not even manage to start before we + * triggered the reset, in which case the idleness check below + * might fail. The latter is very unlikely since there are two + * sleeps during which it had an opportunity to start. + */ + igt_assert(!gem_bo_busy(gem_fd, spin->handle)); + val = pmu_read_single(fd); + slept = measured_usleep(batch_duration_ns / 1000); + val = pmu_read_single(fd) - val; + + assert_within_epsilon(val, 0, tolerance); + } + igt_spin_batch_free(gem_fd, spin); close(fd); - assert_within_epsilon(val, flags & TEST_BUSY ? slept : 0.f, tolerance); gem_quiescent_gpu(gem_fd); } @@ -1690,6 +1715,9 @@ igt_main pct[i], e->name) accuracy(fd, e, pct[i]); } + + igt_subtest_f("busy-hang-%s", e->name) + single(fd, e, TEST_BUSY | FLAG_HANG); } /**