[PATCH 41/48] drm/i915: Expose idle delays to Kconfig
Chris Wilson
chris at chris-wilson.co.uk
Fri Jan 19 22:58:57 UTC 2018
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 <chris at chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
drivers/gpu/drm/i915/Kconfig.profile | 23 +++++++++++++++++++++++
drivers/gpu/drm/i915/i915_gem.c | 2 +-
drivers/gpu/drm/i915/i915_gem.h | 13 +++++++++++++
drivers/gpu/drm/i915/i915_gem_request.c | 4 ++--
4 files changed, 39 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 7cac06a3765c..8e4bab871979 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3332,7 +3332,7 @@ i915_gem_retire_work_handler(struct work_struct *work)
i915_queue_hangcheck(dev_priv);
queue_delayed_work(dev_priv->wq,
&dev_priv->gt.retire_work,
- round_jiffies_up_relative(HZ));
+ i915_gem_retire_delay());
}
}
diff --git a/drivers/gpu/drm/i915/i915_gem.h b/drivers/gpu/drm/i915/i915_gem.h
index e920dab7f1b8..7e052d1011cb 100644
--- a/drivers/gpu/drm/i915/i915_gem.h
+++ b/drivers/gpu/drm/i915/i915_gem.h
@@ -26,6 +26,8 @@
#define __I915_GEM_H__
#include <linux/bug.h>
+#include <linux/jiffies.h>
+#include <linux/timer.h>
#ifdef CONFIG_DRM_I915_DEBUG_GEM
#define GEM_BUG_ON(condition) do { if (unlikely((condition))) { \
@@ -56,4 +58,15 @@
#define I915_NUM_ENGINES 5
+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;
+}
+
#endif /* __I915_GEM_H__ */
diff --git a/drivers/gpu/drm/i915/i915_gem_request.c b/drivers/gpu/drm/i915/i915_gem_request.c
index 5b2b93b4808d..da48c4705e67 100644
--- a/drivers/gpu/drm/i915/i915_gem_request.c
+++ b/drivers/gpu/drm/i915/i915_gem_request.c
@@ -286,7 +286,7 @@ static void mark_busy(struct drm_i915_private *i915)
queue_delayed_work(i915->wq,
&i915->gt.retire_work,
- round_jiffies_up_relative(HZ));
+ i915_gem_retire_delay());
}
static int reserve_engine(struct intel_engine_cs *engine)
@@ -320,7 +320,7 @@ static void unreserve_engine(struct intel_engine_cs *engine)
GEM_BUG_ON(!i915->gt.awake);
mod_delayed_work(i915->wq,
&i915->gt.idle_work,
- msecs_to_jiffies(100));
+ msecs_to_jiffies(CONFIG_DRM_I915_GEM_PARK_DELAY));
}
GEM_BUG_ON(!engine->timeline->inflight_seqnos);
--
2.15.1
More information about the Intel-gfx-trybot
mailing list