[PATCH v3 04/10] drm/i915: Always sanitize GT wakeref before restarting engines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The first request submitted to an engine will take the prolonged GT
wakeref. If we discard that wakeref to issue a reset/suspend/etc, then
before restarting the engines, reacquire the GT's wakeref.

Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
---
 drivers/gpu/drm/i915/i915_gem.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 46e26064f3cf..ec96b81e08b3 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3099,13 +3099,6 @@ void i915_gem_reset(struct drm_i915_private *dev_priv)
 	}
 
 	i915_gem_restore_fences(dev_priv);
-
-	if (dev_priv->gt.awake) {
-		intel_sanitize_gt_powersave(dev_priv);
-		intel_enable_gt_powersave(dev_priv);
-		if (INTEL_GEN(dev_priv) >= 6)
-			gen6_rps_busy(dev_priv);
-	}
 }
 
 void i915_gem_reset_finish_engine(struct intel_engine_cs *engine)
@@ -4874,6 +4867,24 @@ static int __i915_gem_restart_engines(void *data)
 	enum intel_engine_id id;
 	int err;
 
+	/*
+	 * If we are holding a wakeref from a previous cycle, e.g. from
+	 * before a reset, scrub the GT powersaving and reacquire. This is
+	 * just to make sure that the HW matches our SW tracking,
+	 * irrespective of whether or not it was preserved over the
+	 * restart.
+	 */
+	if (i915->gt.awake) {
+		intel_sanitize_gt_powersave(i915);
+		intel_enable_gt_powersave(i915);
+		if (INTEL_GEN(i915) >= 6)
+			gen6_rps_busy(i915);
+
+		queue_delayed_work(i915->wq,
+				   &i915->gt.retire_work,
+				   round_jiffies_up_relative(HZ));
+	}
+
 	for_each_engine(engine, i915, id) {
 		err = engine->init_hw(engine);
 		if (err)
-- 
2.15.0

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




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux