From patchwork Wed May 30 10:33:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10438415 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 E8049601E9 for ; Wed, 30 May 2018 10:57:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D8DFB28946 for ; Wed, 30 May 2018 10:57:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CDEF52894C; Wed, 30 May 2018 10:57:41 +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 6754128946 for ; Wed, 30 May 2018 10:57:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1F22B72C2B; Wed, 30 May 2018 10:33:34 +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 89E0C73964; Wed, 30 May 2018 10:33:30 +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 11886165-1500050 for multiple; Wed, 30 May 2018 11:33:18 +0100 Received: by haswell.alporthouse.com (sSMTP sendmail emulation); Wed, 30 May 2018 11:33:20 +0100 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Wed, 30 May 2018 11:33:14 +0100 Message-Id: <20180530103314.30565-3-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180530103314.30565-1-chris@chris-wilson.co.uk> References: <20180530103314.30565-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 3/3] lib: Double check ring measurement 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 Check twice for the signal interrupting the execbuf, because the real world is messy. References: https://bugs.freedesktop.org/show_bug.cgi?id=106695 Signed-off-by: Chris Wilson Cc: Antonio Argenziano Reviewed-by: Antonio Argenziano --- lib/i915/gem_ring.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/i915/gem_ring.c b/lib/i915/gem_ring.c index 0c061000c..0708c8a2e 100644 --- a/lib/i915/gem_ring.c +++ b/lib/i915/gem_ring.c @@ -55,7 +55,7 @@ __gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags struct drm_i915_gem_exec_object2 obj[2]; struct drm_i915_gem_execbuffer2 execbuf; const uint32_t bbe = MI_BATCH_BUFFER_END; - unsigned int count, last; + unsigned int last[2]= { -1, -1 }, count; struct itimerval itv; IGT_CORK_HANDLE(cork); @@ -85,7 +85,6 @@ __gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags itv.it_value.tv_usec = 10000; setitimer(ITIMER_REAL, &itv, NULL); - last = -1; count = 0; do { if (__execbuf(fd, &execbuf) == 0) { @@ -93,12 +92,13 @@ __gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags continue; } - if (last == count) + if (last[1] == count) break; /* sleep until the next timer interrupt (woken on signal) */ pause(); - last = count; + last[1] = last[0]; + last[0] = count; } while (1); igt_assert_eq(__execbuf(fd, &execbuf), -EINTR);