Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1130C2BB85 for ; Fri, 17 Apr 2020 08:49:45 +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 C0CB62076D for ; Fri, 17 Apr 2020 08:49:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C0CB62076D 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 33E4B6E3CE; Fri, 17 Apr 2020 08:49:45 +0000 (UTC) Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id C40586E3CE for ; Fri, 17 Apr 2020 08:49:40 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from build.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 20929832-1500050 for multiple; Fri, 17 Apr 2020 09:49:32 +0100 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Fri, 17 Apr 2020 09:49:26 +0100 Message-Id: <20200417084930.644-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 1/5] drm/i915/selftests: Delay spinner before waiting for an interrupt X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chris Wilson Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" It seems that although (perhaps because of the memory stall?) the spinner has signaled that it has started, it still takes some time to spin up to 100% utilisation of the HW. Since the test depends on the full utilisation of the HW to trigger the RPS interrupt, wait a little bit and flush the interrupt status to be sure that the event we see if from the spinner. Signed-off-by: Chris Wilson --- drivers/gpu/drm/i915/gt/selftest_rps.c | 28 +++++++++++++++----------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/selftest_rps.c b/drivers/gpu/drm/i915/gt/selftest_rps.c index 26aadc2ae3be..199d608aa763 100644 --- a/drivers/gpu/drm/i915/gt/selftest_rps.c +++ b/drivers/gpu/drm/i915/gt/selftest_rps.c @@ -14,6 +14,20 @@ static void dummy_rps_work(struct work_struct *wrk) { } +static void sleep_for_ei(struct intel_rps *rps, int timeout_us) +{ + /* Flush any previous EI */ + usleep_range(timeout_us, 2 * timeout_us); + + /* Reset the interrupt status */ + rps_disable_interrupts(rps); + GEM_BUG_ON(rps->pm_iir); + rps_enable_interrupts(rps); + + /* And then wait for the timeout, for real this time */ + usleep_range(2 * timeout_us, 3 * timeout_us); +} + static int __rps_up_interrupt(struct intel_rps *rps, struct intel_engine_cs *engine, struct igt_spinner *spin) @@ -28,7 +42,6 @@ static int __rps_up_interrupt(struct intel_rps *rps, intel_gt_pm_wait_for_idle(engine->gt); GEM_BUG_ON(rps->active); - rps->pm_iir = 0; rps->cur_freq = rps->min_freq; rq = igt_spinner_create_request(spin, engine->kernel_context, MI_NOOP); @@ -71,7 +84,7 @@ static int __rps_up_interrupt(struct intel_rps *rps, timeout = intel_uncore_read(uncore, GEN6_RP_UP_EI); timeout = GT_PM_INTERVAL_TO_US(engine->i915, timeout); - usleep_range(2 * timeout, 3 * timeout); + sleep_for_ei(rps, timeout); GEM_BUG_ON(i915_request_completed(rq)); igt_spinner_end(spin); @@ -122,16 +135,7 @@ static int __rps_down_interrupt(struct intel_rps *rps, timeout = intel_uncore_read(uncore, GEN6_RP_DOWN_EI); timeout = GT_PM_INTERVAL_TO_US(engine->i915, timeout); - /* Flush any previous EI */ - usleep_range(timeout, 2 * timeout); - - /* Reset the interrupt status */ - rps_disable_interrupts(rps); - GEM_BUG_ON(rps->pm_iir); - rps_enable_interrupts(rps); - - /* And then wait for the timeout, for real this time */ - usleep_range(2 * timeout, 3 * timeout); + sleep_for_ei(rps, timeout); if (rps->cur_freq != rps->max_freq) { pr_err("%s: Frequency unexpectedly changed [down], now %d!\n", -- 2.20.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx