From patchwork Mon May 8 11:30:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 9716005 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 1E4A260364 for ; Mon, 8 May 2017 11:30:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 152C226530 for ; Mon, 8 May 2017 11:30:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 08D9B268AE; Mon, 8 May 2017 11:30:16 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 7A62226530 for ; Mon, 8 May 2017 11:30:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DA1936E211; Mon, 8 May 2017 11:30:14 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id ED3416E212 for ; Mon, 8 May 2017 11:30:12 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id d127so6410303wmf.1 for ; Mon, 08 May 2017 04:30:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ursulin-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Ys7QmQNx61PfmVqdoCD68Cyef5XakdBIcyWxS6O/DYw=; b=OaZEm5Uw/UfjI09PD2Tw8N2UKt+S9OBCPpfCmmc9Re8fsfS/nl0uC8GQunP107J/UU Dy6OF25B7eb/TLjUBxZtnXUUbjYsr5orwANGKgGr+uSU6PMAQ9LlWwd+hQrBiFwbUuqa l5I8IvVvUdRIAm6sG+gLAMnAzS2DLBQkvjMFhEeXt4Ptx7BpGc5/SJHmahsu6vOr9ow+ 9E3X+ipi0uBeW7O2D7Ejzi/2O6sO2iXvV0V+EL+W0Bdt1c9HxHMoo5vJE3nzBXVLBG/U 1Z0cEMjv8rnBpr/e/Hg8llBwvQhJqS42fj2xZw0eco8WgatBW3ZTn4I0Yj9YpolZ7rnW GuQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Ys7QmQNx61PfmVqdoCD68Cyef5XakdBIcyWxS6O/DYw=; b=h7x6cwTbblDnfsQGPbOcu6FnaoaSddPTpr/1Djwu2r8lzg16zRWxWS155HFeM2H1BM a47CYM+xPcagQ2LOIzEziUJW9A+X38qOYD9EM2B37vG2KaPlNvmYhGdFI5sp2OIOZYiN nXXoAG8fsR4G123QHpxnt5SD1hymxXGMOZAhoYY8LsNLI1ZAwW6p93t38D8NJoGBe2aS Mo9p0uOQYWDS3gqCmL7qg+CpFUicCZlWLDxQJVXXPiX8PWf6XoPCsWXiAyy4O6eRW6K/ N2Hi2r+JhJ2Eu3n3mlUgatDUu+RSHnBH1HraOLxv+bR4GXqKK+QdTmvEF39cggb6asyD 9yWw== X-Gm-Message-State: AODbwcASQzZV66C4XFOkA9dzz0opC1VwFe3KXnOrZuQvIntGCavD4pzu A1bTrp23gPSXOw== X-Received: by 10.28.197.137 with SMTP id v131mr6909056wmf.101.1494243011544; Mon, 08 May 2017 04:30:11 -0700 (PDT) Received: from t460p.intel ([94.15.199.60]) by smtp.gmail.com with ESMTPSA id u76sm14504906wrb.27.2017.05.08.04.30.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 May 2017 04:30:11 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Date: Mon, 8 May 2017 12:30:04 +0100 Message-Id: <20170508113004.11830-1-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170505114321.20348-1-tvrtko.ursulin@linux.intel.com> References: <20170505114321.20348-1-tvrtko.ursulin@linux.intel.com> Subject: [Intel-gfx] [PATCH v2] drm/i915: Restore GT performance in headless mode with DMC loaded 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 From: Tvrtko Ursulin It seems that the DMC likes to transition between the DC states a lot when there are no connected displays (no active power domains) during simple command submission. This frantic activity on DC states has a terrible impact on the performance of the overall chip with huge latencies observed in the interrupt handlers and elsewhere. Simple tests like igt/gem_latency -n 0 are slowed down by a factor of eight. Work around it by grabbing a modeset display power domain whilst there is any GT activity. This seems to be effective in making the DMC keep its paws off the chip. On the other hand this may have a negative impact on the overall power budget of the chip and so could still affect performance. This version limits the workaround got SKL GT3 and GT4 parts but this is just due the absence of testing on other platforms. It is possible we will have to apply it wider. v2: * Add commit text as comment in i915_gem_mark_busy. (Chris Wilson) * Protect macro body with braces. (Jani Nikula) Signed-off-by: Tvrtko Ursulin Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100572 Testcase: igt/gem_exec_nop/headless Cc: Imre Deak Acked-by: Chris Wilson --- drivers/gpu/drm/i915/i915_drv.h | 5 +++++ drivers/gpu/drm/i915/i915_gem.c | 4 ++++ drivers/gpu/drm/i915/i915_gem_request.c | 17 +++++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 320c16df1c9c..509b398d054d 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -2990,6 +2990,11 @@ intel_info(const struct drm_i915_private *dev_priv) #define HAS_DECOUPLED_MMIO(dev_priv) (INTEL_INFO(dev_priv)->has_decoupled_mmio) +#define NEEDS_CSR_GT_PERF_WA(dev_priv) \ + (HAS_CSR(dev_priv) && \ + (IS_SKL_GT3(dev_priv) || IS_SKL_GT4(dev_priv)) && \ + (dev_priv)->csr.dmc_payload) + #include "i915_trace.h" static inline bool intel_scanout_needs_vtd_wa(struct drm_i915_private *dev_priv) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index b2727905ef2b..c52d863f409c 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -3200,7 +3200,11 @@ i915_gem_idle_work_handler(struct work_struct *work) if (INTEL_GEN(dev_priv) >= 6) gen6_rps_idle(dev_priv); + intel_runtime_pm_put(dev_priv); + + if (NEEDS_CSR_GT_PERF_WA(dev_priv)) + intel_display_power_put(dev_priv, POWER_DOMAIN_MODESET); out_unlock: mutex_unlock(&dev->struct_mutex); diff --git a/drivers/gpu/drm/i915/i915_gem_request.c b/drivers/gpu/drm/i915/i915_gem_request.c index 10361c7e3b37..c47c983b874e 100644 --- a/drivers/gpu/drm/i915/i915_gem_request.c +++ b/drivers/gpu/drm/i915/i915_gem_request.c @@ -873,6 +873,23 @@ static void i915_gem_mark_busy(const struct intel_engine_cs *engine) GEM_BUG_ON(!dev_priv->gt.active_requests); + /* + * It seems that the DMC likes to transition between the DC states + * a lot when there are no connected displays (no active power + * domains) during simple command submission. + * + * This frantic activity on DC states has a terrible impact on the + * performance of the overall chip with huge latencies observed in + * the interrupt handlers and elsewhere. Simple tests like + * igt/gem_latency -n 0 are slowed down by a factor of eight. + * + * Work around it by grabbing a modeset display power domain whilst + * there is any GT activity. This seems to be effective in making + * the DMC keep its paws off the chip. + */ + if (NEEDS_CSR_GT_PERF_WA(dev_priv)) + intel_display_power_get(dev_priv, POWER_DOMAIN_MODESET); + intel_runtime_pm_get_noresume(dev_priv); dev_priv->gt.awake = true;