From patchwork Sat Jul 28 16:46:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10548019 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 C39DE112E for ; Sat, 28 Jul 2018 16:46:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3C7A2B104 for ; Sat, 28 Jul 2018 16:46:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A5F302B107; Sat, 28 Jul 2018 16:46:40 +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 45F632B104 for ; Sat, 28 Jul 2018 16:46:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2F4B16E202; Sat, 28 Jul 2018 16:46:39 +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 2573B6E1EB for ; Sat, 28 Jul 2018 16:46:36 +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 12491853-1500050 for multiple; Sat, 28 Jul 2018 17:46:21 +0100 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Sat, 28 Jul 2018 17:46:20 +0100 Message-Id: <20180728164623.10613-2-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180728164623.10613-1-chris@chris-wilson.co.uk> References: <20180728164623.10613-1-chris@chris-wilson.co.uk> Subject: [Intel-gfx] [PATCH 2/5] drm/i915: Expose idle delays to Kconfig 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: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP We want to expose the parameters for controlling how long it takes for us to notice and park the GPU after a stream of requests in order to try and tune the optimal power-efficiency vs latency of a mostly idle system. v2: retire_work has two scheduling points, update them both Signed-off-by: Chris Wilson Cc: Tvrtko Ursulin Reviewed-by: Tvrtko Ursulin --- drivers/gpu/drm/i915/Kconfig.profile | 23 +++++++++++++++++++++++ drivers/gpu/drm/i915/i915_gem.c | 8 +++++--- drivers/gpu/drm/i915/i915_gem.h | 13 +++++++++++++ 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/Kconfig.profile b/drivers/gpu/drm/i915/Kconfig.profile index 8a230eeb98df..63cb744d920d 100644 --- a/drivers/gpu/drm/i915/Kconfig.profile +++ b/drivers/gpu/drm/i915/Kconfig.profile @@ -24,3 +24,26 @@ config DRM_I915_SPIN_REQUEST_CS spin prior to sleeping again. May be 0 to disable spinning after being woken. + +config DRM_I915_GEM_RETIRE_DELAY + int + default 1000 # milliseconds + help + We maintain a background job whose purpose is to keep cleaning up + after userspace, and may be the first to spot an idle system. This + parameter determines the interval between execution of the worker. + + To reduce the number of timer wakeups, large delays (of greater than + a second) are rounded to the next walltime second to allow coalescing + of multiple system timers into a single wakeup. + +config DRM_I915_GEM_PARK_DELAY + int + default 100 # milliseconds + help + Before parking the engines and the GPU after the final request is + retired, we may wait for a small delay to reduce the frequecy of + having to park/unpark and so the latency in executing a new request. + + May be 0 to immediately start parking the engines after the last + request. diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 460f256114f7..5b538a92631d 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -192,7 +192,9 @@ void i915_gem_park(struct drm_i915_private *i915) return; /* Defer the actual call to __i915_gem_park() to prevent ping-pongs */ - mod_delayed_work(i915->wq, &i915->gt.idle_work, msecs_to_jiffies(100)); + mod_delayed_work(i915->wq, + &i915->gt.idle_work, + msecs_to_jiffies(CONFIG_DRM_I915_GEM_PARK_DELAY)); } void i915_gem_unpark(struct drm_i915_private *i915) @@ -236,7 +238,7 @@ void i915_gem_unpark(struct drm_i915_private *i915) queue_delayed_work(i915->wq, &i915->gt.retire_work, - round_jiffies_up_relative(HZ)); + i915_gem_retire_delay()); } int @@ -3466,7 +3468,7 @@ i915_gem_retire_work_handler(struct work_struct *work) if (READ_ONCE(dev_priv->gt.awake)) queue_delayed_work(dev_priv->wq, &dev_priv->gt.retire_work, - round_jiffies_up_relative(HZ)); + i915_gem_retire_delay()); } static void shrink_caches(struct drm_i915_private *i915) diff --git a/drivers/gpu/drm/i915/i915_gem.h b/drivers/gpu/drm/i915/i915_gem.h index e46592956872..c6b4971435dc 100644 --- a/drivers/gpu/drm/i915/i915_gem.h +++ b/drivers/gpu/drm/i915/i915_gem.h @@ -27,6 +27,8 @@ #include #include +#include +#include struct drm_i915_private; @@ -76,6 +78,17 @@ struct drm_i915_private; void i915_gem_park(struct drm_i915_private *i915); void i915_gem_unpark(struct drm_i915_private *i915); +static inline unsigned long i915_gem_retire_delay(void) +{ + const unsigned long delay = + msecs_to_jiffies(CONFIG_DRM_I915_GEM_RETIRE_DELAY); + + if (CONFIG_DRM_I915_GEM_RETIRE_DELAY >= 1000) + return round_jiffies_up_relative(delay); + else + return delay; +} + static inline void __tasklet_disable_sync_once(struct tasklet_struct *t) { if (atomic_inc_return(&t->count) == 1)