From patchwork Tue Sep 4 12:49: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: 10587347 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 59B745A4 for ; Tue, 4 Sep 2018 12:50:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D056294B5 for ; Tue, 4 Sep 2018 12:50:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B4D9294DE; Tue, 4 Sep 2018 12:50: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 F12DF294E9 for ; Tue, 4 Sep 2018 12:50:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2B0F66E3C3; Tue, 4 Sep 2018 12:50: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 2E0A76E35D; Tue, 4 Sep 2018 12:50:08 +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 13543765-1500050 for multiple; Tue, 04 Sep 2018 13:49:56 +0100 From: Chris Wilson To: igt-dev@lists.freedesktop.org Date: Tue, 4 Sep 2018 13:49:56 +0100 Message-Id: <20180904124956.29993-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.19.0.rc1 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t] igt/pm_rps: Clear previous high load on high->low transition 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 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Make sure we do flush out the previous spinner and delay signaling transition completion until we do. References: https://bugs.freedesktop.org/show_bug.cgi?id=102250 Signed-off-by: Chris Wilson Cc: Katarzyna Dec Reviewed-by: Katarzyna Dec --- tests/pm_rps.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/tests/pm_rps.c b/tests/pm_rps.c index 84e71fa8a..23b33f41b 100644 --- a/tests/pm_rps.c +++ b/tests/pm_rps.c @@ -218,6 +218,7 @@ static void load_helper_set_load(enum load load) static void load_helper_run(enum load load) { + bool dummy; int link[2]; /* @@ -233,13 +234,14 @@ static void load_helper_run(enum load load) lh.exit = false; lh.load = load; - lh.signal = false; + lh.signal = true; pipe(link); lh.link = link[1]; igt_fork_helper(&lh.igt_proc) { igt_spin_t *spin[2] = {}; + bool prev_load; uint32_t handle; signal(SIGUSR1, load_helper_signal_handler); @@ -247,10 +249,14 @@ static void load_helper_run(enum load load) igt_debug("Applying %s load...\n", lh.load ? "high" : "low"); + prev_load = lh.load == HIGH; spin[0] = __igt_spin_batch_new(drm_fd); - if (lh.load == HIGH) + if (prev_load) spin[1] = __igt_spin_batch_new(drm_fd); + prev_load = !prev_load; /* send the initial signal */ while (!lh.exit) { + bool high_load; + handle = spin[0]->handle; igt_spin_batch_end(spin[0]); while (gem_bo_busy(drm_fd, handle)) @@ -259,13 +265,20 @@ static void load_helper_run(enum load load) igt_spin_batch_free(drm_fd, spin[0]); usleep(100); - spin[0] = spin[1]; - spin[lh.load == HIGH] = __igt_spin_batch_new(drm_fd); + high_load = lh.load == HIGH; + if (!high_load && spin[1]) { + igt_spin_batch_free(drm_fd, spin[1]); + spin[1] = NULL; + } else { + spin[0] = spin[1]; + } + spin[high_load] = __igt_spin_batch_new(drm_fd); - if (lh.signal) { + if (lh.signal && high_load != prev_load) { write(lh.link, &lh.signal, sizeof(lh.signal)); lh.signal = false; } + prev_load = high_load; } handle = spin[0]->handle; @@ -294,6 +307,9 @@ static void load_helper_run(enum load load) close(lh.link); lh.link = link[0]; + + /* wait for our helper to complete its first round */ + igt_assert_eq(read(lh.link, &dummy, sizeof(dummy)), sizeof(dummy)); } static void load_helper_stop(void)