From patchwork Fri Oct 11 08:06:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 11184959 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 44F131709 for ; Fri, 11 Oct 2019 08:06:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D1A4F2190F for ; Fri, 11 Oct 2019 08:06:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D1A4F2190F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=chris-wilson.co.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 57A226EBC6; Fri, 11 Oct 2019 08:06:51 +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 962456EBC6; Fri, 11 Oct 2019 08:06:49 +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 18799738-1500050 for multiple; Fri, 11 Oct 2019 09:06:44 +0100 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Fri, 11 Oct 2019 09:06:42 +0100 Message-Id: <20191011080642.23061-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t] i915: Use O_NONBLOCK for faster ringsize probing 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 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" When the kernel supports O_NONBLOCK reporting of a full execbuf queue, take advantage of that to immediately report when the output would block due to the ring being full. Signed-off-by: Chris Wilson Reviewed-by: Tvrtko Ursulin --- lib/i915/gem_ring.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/i915/gem_ring.c b/lib/i915/gem_ring.c index 9f099edff..5ca2a728b 100644 --- a/lib/i915/gem_ring.c +++ b/lib/i915/gem_ring.c @@ -21,6 +21,7 @@ * IN THE SOFTWARE. */ +#include #include #include #include @@ -89,11 +90,16 @@ __gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags count = 0; do { - if (__execbuf(fd, &execbuf) == 0) { + int err = __execbuf(fd, &execbuf); + + if (err == 0) { count++; continue; } + if (err == -EWOULDBLOCK) + break; + if (last[1] == count) break; @@ -102,8 +108,6 @@ __gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags last[1] = last[0]; last[0] = count; } while (1); - - igt_assert_eq(__execbuf(fd, &execbuf), -EINTR); igt_assert(count > 2); memset(&itv, 0, sizeof(itv)); @@ -145,6 +149,9 @@ gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags f fd = gem_reopen_driver(fd); + /* When available, disable execbuf throttling */ + fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | O_NONBLOCK); + if (engine == ALL_ENGINES) { for_each_physical_engine(fd, engine) { unsigned int count =