public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/i915: Unbind objects in shrinker only if device is runtime active
@ 2016-05-02  8:40 Praveen Paneri
  2016-05-02  8:40 ` [PATCH 2/2] drm/i915: Add rpm get/put in oom and vmap notifier Praveen Paneri
  2016-05-02  9:18 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: Unbind objects in shrinker only if device is runtime active Patchwork
  0 siblings, 2 replies; 5+ messages in thread
From: Praveen Paneri @ 2016-05-02  8:40 UTC (permalink / raw)
  To: intel-gfx; +Cc: Akash Goel, Praveen Paneri

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.

v2: Use newly implemented intel_runtime_pm_get_if_in_use (Chris)

Signed-off-by: Akash Goel <akash.goel@intel.com>
Signed-off-by: Praveen Paneri <praveen.paneri@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem_shrinker.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c
index 2643d18..9a24415 100644
--- a/drivers/gpu/drm/i915/i915_gem_shrinker.c
+++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c
@@ -134,6 +134,15 @@ i915_gem_shrink(struct drm_i915_private *dev_priv,
 	i915_gem_retire_requests(dev_priv->dev);
 
 	/*
+	 * Unbinding of objects will require HW access; Let us not wake the
+	 * device just to recover a little memory. If absolutely necessary,
+	 * we will force the wake during oom-notifier.
+	 */
+	if ((flags & I915_SHRINK_BOUND) &&
+	    !intel_runtime_pm_get_if_in_use(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
@@ -197,6 +206,9 @@ 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);
 
 	return count;
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-05-03  3:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-02  8:40 [PATCH 1/2] drm/i915: Unbind objects in shrinker only if device is runtime active Praveen Paneri
2016-05-02  8:40 ` [PATCH 2/2] drm/i915: Add rpm get/put in oom and vmap notifier Praveen Paneri
2016-05-02 13:04   ` Chris Wilson
2016-05-03  3:46     ` Praveen Paneri
2016-05-02  9:18 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: Unbind objects in shrinker only if device is runtime active Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox