From patchwork Fri May 25 15:14:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10427717 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 80604602D8 for ; Fri, 25 May 2018 15:14:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7015F297B0 for ; Fri, 25 May 2018 15:14:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 62D71297BD; Fri, 25 May 2018 15:14:56 +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 8844C297B0 for ; Fri, 25 May 2018 15:14:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C403B6E232; Fri, 25 May 2018 15:14:52 +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 465B06E222; Fri, 25 May 2018 15:14:50 +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 11844315-1500050 for multiple; Fri, 25 May 2018 16:14:40 +0100 Received: by haswell.alporthouse.com (sSMTP sendmail emulation); Fri, 25 May 2018 16:14:39 +0100 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Fri, 25 May 2018 16:14:39 +0100 Message-Id: <20180525151439.12438-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.17.0 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] igt/perf_pmu: Flush to idle after hang 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 We may not idle immediately after a hang, and indeed may send a pulse down the pipeline periodically to become idle. Rather than make a flimsy assumption about how long we need to sleep before the system idles, wait for the system to declare itself idle; flushing it to idle in the process! Signed-off-by: Chris Wilson Cc: Tvrtko Ursulin Reviewed-by: Antonio Argenziano Reviewed-by: Tvrtko Ursulin --- tests/perf_pmu.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c index 590e6526b..9af192dd8 100644 --- a/tests/perf_pmu.c +++ b/tests/perf_pmu.c @@ -281,16 +281,9 @@ single(int gem_fd, const struct intel_execution_engine2 *e, unsigned int flags) /* 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. - */ + gem_quiescent_gpu(gem_fd); 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;