From patchwork Fri Aug 18 11:08:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Katarzyna Dec X-Patchwork-Id: 9908335 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 B8D60600CC for ; Fri, 18 Aug 2017 11:09:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC07528426 for ; Fri, 18 Aug 2017 11:09:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A02B328477; Fri, 18 Aug 2017 11:09:10 +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=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM 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 4C11728C4C for ; Fri, 18 Aug 2017 11:09:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6E3806E70B; Fri, 18 Aug 2017 11:08:59 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id D43136E70B for ; Fri, 18 Aug 2017 11:08:57 +0000 (UTC) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Aug 2017 04:08:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,392,1498546800"; d="scan'208";a="141832574" Received: from kdec5-desk.igk.intel.com ([172.28.171.39]) by fmsmga006.fm.intel.com with ESMTP; 18 Aug 2017 04:08:54 -0700 From: Katarzyna Dec To: intel-gfx@lists.freedesktop.org Date: Fri, 18 Aug 2017 13:08:44 +0200 Message-Id: <20170818110844.15792-1-katarzyna.dec@intel.com> X-Mailer: git-send-email 2.13.4 In-Reply-To: <20170818073311.8924-1-katarzyna.dec@intel.com> References: <20170818073311.8924-1-katarzyna.dec@intel.com> Subject: [Intel-gfx] [PATCH i-g-t v2] pm_rps: Changes in waitboost scenario X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP CI is observing sporadical failures in pm_rps subtests. There are a couple of reasons. One of them is the fact that on gen6, gen7 and gen7.5, max frequency (as in the HW limit) is not set to RP0, but the value obtaind from PCODE (which may be different from RP0). Thus the test is operating under wrong assumptions (SOFTMAX == RP0 == BOOST which is simply not the case). Let's compare current frequency with BOOST frequency rather than SOFTMAX to get the test behaviour under control. We're also seeing failures with boost frequency failing to drop down before we start measuring on low. While I'm here let's also make sure that we're running as DRM master to catch the common case, where the test is being ran along with Xorg. Cc: Chris Wilson Cc: Jeff Mcgee Cc: Radoslaw Szwichtenberg Signed-off-by: Katarzyna Dec --- tests/pm_rps.c | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/tests/pm_rps.c b/tests/pm_rps.c index f0455e78..efe938e0 100644 --- a/tests/pm_rps.c +++ b/tests/pm_rps.c @@ -50,6 +50,7 @@ enum { RP0, RP1, RPn, + BOOST, NUMFREQ }; @@ -60,7 +61,7 @@ struct junk { const char *mode; FILE *filp; } stuff[] = { - { "cur", "r", NULL }, { "min", "rb+", NULL }, { "max", "rb+", NULL }, { "RP0", "r", NULL }, { "RP1", "r", NULL }, { "RPn", "r", NULL }, { NULL, NULL, NULL } + { "cur", "r", NULL }, { "min", "rb+", NULL }, { "max", "rb+", NULL }, { "RP0", "r", NULL }, { "RP1", "r", NULL }, { "RPn", "r", NULL }, { "boost", "rb+", NULL }, { NULL, NULL, NULL } }; static int readval(FILE *filp) @@ -560,29 +561,46 @@ static void reset_gpu(void) close(fd); } +static bool boost_finished(void) +{ + char buf[1024]; + + igt_debugfs_read(drm_fd, "i915_rps_boost_info", buf); + return strstr(buf, "Boosts outstanding? 0"); +} + static void boost_freq(int fd, int *boost_freqs) { int64_t timeout = 1; - int ring = -1; igt_spin_t *load; + unsigned int engine; - load = igt_spin_batch_new(fd, ring, 0); - + /* put boost on the same engine as low load */ + engine = I915_EXEC_RENDER; + if (intel_gen(lh.devid) >= 6) + engine = I915_EXEC_BLT; + load = igt_spin_batch_new(fd, engine, 0); /* Waiting will grant us a boost to maximum */ gem_wait(fd, load->handle, &timeout); read_freqs(boost_freqs); dump(boost_freqs); + igt_assert(!boost_finished()); + /* Avoid downlocking till boost request is pending */ + igt_spin_batch_end(load); + gem_sync(fd, load->handle); igt_spin_batch_free(fd, load); + } +#define BOOST_WAIT_TIMESTEP_MSEC 250 +#define BOOST_WAIT_TIMEOUT_MSEC 15000 static void waitboost(bool reset) { int pre_freqs[NUMFREQ]; int boost_freqs[NUMFREQ]; int post_freqs[NUMFREQ]; - int fd = drm_open_driver(DRIVER_INTEL); load_helper_run(LOW); @@ -602,6 +620,9 @@ static void waitboost(bool reset) */ boost_freq(fd, boost_freqs); + /* Wait till boost ends */ + igt_assert(igt_wait(boost_finished(), BOOST_WAIT_TIMEOUT_MSEC, BOOST_WAIT_TIMESTEP_MSEC)); + igt_debug("Apply low load again...\n"); sleep(1); stabilize_check(post_freqs); @@ -611,7 +632,7 @@ static void waitboost(bool reset) idle_check(); igt_assert_lt(pre_freqs[CUR], pre_freqs[MAX]); - igt_assert_eq(boost_freqs[CUR], boost_freqs[MAX]); + igt_assert_eq(boost_freqs[CUR], boost_freqs[BOOST]); igt_assert_lt(post_freqs[CUR], post_freqs[MAX]); close(fd); @@ -640,8 +661,8 @@ igt_main struct junk *junk = stuff; int ret; - /* Use drm_open_driver to verify device existence */ - drm_fd = drm_open_driver(DRIVER_INTEL); + /* Use drm_open_driver to to force running tests as drm master */ + drm_fd = drm_open_driver_master(DRIVER_INTEL); igt_require_gem(drm_fd); igt_require(gem_can_store_dword(drm_fd, 0)); @@ -657,7 +678,7 @@ igt_main val = readval(junk->filp); igt_assert(val >= 0); junk++; - } while(junk->name != NULL); + } while (junk->name != NULL); read_freqs(origfreqs);