From patchwork Mon Jul 2 09:07:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10500727 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 9405B60362 for ; Mon, 2 Jul 2018 09:07:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 83035285FF for ; Mon, 2 Jul 2018 09:07:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81AE52868D; Mon, 2 Jul 2018 09:07:58 +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 2A12F28765 for ; Mon, 2 Jul 2018 09:07:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A323D6E363; Mon, 2 Jul 2018 09:07:53 +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 F26A36E358; Mon, 2 Jul 2018 09:07:51 +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 12222457-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:15 +0100 Message-Id: <20180702090727.7721-5-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 05/17] lib: Spin fast, retire early 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 When using the pollable spinner, we often want to use it as a means of ensuring the task is running on the GPU before switching to something else. In which case we don't want to add extra delay inside the spinner, but the current 1000 NOPs add on order of 5us, which is often larger than the target latency. v2: Don't change perf_pmu as that is sensitive to the extra CPU latency from a tight GPU spinner. Signed-off-by: Chris Wilson Reviewed-by: Antonio Argenziano #v1 Reviewed-by: Joonas Lahtinen #v1 Cc: Tvrtko Ursulin Reviewed-by: Tvrtko Ursulin --- lib/igt_dummyload.c | 3 ++- lib/igt_dummyload.h | 1 + tests/gem_ctx_isolation.c | 1 + tests/gem_eio.c | 1 + tests/gem_exec_latency.c | 4 ++-- 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c index 94efdf745..7beb66244 100644 --- a/lib/igt_dummyload.c +++ b/lib/igt_dummyload.c @@ -199,7 +199,8 @@ emit_recursive_batch(igt_spin_t *spin, * between function calls, that appears enough to keep SNB out of * trouble. See https://bugs.freedesktop.org/show_bug.cgi?id=102262 */ - batch += 1000; + if (!(opts->flags & IGT_SPIN_FAST)) + batch += 1000; /* recurse */ r = &relocs[obj[BATCH].relocation_count++]; diff --git a/lib/igt_dummyload.h b/lib/igt_dummyload.h index c794f2544..e80a12451 100644 --- a/lib/igt_dummyload.h +++ b/lib/igt_dummyload.h @@ -52,6 +52,7 @@ struct igt_spin_factory { #define IGT_SPIN_FENCE_OUT (1 << 0) #define IGT_SPIN_POLL_RUN (1 << 1) +#define IGT_SPIN_FAST (1 << 2) igt_spin_t * __igt_spin_batch_factory(int fd, const struct igt_spin_factory *opts); diff --git a/tests/gem_ctx_isolation.c b/tests/gem_ctx_isolation.c index 2e19e8c03..4325e1c28 100644 --- a/tests/gem_ctx_isolation.c +++ b/tests/gem_ctx_isolation.c @@ -560,6 +560,7 @@ static void inject_reset_context(int fd, unsigned int engine) struct igt_spin_factory opts = { .ctx = gem_context_create(fd), .engine = engine, + .flags = IGT_SPIN_FAST, }; igt_spin_t *spin; diff --git a/tests/gem_eio.c b/tests/gem_eio.c index 0ec1aaec9..3162a3170 100644 --- a/tests/gem_eio.c +++ b/tests/gem_eio.c @@ -160,6 +160,7 @@ static igt_spin_t * __spin_poll(int fd, uint32_t ctx, unsigned long flags) struct igt_spin_factory opts = { .ctx = ctx, .engine = flags, + .flags = IGT_SPIN_FAST, }; if (gem_can_store_dword(fd, opts.engine)) diff --git a/tests/gem_exec_latency.c b/tests/gem_exec_latency.c index 75811f325..de16322a6 100644 --- a/tests/gem_exec_latency.c +++ b/tests/gem_exec_latency.c @@ -65,7 +65,7 @@ poll_ring(int fd, unsigned ring, const char *name) { const struct igt_spin_factory opts = { .engine = ring, - .flags = IGT_SPIN_POLL_RUN, + .flags = IGT_SPIN_POLL_RUN | IGT_SPIN_FAST, }; struct timespec tv = {}; unsigned long cycles; @@ -464,7 +464,7 @@ rthog_latency_on_ring(int fd, unsigned int engine, const char *name, unsigned in #define MMAP_SZ (64 << 10) const struct igt_spin_factory opts = { .engine = engine, - .flags = IGT_SPIN_POLL_RUN, + .flags = IGT_SPIN_POLL_RUN | IGT_SPIN_FAST, }; struct rt_pkt *results; unsigned int engines[16];