From patchwork Thu Dec 24 10:46:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Praveen Paneri X-Patchwork-Id: 7916391 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7AFC5BEEE5 for ; Thu, 24 Dec 2015 10:36:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A889720600 for ; Thu, 24 Dec 2015 10:36:58 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 80573205FE for ; Thu, 24 Dec 2015 10:36:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F40716E2A7; Thu, 24 Dec 2015 02:36:55 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTP id 6A5176E3CD for ; Thu, 24 Dec 2015 02:36:54 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP; 24 Dec 2015 02:36:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,473,1444719600"; d="scan'208";a="877993152" Received: from intel-desktop.iind.intel.com ([10.223.82.55]) by orsmga002.jf.intel.com with ESMTP; 24 Dec 2015 02:36:51 -0800 From: Praveen Paneri To: intel-gfx@lists.freedesktop.org Date: Thu, 24 Dec 2015 16:16:08 +0530 Message-Id: <1450953968-27805-1-git-send-email-praveen.paneri@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <20151217072553.GB14895@nuc-i3427.alporthouse.com> References: <20151217072553.GB14895@nuc-i3427.alporthouse.com> Cc: Akash Goel , Praveen Paneri Subject: [Intel-gfx] [PATCH] drm/i915: Unbind objects in shrinker only if device is runtime active 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When the system is running low on memory, gem shrinker is invoked. In this process objects will be unbounded from GTT and unbinding process will require access to GTT(GTTADR) and also to fence register potentially. That requires a resume of gfx device, if suspended, in the shrinker path. Considering the power leakage due to intermediate resume, perform unbinding operation only if device is already runtime active. Signed-off-by: Akash Goel Signed-off-by: Praveen Paneri Cc: Chris Wilson Reviewed-by: Chris Wilson --- drivers/gpu/drm/i915/i915_gem_shrinker.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c index f7df54a..89350f4 100644 --- a/drivers/gpu/drm/i915/i915_gem_shrinker.c +++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c @@ -89,6 +89,15 @@ i915_gem_shrink(struct drm_i915_private *dev_priv, i915_gem_retire_requests(dev_priv->dev); /* + * Unbinding of objects will require HW access. Lets not wake + * up gfx device just for this. Do the unbinding only if gfx + * device is already active. + */ + if ((flags & I915_SHRINK_BOUND) && + !intel_runtime_pm_get_noidle(dev_priv)) + flags &= ~I915_SHRINK_BOUND; + + /* * As we may completely rewrite the (un)bound list whilst unbinding * (due to retiring requests) we have to strictly process only * one element of the list at the time, and recheck the list @@ -144,6 +153,8 @@ i915_gem_shrink(struct drm_i915_private *dev_priv, } list_splice(&still_in_list, phase->list); } + if (flags & I915_SHRINK_BOUND) + intel_runtime_pm_put(dev_priv); i915_gem_retire_requests(dev_priv->dev);