From patchwork Mon Jul 2 09:07:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10500747 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 DCB2F60362 for ; Mon, 2 Jul 2018 09:08:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDF542860B for ; Mon, 2 Jul 2018 09:08:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC22F284B5; Mon, 2 Jul 2018 09:08:12 +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 8267428849 for ; Mon, 2 Jul 2018 09:08:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3FC896E37A; Mon, 2 Jul 2018 09:07:59 +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 9157D6E369; Mon, 2 Jul 2018 09:07:54 +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 12222460-1500050 for multiple; Mon, 02 Jul 2018 10:07:29 +0100 From: Chris Wilson To: igt-dev@lists.freedesktop.org Date: Mon, 2 Jul 2018 10:07:18 +0100 Message-Id: <20180702090727.7721-8-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180702090727.7721-1-chris@chris-wilson.co.uk> References: <20180702090727.7721-1-chris@chris-wilson.co.uk> Subject: [Intel-gfx] [PATCH i-g-t 08/17] igt/gem_sync: Show the baseline poll latency for wakeups 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 Distinguish between the latency required to switch away from the pollable spinner into the target nops from the client wakeup of synchronisation on the last nop. Signed-off-by: Chris Wilson Reviewed-by: Joonas Lahtinen --- tests/gem_sync.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/tests/gem_sync.c b/tests/gem_sync.c index 60d61a02e..493ae61df 100644 --- a/tests/gem_sync.c +++ b/tests/gem_sync.c @@ -207,7 +207,7 @@ wakeup_ring(int fd, unsigned ring, int timeout, int wlen) const uint32_t bbe = MI_BATCH_BUFFER_END; struct drm_i915_gem_exec_object2 object; struct drm_i915_gem_execbuffer2 execbuf; - double end, this, elapsed, now; + double end, this, elapsed, now, baseline; unsigned long cycles; uint32_t cmd; igt_spin_t *spin; @@ -233,6 +233,32 @@ wakeup_ring(int fd, unsigned ring, int timeout, int wlen) igt_spin_batch_end(spin); gem_sync(fd, object.handle); + for (int warmup = 0; warmup <= 1; warmup++) { + end = gettime() + timeout/10.; + elapsed = 0; + cycles = 0; + do { + *spin->batch = cmd; + *spin->running = 0; + gem_execbuf(fd, &spin->execbuf); + while (!READ_ONCE(*spin->running)) + ; + + this = gettime(); + igt_spin_batch_end(spin); + gem_sync(fd, spin->handle); + now = gettime(); + + elapsed += now - this; + cycles++; + } while (now < end); + baseline = elapsed / cycles; + } + igt_info("%s%saseline %ld cycles: %.3f us\n", + names[child % num_engines] ?: "", + names[child % num_engines] ? " b" : "B", + cycles, elapsed*1e6/cycles); + end = gettime() + timeout; elapsed = 0; cycles = 0; @@ -254,16 +280,17 @@ wakeup_ring(int fd, unsigned ring, int timeout, int wlen) elapsed += now - this; cycles++; } while (now < end); + elapsed -= cycles * baseline; - igt_info("%s%sompleted %ld cycles: %.3f us\n", + igt_info("%s%sompleted %ld cycles: %.3f + %.3f us\n", names[child % num_engines] ?: "", names[child % num_engines] ? " c" : "C", - cycles, elapsed*1e6/cycles); + cycles, 1e6*baseline, elapsed*1e6/cycles); igt_spin_batch_free(fd, spin); gem_close(fd, object.handle); } - igt_waitchildren_timeout(timeout+10, NULL); + igt_waitchildren_timeout(2*timeout, NULL); igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0); }