From patchwork Wed Feb 28 17:15:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10248853 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 8A1EE60365 for ; Wed, 28 Feb 2018 17:15:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77B3228DFC for ; Wed, 28 Feb 2018 17:15:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A80F28E00; Wed, 28 Feb 2018 17:15:32 +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 D97BC28DFD for ; Wed, 28 Feb 2018 17:15:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D1AE56EAF1; Wed, 28 Feb 2018 17:15:30 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 054F46EAF1 for ; Wed, 28 Feb 2018 17:15:30 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id z9so6452435wmb.3 for ; Wed, 28 Feb 2018 09:15:29 -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=r+FkpfJRO1eCgmRonhhcRKoXm/qPDGaSgdk/9THgTzc=; b=uDRP8uo8TzdlpGfFPfv5TZxLsy+bAeu+ifTx9k40hVkwHf7y/xXwu3K1t6a8a1zxgS Vb5PI7iyh5d6kcmbxLS3bjc5cFBcdhgSG5+21amnUwBKa5Qp2Y1RmJ+t9bEQjYMgdXI5 1AvDoaEUSvYi7zXMmMX/bR1SMiG7soDMEGqLYCBaLsv4x8LJdpinPA7sxLXJ8ei+XTsS 1j9KZc/bsXa5/zIdN/wfVu8IoFn3k2mD+j7LCOPMbGOO3oKwL7kb6g5F9BY8znDsRR1x QWlD+qwOLQ0CclrVK9Hq/J6A1tilXeELq+LSGpDa/pzOCixwHyupmaQ6TRFaFLdnqr3q M3Aw== 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=r+FkpfJRO1eCgmRonhhcRKoXm/qPDGaSgdk/9THgTzc=; b=VMLlgazAHBTYyaYvfVol0zYM5TQhx/A/Z+hlljvlxqbrsQcpf3UJcnF0ZnFT5ZrCqy 5BZgRxOlpcfTzAGmZYhEvVNn0sPIIxU2VyKSWTatd6gNN7c13uujfiEszIiWnpdVr3MJ 7WCu24808t8PHH9okmohX3qoYW7T/NP4qzZySx4zFwJhw/4rhR05If8/EMrjIvw5ELsi v108BJwczHSYv2L2/8kaei6VwpUPeYnRn2Yo7hfje8SZQEoLKdo3dmyZcdjugOg62nUC wYbBlZiE90lPno2QtG7tzI6aOBhr1EpSsp1EK1v0uToEdl5VtB9YUtmH8Vv9fViAJFKL KnBQ== X-Gm-Message-State: APf1xPDhNXPRo2zdWTdSDqrrMjNaTrEdvFS8gXCUL2NhG8AMOsFIiTze o1ITiIPiNniMna4zu5Xpu7heeD8Y X-Google-Smtp-Source: AG47ELtdq49kDncE0+MJKA8jWGRGkgizDRTU9VspKSZiLXCU9wpWpEo+18WDg4Dmh8Nb+80bn9Rcsw== X-Received: by 10.28.191.148 with SMTP id o20mr14668074wmi.63.1519838128668; Wed, 28 Feb 2018 09:15:28 -0800 (PST) Received: from localhost.localdomain ([95.146.144.186]) by smtp.gmail.com with ESMTPSA id 35sm2030426wra.4.2018.02.28.09.15.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Feb 2018 09:15:28 -0800 (PST) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Wed, 28 Feb 2018 17:15:19 +0000 Message-Id: <20180228171519.19657-1-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <151906806441.26771.7589788592510600443@mail.alporthouse.com> References: <151906806441.26771.7589788592510600443@mail.alporthouse.com> Subject: [Intel-gfx] [PATCH i-g-t v2] 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) Signed-off-by: Tvrtko Ursulin Reviewed-by: Chris Wilson --- tests/perf_pmu.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c index 3bbb18d2f216..f5c70776e2cf 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,27 @@ 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. */ + sleep(1); + 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 +1707,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); } /**