From patchwork Tue Jun 19 13:55:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10474569 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 AA8706029B for ; Tue, 19 Jun 2018 13:56:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F87728B8E for ; Tue, 19 Jun 2018 13:56:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 946D728B91; Tue, 19 Jun 2018 13:56:11 +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 4F48028BA3 for ; Tue, 19 Jun 2018 13:56:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6E0DE6E552; Tue, 19 Jun 2018 13:56:10 +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 4631E6E243; Tue, 19 Jun 2018 13:56:07 +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 12094040-1500050 for multiple; Tue, 19 Jun 2018 14:56:01 +0100 Received: by haswell.alporthouse.com (sSMTP sendmail emulation); Tue, 19 Jun 2018 14:56:00 +0100 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Tue, 19 Jun 2018 14:55:56 +0100 Message-Id: <20180619135556.17993-2-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.18.0.rc2 In-Reply-To: <20180619135556.17993-1-chris@chris-wilson.co.uk> References: <20180619135556.17993-1-chris@chris-wilson.co.uk> 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 2/2] 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: 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 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 --- tests/gem_sync.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/tests/gem_sync.c b/tests/gem_sync.c index 5901e1476..a3e3d7ee8 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; @@ -230,6 +230,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%sasline %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; @@ -251,11 +277,12 @@ 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);