Skip to contentSkip to conversation

Execlist based Engine reset patches

PATCH Superseded Arun Siluvery 3 participants 28 messages Jul 26, 2016 – Jul 28, 2016

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Execlist based Engine reset patches

These patches are to add engine reset feature from Gen8. This is also referred to as Timeout detection and recovery (TDR). This complements to the full gpu reset feature available in i915 but it only allows to reset a particular engine instead of all engines thus providing a light weight engine reset and recovery mechanism.

This implementation is for execlist based submission only hence limited from Gen8 onwards.

Timeout detection is by means of existing hangcheck which remains the same, main changes are to the recovery mechanism. Once we detect a hang on a particular engine we identify the request that caused the hang, skip the request and adjust head pointers to allow the execution to proceed normally. After some cleanup, submissions are restarted to process remaining work queued to that engine.

If engine reset fails to recover engine correctly then we fallback to full gpu reset.

Arun Siluvery (9):
drm/i915: Update i915.reset to handle engine resets drm/i915/tdr: Update reset_in_progress to account for engine reset drm/i915/tdr: Modify error handler for per engine hang recovery drm/i915/tdr: Identify hung request and drop it drm/i915/tdr: Restart submission after engine reset drm/i915/tdr: Add support for per engine reset recovery drm/i915/tdr: Add engine reset count to error state drm/i915/tdr: Export reset count info to debugfs drm/i915/tdr: Enable Engine reset and recovery support

Chris Wilson (1):
drm/i915: Separate out reset flags from the reset counter

Mika Kuoppala (1):
drm/i915: Skip reset request if there is one already

 drivers/gpu/drm/i915/i915_debugfs.c     |  19 ++++
 drivers/gpu/drm/i915/i915_drv.c         |  82 ++++++++++++--
 drivers/gpu/drm/i915/i915_drv.h         |  58 +++++-----
 drivers/gpu/drm/i915/i915_gem.c         |   4 +-
 drivers/gpu/drm/i915/i915_gem_request.c |  13 +--
 drivers/gpu/drm/i915/i915_gpu_error.c   |   3 +
 drivers/gpu/drm/i915/i915_irq.c         | 184 +++++++++++++++++++++++---------
 drivers/gpu/drm/i915/i915_params.c      |   6 +-
 drivers/gpu/drm/i915/i915_params.h      |   2 +-
 drivers/gpu/drm/i915/intel_display.c    |  25 +++--
 drivers/gpu/drm/i915/intel_drv.h        |   4 +-
 drivers/gpu/drm/i915/intel_lrc.c        | 161 +++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/intel_lrc.h        |   6 ++
 drivers/gpu/drm/i915/intel_uncore.c     |  47 +++++++-
 14 files changed, 502 insertions(+), 112 deletions(-)
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 1/11 drm/i915: Update i915.reset to handle engine resets

In preparation for engine reset work update this parameter to handle more than one type of reset. Default at the moment is still full gpu reset.

---
 drivers/gpu/drm/i915/i915_params.c | 6 +++---
 drivers/gpu/drm/i915/i915_params.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_params.c +3 -3
index b6e404c..a96df81 100644
@@ -45,7 +45,7 @@ struct i915_params i915 __read_mostly = {
 	.fastboot = 0,
 	.prefault_disable = 0,
 	.load_detect_test = 0,
-	.reset = true,
+	.reset = 1,
 	.invert_brightness = 0,
 	.disable_display = 0,
 	.enable_cmd_parser = 1,
@@ -111,8 +111,8 @@ MODULE_PARM_DESC(vbt_sdvo_panel_type,
 	"Override/Ignore selection of SDVO panel mode in the VBT "
 	"(-2=ignore, -1=auto [default], index in VBT BIOS table)");
 
-module_param_named_unsafe(reset, i915.reset, bool, 0600);
-MODULE_PARM_DESC(reset, "Attempt GPU resets (default: true)");
+module_param_named_unsafe(reset, i915.reset, int, 0600);
+MODULE_PARM_DESC(reset, "Attempt GPU resets (0=disabled, 1=full gpu reset [default], 2=engine reset)");
 
 module_param_named_unsafe(enable_hangcheck, i915.enable_hangcheck, bool, 0644);
 MODULE_PARM_DESC(enable_hangcheck,
drivers/gpu/drm/i915/i915_params.h +1 -1
index 0ad020b..6276fa2 100644
@@ -34,6 +34,7 @@ struct i915_params {
 	int lvds_channel_mode;
 	int panel_use_ssc;
 	int vbt_sdvo_panel_type;
+	int reset;
 	int enable_rc6;
 	int enable_dc;
 	int enable_fbc;
@@ -57,7 +58,6 @@ struct i915_params {
 	bool fastboot;
 	bool prefault_disable;
 	bool load_detect_test;
-	bool reset;
 	bool disable_display;
 	bool verbose_state_checks;
 	bool nuclear_pageflip;
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

PATCH 2/11 drm/i915: Separate out reset flags from the reset counter

In reply to Arun Siluvery

From: Chris Wilson <[email protected]>

In preparation for introducing a per-engine reset, we can first separate the mixing of the reset state from the global reset counter.

The loss of atomicity in updating the reset state poses a small problem for handling the waiters. For requests, this is solved by advancing the seqno so that a waiter waking up after the reset knows the request is complete. For pending flips, we still rely on the increment of the global reset epoch (as well as the reset-in-progress flag) to signify when the hardware was reset.

The advantage, now that we do not inspect the reset state during reset itself i.e. we no longer emit requests during reset, is that we can use the atomic updates of the state flags to ensure that only one reset worker is active.

Cc Arun Siluvery <[email protected]>
Cc Mika Kuoppala <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.c         |  16 ++---
 drivers/gpu/drm/i915/i915_drv.h         |  46 +++++---------
 drivers/gpu/drm/i915/i915_gem.c         |   2 +-
 drivers/gpu/drm/i915/i915_gem_request.c |  13 ++--
 drivers/gpu/drm/i915/i915_irq.c         | 104 +++++++++++++++-----------------
 drivers/gpu/drm/i915/intel_display.c    |  25 +++++---
 drivers/gpu/drm/i915/intel_drv.h        |   4 +-
 7 files changed, 93 insertions(+), 117 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +5 -11
index 83afdd0..fb72842 100644
@@ -1593,7 +1593,7 @@ static int i915_drm_resume(struct drm_device *dev)
 	mutex_lock(&dev->struct_mutex);
 	if (i915_gem_init_hw(dev)) {
 		DRM_ERROR("failed to re-initialize GPU, declaring wedged!\n");
-		atomic_or(I915_WEDGED, &dev_priv->gpu_error.reset_counter);
+		set_bit(I915_WEDGED, &dev_priv->gpu_error.flags);
 	}
 	mutex_unlock(&dev->struct_mutex);
 
@@ -1754,20 +1754,13 @@ int i915_reset(struct drm_i915_private *dev_priv)
 {
 	struct drm_device *dev = &dev_priv->drm;
 	struct i915_gpu_error *error = &dev_priv->gpu_error;
-	unsigned reset_counter;
 	int ret;
 
 	mutex_lock(&dev->struct_mutex);
 
 	/* Clear any previous failed attempts at recovery. Time to try again. */
-	atomic_andnot(I915_WEDGED, &error->reset_counter);
-
-	/* Clear the reset-in-progress flag and increment the reset epoch. */
-	reset_counter = atomic_inc_return(&error->reset_counter);
-	if (WARN_ON(__i915_reset_in_progress(reset_counter))) {
-		ret = -EIO;
-		goto error;
-	}
+	__clear_bit(I915_WEDGED, &error->flags);
+	error->reset_count++;
 
 	pr_notice("drm/i915: Resetting chip after gpu hang\n");
 
@@ -1804,6 +1797,7 @@ int i915_reset(struct drm_i915_private *dev_priv)
 		goto error;
 	}
 
+	clear_bit(I915_RESET_IN_PROGRESS, &error->flags);
 	mutex_unlock(&dev->struct_mutex);
 
 	/*
@@ -1817,7 +1811,7 @@ int i915_reset(struct drm_i915_private *dev_priv)
 	return 0;
 
 error:
-	atomic_or(I915_WEDGED, &error->reset_counter);
+	set_bit(I915_WEDGED, &error->flags);
 	mutex_unlock(&dev->struct_mutex);
 	return ret;
 }
drivers/gpu/drm/i915/i915_drv.h +14 -32

77 lines not on this page · raw message

drivers/gpu/drm/i915/i915_gem.c +1 -1
index c843663..443570f 100644
@@ -4604,7 +4604,7 @@ int i915_gem_init(struct drm_device *dev)
 		 * for all other failure, such as an allocation failure, bail.
 		 */
 		DRM_ERROR("Failed to initialize GPU, declaring it wedged\n");
-		atomic_or(I915_WEDGED, &dev_priv->gpu_error.reset_counter);
+		__set_bit(I915_WEDGED, &dev_priv->gpu_error.flags);
 		ret = 0;
 	}
 
drivers/gpu/drm/i915/i915_gem_request.c +7 -6
index 60a3a34..74fa27d 100644
@@ -204,16 +204,18 @@ void i915_gem_request_retire_upto(struct drm_i915_gem_request *req)
 	WARN_ON(i915_verify_lists(engine->dev));
 }
 
-static int i915_gem_check_wedge(unsigned int reset_counter, bool interruptible)
+static int i915_gem_check_wedge(struct drm_i915_private *dev_priv)
 {
-	if (__i915_terminally_wedged(reset_counter))
+	struct i915_gpu_error *error = &dev_priv->gpu_error;
+
+	if (i915_terminally_wedged(error))
 		return -EIO;
 
-	if (__i915_reset_in_progress(reset_counter)) {
+	if (i915_reset_in_progress(error)) {
 		/* Non-interruptible callers can't handle -EAGAIN, hence return
 		 * -EIO unconditionally for these.
 		 */
-		if (!interruptible)
+		if (!dev_priv->mm.interruptible)
 			return -EIO;
 
 		return -EAGAIN;
@@ -298,7 +300,6 @@ __i915_gem_request_alloc(struct intel_engine_cs *engine,
 			 struct drm_i915_gem_request **req_out)
 {
 	struct drm_i915_private *dev_priv = engine->i915;
-	unsigned int reset_counter = i915_reset_counter(&dev_priv->gpu_error);
 	struct drm_i915_gem_request *req;
 	u32 seqno;
 	int ret;
@@ -312,7 +313,7 @@ __i915_gem_request_alloc(struct intel_engine_cs *engine,
 	 * EIO if the GPU is already wedged, or EAGAIN to drop the struct_mutex
 	 * and restart.
 	 */
-	ret = i915_gem_check_wedge(reset_counter, dev_priv->mm.interruptible);
+	ret = i915_gem_check_wedge(dev_priv);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/i915/i915_irq.c +47 -57

125 lines not on this page · raw message

drivers/gpu/drm/i915/intel_display.c +17 -8
index 78beb7e..46e904a 100644
@@ -3174,15 +3174,26 @@ void intel_finish_reset(struct drm_i915_private *dev_priv)
 	drm_modeset_unlock_all(&dev_priv->drm);
 }
 
+static bool abort_flip_on_reset(struct intel_crtc *crtc)
+{
+	struct i915_gpu_error *error = &to_i915(crtc->base.dev)->gpu_error;
+
+	if (i915_reset_in_progress(error))
+		return true;
+
+	if (crtc->reset_count != i915_reset_count(error))
+		return true;
+
+	return false;
+}
+
 static bool intel_crtc_has_pending_flip(struct drm_crtc *crtc)
 {
 	struct drm_device *dev = crtc->dev;
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
-	unsigned reset_counter;
 	bool pending;
 
-	reset_counter = i915_reset_counter(&to_i915(dev)->gpu_error);
-	if (intel_crtc->reset_counter != reset_counter)
+	if (abort_flip_on_reset(intel_crtc))
 		return false;
 
 	spin_lock_irq(&dev->event_lock);
@@ -10979,10 +10990,8 @@ static bool __pageflip_finished_cs(struct intel_crtc *crtc,
 {
 	struct drm_device *dev = crtc->base.dev;
 	struct drm_i915_private *dev_priv = to_i915(dev);
-	unsigned reset_counter;
 
-	reset_counter = i915_reset_counter(&dev_priv->gpu_error);
-	if (crtc->reset_counter != reset_counter)
+	if (abort_flip_on_reset(crtc))
 		return true;
 
 	/*
@@ -11662,8 +11671,8 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
 	if (ret)
 		goto cleanup;
 
-	intel_crtc->reset_counter = i915_reset_counter(&dev_priv->gpu_error);
-	if (__i915_reset_in_progress_or_wedged(intel_crtc->reset_counter)) {
+	intel_crtc->reset_count = i915_reset_count(&dev_priv->gpu_error);
+	if (i915_reset_in_progress_or_wedged(&dev_priv->gpu_error)) {
 		ret = -EIO;
 		goto cleanup;
 	}
drivers/gpu/drm/i915/intel_drv.h +2 -2
index e74d851..63ce82d 100644
@@ -683,8 +683,8 @@ struct intel_crtc {
 
 	struct intel_crtc_state *config;
 
-	/* reset counter value when the last flip was submitted */
-	unsigned int reset_counter;
+	/* global reset count when the last flip was submitted */
+	unsigned int reset_count;
 
 	/* Access to these should be protected by dev_priv->irq_lock. */
 	bool cpu_fifo_underrun_disabled;
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

PATCH 3/11 drm/i915/tdr: Update reset_in_progress to account for engine reset

In reply to Arun Siluvery

Now that we track reset progress using separate set of flags, update it to account for engine reset as well.

A bit corresponding engine->id is set if reset is in progress for that engine. Bit0 is for full gpu reset.

---
 drivers/gpu/drm/i915/i915_drv.h | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +15 -1
index 11436e7..125fafa 100644
@@ -1403,6 +1403,8 @@ struct i915_gpu_error {
 #define I915_RESET_IN_PROGRESS	0
 #define I915_WEDGED		(BITS_PER_LONG-1)
 
+	unsigned long engine_reset_count[I915_NUM_ENGINES];
+
 	/**
 	 * Waitqueue to signal when a hang is detected. Used to for waiters
 	 * to release the struct_mutex for the reset to procede.
@@ -3194,9 +3196,10 @@ i915_gem_find_active_request(struct intel_engine_cs *engine);
 void i915_gem_retire_requests(struct drm_i915_private *dev_priv);
 void i915_gem_retire_requests_ring(struct intel_engine_cs *engine);
 
+/* indicates the progress of engine reset or full gpu reset */
 static inline bool i915_reset_in_progress(struct i915_gpu_error *error)
 {
-	return test_bit(I915_RESET_IN_PROGRESS, &error->flags);
+	return unlikely(READ_ONCE(error->flags) & ~BIT(I915_WEDGED));
 }
 
 static inline bool i915_terminally_wedged(struct i915_gpu_error *error)
@@ -3214,6 +3217,17 @@ static inline u32 i915_reset_count(struct i915_gpu_error *error)
 	return READ_ONCE(error->reset_count);
 }
 
+static inline bool i915_full_gpu_reset_in_progress(struct i915_gpu_error *error)
+{
+	return test_bit(I915_RESET_IN_PROGRESS, &error->flags);
+}
+
+static inline bool i915_engine_reset_in_progress(struct i915_gpu_error *error,
+						 struct intel_engine_cs *engine)
+{
+	return test_bit(engine->id + 1, &error->flags);
+}
+
 void i915_gem_reset(struct drm_device *dev);
 bool i915_gem_clflush_object(struct drm_i915_gem_object *obj, bool force);
 int __must_check i915_gem_init(struct drm_device *dev);
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

Re: [PATCH 03/11] drm/i915/tdr: Update reset_in_progress to account for engine reset

Quoted 40 lines · Arun Siluvery

Now that we track reset progress using separate set of flags, update it to account for engine reset as well.

A bit corresponding engine->id is set if reset is in progress for that engine. Bit0 is for full gpu reset.

---
 drivers/gpu/drm/i915/i915_drv.h | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +4 -1
index 11436e7..125fafa 100644
@@ -1403,6 +1403,8 @@ struct i915_gpu_error {
 #define I915_RESET_IN_PROGRESS	0
 #define I915_WEDGED		(BITS_PER_LONG-1)
 
+	unsigned long engine_reset_count[I915_NUM_ENGINES];
+
 	/**
 	 * Waitqueue to signal when a hang is detected. Used to for waiters
 	 * to release the struct_mutex for the reset to procede.
@@ -3194,9 +3196,10 @@ i915_gem_find_active_request(struct intel_engine_cs *engine);
 void i915_gem_retire_requests(struct drm_i915_private *dev_priv);
 void i915_gem_retire_requests_ring(struct intel_engine_cs *engine);
 
+/* indicates the progress of engine reset or full gpu reset */
 static inline bool i915_reset_in_progress(struct i915_gpu_error *error)
 {
-	return test_bit(I915_RESET_IN_PROGRESS, &error->flags);
+	return unlikely(READ_ONCE(error->flags) & ~BIT(I915_WEDGED));
 }
 
 static inline bool i915_terminally_wedged(struct i915_gpu_error *error)
@@ -3214,6 +3217,17 @@ static inline u32 i915_reset_count(struct i915_gpu_error *error)
 	return READ_ONCE(error->reset_count);
 }
 

drivers/gpu/drm/i915/i915_drv.h static inline u32 i915_reset_count(struct i915_gpu_error *error) · line 3229

Quoted 10 lines
drivers/gpu/drm/i915/i915_drv.h +10 -0
+static inline bool i915_full_gpu_reset_in_progress(struct i915_gpu_error *error)
+{
+	return test_bit(I915_RESET_IN_PROGRESS, &error->flags);
+}
+
+static inline bool i915_engine_reset_in_progress(struct i915_gpu_error *error,
+						 struct intel_engine_cs *engine)
+{
+	return test_bit(engine->id + 1, &error->flags);
+}

?

A totally unexplained change. If it is because you think to want to break waiters on struct_mutex, try again.
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

Re: [PATCH 03/11] drm/i915/tdr: Update reset_in_progress to account for engine reset

Quoted 54 lines · Chris Wilson
Quoted 40 lines · Arun Siluvery

Now that we track reset progress using separate set of flags, update it to account for engine reset as well.

A bit corresponding engine->id is set if reset is in progress for that engine. Bit0 is for full gpu reset.

---
  drivers/gpu/drm/i915/i915_drv.h | 16 +++++++++++++++-
  1 file changed, 15 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +4 -1
index 11436e7..125fafa 100644
@@ -1403,6 +1403,8 @@ struct i915_gpu_error {
  #define I915_RESET_IN_PROGRESS	0
  #define I915_WEDGED		(BITS_PER_LONG-1)
 
+	unsigned long engine_reset_count[I915_NUM_ENGINES];
+
  	/**
  	 * Waitqueue to signal when a hang is detected. Used to for waiters
  	 * to release the struct_mutex for the reset to procede.
@@ -3194,9 +3196,10 @@ i915_gem_find_active_request(struct intel_engine_cs *engine);
  void i915_gem_retire_requests(struct drm_i915_private *dev_priv);
  void i915_gem_retire_requests_ring(struct intel_engine_cs *engine);
 
+/* indicates the progress of engine reset or full gpu reset */
  static inline bool i915_reset_in_progress(struct i915_gpu_error *error)
  {
-	return test_bit(I915_RESET_IN_PROGRESS, &error->flags);
+	return unlikely(READ_ONCE(error->flags) & ~BIT(I915_WEDGED));
  }
 
  static inline bool i915_terminally_wedged(struct i915_gpu_error *error)
@@ -3214,6 +3217,17 @@ static inline u32 i915_reset_count(struct i915_gpu_error *error)
  	return READ_ONCE(error->reset_count);
  }
 

drivers/gpu/drm/i915/i915_drv.h static inline u32 i915_reset_count(struct i915_gpu_error *error) · line 3229

Quoted 10 lines
drivers/gpu/drm/i915/i915_drv.h +10 -0
+static inline bool i915_full_gpu_reset_in_progress(struct i915_gpu_error *error)
+{
+	return test_bit(I915_RESET_IN_PROGRESS, &error->flags);
+}
+
+static inline bool i915_engine_reset_in_progress(struct i915_gpu_error *error,
+						 struct intel_engine_cs *engine)
+{
+	return test_bit(engine->id + 1, &error->flags);
+}

?

Quoted 2 lines

A totally unexplained change. If it is because you think to want to break waiters on struct_mutex, try again.

So you don't want error->flags to include engine reset bits? ok, it should be possible to use engine_mask itself.

Next patch separates engine reset and full gpu reset in separate functions, for branching purposes i915_full_gpu_reset_in_progress() is added, is this ok or directly use test_bit() ?

regards
Arun

Quoted 2 lines

-Chris

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw

Re: [PATCH 03/11] drm/i915/tdr: Update reset_in_progress to account for engine reset

Quoted 9 lines · Arun Siluvery
Quoted 2 lines · Chris Wilson

A totally unexplained change. If it is because you think to want to break waiters on struct_mutex, try again.

So you don't want error->flags to include engine reset bits? ok, it should be possible to use engine_mask itself.

Next patch separates engine reset and full gpu reset in separate functions, for branching purposes i915_full_gpu_reset_in_progress() is added, is this ok or directly use test_bit() ?

The bit serves 2 functions: serialise error handling, and waking up waiters on the struct_mutex. That second function is exposed through the i915_reset_in_progress(), which is being altered here without explaining how the changed semantics impacts the current users or why it is necessary. imo we can do engine resets without struct_mutex. -Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

Re: [PATCH 03/11] drm/i915/tdr: Update reset_in_progress to account for engine reset

Quoted 11 lines · Chris Wilson
Quoted 9 lines · Arun Siluvery
Quoted 2 lines · Chris Wilson

A totally unexplained change. If it is because you think to want to break waiters on struct_mutex, try again.

So you don't want error->flags to include engine reset bits? ok, it should be possible to use engine_mask itself.

Next patch separates engine reset and full gpu reset in separate functions, for branching purposes i915_full_gpu_reset_in_progress() is added, is this ok or directly use test_bit() ?

Quoted 5 lines

The bit serves 2 functions: serialise error handling, and waking up waiters on the struct_mutex. That second function is exposed through the i915_reset_in_progress(), which is being altered here without explaining how the changed semantics impacts the current users or why it is necessary. imo we can do engine resets without struct_mutex.

Yes, as you suggested I am not taking struct_mutex now but adding engine reset bits to error->flags was breaking the waiters. I will try to use engine_mask itself and keep error->flags unchanged.

regards
Arun

Quoted 2 lines

-Chris

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#8 lore raw

PATCH 4/11 drm/i915/tdr: Modify error handler for per engine hang recovery

In reply to Arun Siluvery

This is a preparatory patch which modifies error handler to do per engine hang recovery. The actual patch which implements this sequence follows later in the series. The aim is to prepare existing recovery function to adapt to this new function where applicable (which fails at this point because core implementation is lacking) and continue recovery using legacy full gpu reset.

A helper function is also added to query the availability of engine reset. Engine reset and full gpu reset sections are also extracted to separate functions, it helps readability and branching between reset type simpler.

The error events behaviour that are used to notify user of reset are adapted to engine reset such that it doesn't break users listening to these events. In legacy we report an error event, a reset event before resetting the gpu and a reset done event marking the completion of reset. The same behaviour is adapted but reset event is only dispatched once even when multiple engines are hung. Finally once reset is complete we send reset done event as usual.

---
 drivers/gpu/drm/i915/i915_drv.c     |  23 +++++++
 drivers/gpu/drm/i915/i915_drv.h     |   2 +
 drivers/gpu/drm/i915/i915_irq.c     | 132 +++++++++++++++++++++++++++++++-----
 drivers/gpu/drm/i915/intel_uncore.c |   5 ++
 4 files changed, 144 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +23 -0
index fb72842..5c20e5d 100644
@@ -1816,6 +1816,29 @@ error:
 	return ret;
 }
 
+/**
+ * i915_reset_engine - reset GPU engine to recover from a hang
+ * @engine: engine to reset
+ *
+ * Reset a specific GPU engine. Useful if a hang is detected.
+ * Returns zero on successful reset or otherwise an error code.
+ *
+ * Procedure is fairly simple:
+ *  - force engine to idle
+ *  - save current state which includes head and current request
+ *  - reset engine
+ *  - restore saved state and resubmit context
+ */
+int i915_reset_engine(struct intel_engine_cs *engine)
+{
+	int ret;
+
+	/* FIXME: replace me with engine reset sequence */
+	ret = -ENODEV;
+
+	return ret;
+}
+
 static int i915_pm_suspend(struct device *dev)
 {
 	struct pci_dev *pdev = to_pci_dev(dev);
drivers/gpu/drm/i915/i915_drv.h +2 -0
index 125fafa..61e57a8b 100644
@@ -2836,6 +2836,8 @@ extern long i915_compat_ioctl(struct file *filp, unsigned int cmd,
 extern int intel_gpu_reset(struct drm_i915_private *dev_priv, u32 engine_mask);
 extern bool intel_has_gpu_reset(struct drm_i915_private *dev_priv);
 extern int i915_reset(struct drm_i915_private *dev_priv);
+extern bool intel_has_engine_reset(struct drm_i915_private *dev_priv);
+extern int i915_reset_engine(struct intel_engine_cs *engine);
 extern int intel_guc_reset(struct drm_i915_private *dev_priv);
 extern void intel_engine_init_hangcheck(struct intel_engine_cs *engine);
 extern unsigned long i915_chipset_val(struct drm_i915_private *dev_priv);
drivers/gpu/drm/i915/i915_irq.c +114 -18

177 lines not on this page · raw message

drivers/gpu/drm/i915/intel_uncore.c +5 -0
index 43f8339..418fd0d 100644
@@ -1775,6 +1775,11 @@ bool intel_has_gpu_reset(struct drm_i915_private *dev_priv)
 	return intel_get_gpu_reset(dev_priv) != NULL;
 }
 
+bool intel_has_engine_reset(struct drm_i915_private *dev_priv)
+{
+	return (INTEL_INFO(dev_priv)->gen >=8 && i915.reset == 2);
+}
+
 int intel_guc_reset(struct drm_i915_private *dev_priv)
 {
 	int ret;
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw

PATCH 5/11 drm/i915/tdr: Identify hung request and drop it

In reply to Arun Siluvery

The current active request is the one that caused the hang so this is retrieved and removed from elsp queue, otherwise we cannot submit other workloads to be processed by GPU.

A consistency check between HW and driver is performed to ensure that we are dropping the correct request. Since this request doesn't get executed anymore, we also need to advance the seqno to mark it as complete. Head pointer is advanced to skip the offending batch so that HW resumes execution other workloads. If HW and SW don't agree then we won't proceed with engine reset, this is treated as an error condition and we fallback to full gpu reset.

Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
---
 drivers/gpu/drm/i915/intel_lrc.c | 116 +++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_lrc.h |   2 +
 2 files changed, 118 insertions(+)
drivers/gpu/drm/i915/intel_lrc.c +116 -0
index daf1279..8fc5a3b 100644
@@ -1026,6 +1026,122 @@ void intel_lr_context_unpin(struct i915_gem_context *ctx,
 	i915_gem_context_put(ctx);
 }
 
+static void intel_lr_context_resync(struct i915_gem_context *ctx,
+				    struct intel_engine_cs *engine)
+{
+	u32 head;
+	u32 head_addr, tail_addr;
+	u32 *reg_state;
+	struct intel_ringbuffer *ringbuf;
+	struct drm_i915_private *dev_priv = engine->i915;
+
+	ringbuf = ctx->engine[engine->id].ringbuf;
+	reg_state = ctx->engine[engine->id].lrc_reg_state;
+
+	head = I915_READ_HEAD(engine);
+	head_addr = head & HEAD_ADDR;
+	tail_addr = reg_state[CTX_RING_TAIL+1] & TAIL_ADDR;
+
+	/*
+	 * force head it to advance to the next QWORD. In most cases the
+	 * engine head pointer will automatically advance to the next
+	 * instruction as soon as it has read the current instruction,
+	 * without waiting for it to complete. This seems to be the default
+	 * behaviour, however an MBOX wait inserted directly to the VCS/BCS
+	 * engines does not behave in the same way, instead the head
+	 * pointer will still be pointing at the MBOX instruction until it
+	 * completes.
+	 */
+	head_addr = roundup(head_addr, 8);
+
+	if (head_addr > tail_addr)
+		head_addr = tail_addr;
+	else if (head_addr >= ringbuf->size)
+		head_addr = 0;
+
+	head &= ~HEAD_ADDR;
+	head |= (head_addr & HEAD_ADDR);
+
+	/* update head in ctx */
+	reg_state[CTX_RING_HEAD+1] = head;
+	I915_WRITE_HEAD(engine, head);
+
+	ringbuf->head = head;
+	ringbuf->last_retired_head = -1;
+	intel_ring_update_space(ringbuf);
+}
+
+/**
+ * intel_execlists_reset_prepare() - identifies the request that is
+ * hung and drops it
+ *
+ * Head is adjusted to skip the batch that caused the hang
+ *
+ * @engine: Engine that is currently hung
+ *
+ * Returns:
+ *   0 - on success
+ *   nonzero errorcode otherwise
+ */
+int intel_execlists_reset_prepare(struct intel_engine_cs *engine)
+{
+	struct drm_i915_gem_request *req;
+	bool continue_with_reset;
+
+	spin_lock_bh(&engine->execlist_lock);
+
+	req = list_first_entry_or_null(&engine->execlist_queue,
+					    struct drm_i915_gem_request,
+					    execlist_link);
+
+	/*
+	 * Only acknowledge the request in the execlist queue if it's actually
+	 * been submitted to hardware, otherwise it cannot cause hang.
+	 */
+	if (req && req->ctx && req->elsp_submitted) {
+		u32 execlist_status;
+		u32 hw_context;
+		u32 hw_active;
+		struct drm_i915_private *dev_priv = engine->i915;
+
+		hw_context = I915_READ(RING_EXECLIST_STATUS_HI(engine));
+		execlist_status = I915_READ(RING_EXECLIST_STATUS_LO(engine));
+		hw_active = ((execlist_status & EXECLIST_STATUS_ELEMENT0_ACTIVE) ||
+			     (execlist_status & EXECLIST_STATUS_ELEMENT1_ACTIVE));
+
+		continue_with_reset = hw_active && hw_context == req->ctx->hw_id;
+		if (!continue_with_reset) {
+			DRM_ERROR("GPU hung when HW is not active !!\n");
+			goto unlock;
+		}
+
+		/*
+		 * GPU is now hung and the request that caused it
+		 * will be dropped so mark it as completed
+		 */
+		intel_write_status_page(engine, I915_GEM_HWS_INDEX, req->fence.seqno);
+
+		intel_lr_context_resync(req->ctx, engine);
+
+		/*
+		 * remove the request from the elsp queue so that
+		 * engine can resume execution after reset when new
+		 * requests are submitted
+		 */
+		if (!--req->elsp_submitted) {
+			list_del(&req->execlist_link);
+			i915_gem_request_put(req);
+		}
+	} else {
+		WARN(1, "GPU hang detected with no active request\n");
+		continue_with_reset = false;
+	}
+
+unlock:
+	spin_unlock_bh(&engine->execlist_lock);
+	return !continue_with_reset;
+}
+
 static int intel_logical_ring_workarounds_emit(struct drm_i915_gem_request *req)
 {
 	int ret, i;
drivers/gpu/drm/i915/intel_lrc.h +2 -0
index 3828730..1171ea1 100644
@@ -31,6 +31,8 @@
 /* Execlists regs */
 #define RING_ELSP(engine)			_MMIO((engine)->mmio_base + 0x230)
 #define RING_EXECLIST_STATUS_LO(engine)		_MMIO((engine)->mmio_base + 0x234)
+#define   EXECLIST_STATUS_ELEMENT0_ACTIVE       (1 << 14)
+#define   EXECLIST_STATUS_ELEMENT1_ACTIVE       (1 << 15)
 #define RING_EXECLIST_STATUS_HI(engine)		_MMIO((engine)->mmio_base + 0x234 + 4)
 #define RING_CONTEXT_CONTROL(engine)		_MMIO((engine)->mmio_base + 0x244)
 #define	  CTX_CTRL_INHIBIT_SYN_CTX_SWITCH	(1 << 3)
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

Re: [PATCH 05/11] drm/i915/tdr: Identify hung request and drop it

Quoted 33 lines · Arun Siluvery

The current active request is the one that caused the hang so this is retrieved and removed from elsp queue, otherwise we cannot submit other workloads to be processed by GPU.

A consistency check between HW and driver is performed to ensure that we are dropping the correct request. Since this request doesn't get executed anymore, we also need to advance the seqno to mark it as complete. Head pointer is advanced to skip the offending batch so that HW resumes execution other workloads. If HW and SW don't agree then we won't proceed with engine reset, this is treated as an error condition and we fallback to full gpu reset.

Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
---
 drivers/gpu/drm/i915/intel_lrc.c | 116 +++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_lrc.h |   2 +
 2 files changed, 118 insertions(+)
drivers/gpu/drm/i915/intel_lrc.c +5 -0
index daf1279..8fc5a3b 100644
@@ -1026,6 +1026,122 @@ void intel_lr_context_unpin(struct i915_gem_context *ctx,
 	i915_gem_context_put(ctx);
 }
 
+static void intel_lr_context_resync(struct i915_gem_context *ctx,
+				    struct intel_engine_cs *engine)
+{
+	u32 head;
+	u32 head_addr, tail_addr;

drivers/gpu/drm/i915/intel_lrc.c void intel_lr_context_unpin(struct i915_gem_context *ctx, · line 1043

Quoted 10 lines
drivers/gpu/drm/i915/intel_lrc.c +10 -0
+	u32 *reg_state;
+	struct intel_ringbuffer *ringbuf;
+	struct drm_i915_private *dev_priv = engine->i915;
+
+	ringbuf = ctx->engine[engine->id].ringbuf;
+	reg_state = ctx->engine[engine->id].lrc_reg_state;
+
+	head = I915_READ_HEAD(engine);
+	head_addr = head & HEAD_ADDR;
+	tail_addr = reg_state[CTX_RING_TAIL+1] & TAIL_ADDR;

?

We know where we want the head to be to emit the breadcrumb and complete the request since we can record that when constructing the request. That also neatly solves the riddle of how to update the hw state.

resync? intel_lr_context_reset_ring may be more apt, or maybe intel_execlists_reset_request?
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw

Re: [PATCH 05/11] drm/i915/tdr: Identify hung request and drop it

Quoted 47 lines · Chris Wilson
Quoted 33 lines · Arun Siluvery

The current active request is the one that caused the hang so this is retrieved and removed from elsp queue, otherwise we cannot submit other workloads to be processed by GPU.

A consistency check between HW and driver is performed to ensure that we are dropping the correct request. Since this request doesn't get executed anymore, we also need to advance the seqno to mark it as complete. Head pointer is advanced to skip the offending batch so that HW resumes execution other workloads. If HW and SW don't agree then we won't proceed with engine reset, this is treated as an error condition and we fallback to full gpu reset.

Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
---
  drivers/gpu/drm/i915/intel_lrc.c | 116 +++++++++++++++++++++++++++++++++++++++
  drivers/gpu/drm/i915/intel_lrc.h |   2 +
  2 files changed, 118 insertions(+)
drivers/gpu/drm/i915/intel_lrc.c +5 -0
index daf1279..8fc5a3b 100644
@@ -1026,6 +1026,122 @@ void intel_lr_context_unpin(struct i915_gem_context *ctx,
  	i915_gem_context_put(ctx);
  }
 
+static void intel_lr_context_resync(struct i915_gem_context *ctx,
+				    struct intel_engine_cs *engine)
+{
+	u32 head;
+	u32 head_addr, tail_addr;

drivers/gpu/drm/i915/intel_lrc.c void intel_lr_context_unpin(struct i915_gem_context *ctx, · line 1043

Quoted 10 lines
drivers/gpu/drm/i915/intel_lrc.c +10 -0
+	u32 *reg_state;
+	struct intel_ringbuffer *ringbuf;
+	struct drm_i915_private *dev_priv = engine->i915;
+
+	ringbuf = ctx->engine[engine->id].ringbuf;
+	reg_state = ctx->engine[engine->id].lrc_reg_state;
+
+	head = I915_READ_HEAD(engine);
+	head_addr = head & HEAD_ADDR;
+	tail_addr = reg_state[CTX_RING_TAIL+1] & TAIL_ADDR;

?

Quoted 3 lines

We know where we want the head to be to emit the breadcrumb and complete the request since we can record that when constructing the request. That also neatly solves the riddle of how to update the hw state.

We want to skip only MI_BATCH_BUFFER_START and continue as usual so just using existing info.

Quoted 3 lines

resync? intel_lr_context_reset_ring may be more apt, or maybe intel_execlists_reset_request?

resync because we read current state and update it. intel_execlists_reset_request() sounds better, will change it as suggested. thanks.

regards
Arun

Quoted 2 lines

-Chris

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#12 lore raw

Re: [PATCH 05/11] drm/i915/tdr: Identify hung request and drop it

Quoted 48 lines · Arun Siluvery
Quoted 47 lines · Chris Wilson
Quoted 33 lines · Arun Siluvery

The current active request is the one that caused the hang so this is retrieved and removed from elsp queue, otherwise we cannot submit other workloads to be processed by GPU.

A consistency check between HW and driver is performed to ensure that we are dropping the correct request. Since this request doesn't get executed anymore, we also need to advance the seqno to mark it as complete. Head pointer is advanced to skip the offending batch so that HW resumes execution other workloads. If HW and SW don't agree then we won't proceed with engine reset, this is treated as an error condition and we fallback to full gpu reset.

Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
---
 drivers/gpu/drm/i915/intel_lrc.c | 116 +++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_lrc.h |   2 +
 2 files changed, 118 insertions(+)
drivers/gpu/drm/i915/intel_lrc.c +5 -0
index daf1279..8fc5a3b 100644
@@ -1026,6 +1026,122 @@ void intel_lr_context_unpin(struct i915_gem_context *ctx,
 	i915_gem_context_put(ctx);
 }
 
+static void intel_lr_context_resync(struct i915_gem_context *ctx,
+				    struct intel_engine_cs *engine)
+{
+	u32 head;
+	u32 head_addr, tail_addr;

drivers/gpu/drm/i915/intel_lrc.c void intel_lr_context_unpin(struct i915_gem_context *ctx, · line 1043

Quoted 10 lines
drivers/gpu/drm/i915/intel_lrc.c +10 -0
+	u32 *reg_state;
+	struct intel_ringbuffer *ringbuf;
+	struct drm_i915_private *dev_priv = engine->i915;
+
+	ringbuf = ctx->engine[engine->id].ringbuf;
+	reg_state = ctx->engine[engine->id].lrc_reg_state;
+
+	head = I915_READ_HEAD(engine);
+	head_addr = head & HEAD_ADDR;
+	tail_addr = reg_state[CTX_RING_TAIL+1] & TAIL_ADDR;

?

Quoted 6 lines
Quoted 3 lines

We know where we want the head to be to emit the breadcrumb and complete the request since we can record that when constructing the request. That also neatly solves the riddle of how to update the hw state.

We want to skip only MI_BATCH_BUFFER_START and continue as usual so just using existing info.

That's exactly my point and why this approach is overkill since we aleady know where we need to resume from.
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#14 lore raw

PATCH 1/3 drm/i915: Record the position of the start of the request

Not only does it make for good documentation and debugging aide, but it is also vital for when we want to unwind requests - such as when throwing away an incomplete request.

v2: Rebase

---
 drivers/gpu/drm/i915/i915_drv.h         |  1 +
 drivers/gpu/drm/i915/i915_gem_request.c | 13 +++++++++----
 drivers/gpu/drm/i915/i915_gpu_error.c   |  6 ++++--
 3 files changed, 14 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
index 309000af003d..aacce6625f84 100644
@@ -557,6 +557,7 @@ struct drm_i915_error_state {
 		struct drm_i915_error_request {
 			long jiffies;
 			u32 seqno;
+			u32 head;
 			u32 tail;
 		} *requests;
 
drivers/gpu/drm/i915/i915_gem_request.c +9 -4
index 389a26429744..f50f25a27bd0 100644
@@ -393,6 +393,13 @@ i915_gem_request_alloc(struct intel_engine_cs *engine,
 	if (ret)
 		goto err_ctx;
 
+	/* Record the position of the start of the request so that
+	 * should we detect the updated seqno part-way through the
+	 * GPU processing the request, we never over-estimate the
+	 * position of the head.
+	 */
+	req->head = req->ring->tail;
+
 	return req;
 
 err_ctx:
@@ -469,8 +476,6 @@ void __i915_add_request(struct drm_i915_gem_request *request,
 
 	trace_i915_gem_request_add(request);
 
-	request->head = request_start;
-
 	/* Whilst this request exists, batch_obj will be on the
 	 * active_list, and so will hold the active reference. Only when this
 	 * request is retired will the the batch_obj be moved onto the
@@ -490,10 +495,10 @@ void __i915_add_request(struct drm_i915_gem_request *request,
 	list_add_tail(&request->link, &engine->request_list);
 	list_add_tail(&request->ring_link, &ring->request_list);
 
-	/* Record the position of the start of the request so that
+	/* Record the position of the start of the breadcrumb so that
 	 * should we detect the updated seqno part-way through the
 	 * GPU processing the request, we never over-estimate the
-	 * position of the head.
+	 * position of the ring's HEAD.
 	 */
 	request->postfix = ring->tail;
 
drivers/gpu/drm/i915/i915_gpu_error.c +4 -2
index cc28ad429dd8..b150147fc25b 100644
@@ -455,9 +455,10 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
 				   dev_priv->engine[i].name,
 				   ee->num_requests);
 			for (j = 0; j < ee->num_requests; j++) {
-				err_printf(m, "  seqno 0x%08x, emitted %ld, tail 0x%08x\n",
+				err_printf(m, "  seqno 0x%08x, emitted %ld, head 0x%08x tail 0x%08x\n",
 					   ee->requests[j].seqno,
 					   ee->requests[j].jiffies,
+					   ee->requests[j].head,
 					   ee->requests[j].tail);
 			}
 		}
@@ -1205,7 +1206,8 @@ static void i915_gem_record_rings(struct drm_i915_private *dev_priv,
 			erq = &ee->requests[count++];
 			erq->seqno = request->fence.seqno;
 			erq->jiffies = request->emitted_jiffies;
-			erq->tail = request->postfix;
+			erq->head = request->head;
+			erq->tail = request->tail;
 		}
 	}
 }
Signature · 6 lines
2.8.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#15 lore raw

PATCH 2/3 lrc

In reply to Chris Wilson
---
 drivers/gpu/drm/i915/i915_debugfs.c     |   2 +-
 drivers/gpu/drm/i915/i915_gem.c         |   6 +-
 drivers/gpu/drm/i915/i915_gem_request.h |  24 +-
 drivers/gpu/drm/i915/intel_lrc.c        | 416 +++++++++++---------------------
 drivers/gpu/drm/i915/intel_lrc.h        |   2 -
 drivers/gpu/drm/i915/intel_ringbuffer.h |   7 +-
 6 files changed, 151 insertions(+), 306 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +1 -1
index 920a2de95cd5..076c126ac08a 100644
@@ -2181,7 +2181,7 @@ static int i915_execlists(struct seq_file *m, void *data)
 		status_pointer = I915_READ(RING_CONTEXT_STATUS_PTR(engine));
 		seq_printf(m, "\tStatus pointer: 0x%08X\n", status_pointer);
 
-		read_pointer = engine->next_context_status_buffer;
+		read_pointer = GEN8_CSB_READ_PTR(status_pointer);
 		write_pointer = GEN8_CSB_WRITE_PTR(status_pointer);
 		if (read_pointer > write_pointer)
 			write_pointer += GEN8_CSB_ENTRIES;
drivers/gpu/drm/i915/i915_gem.c +5 -1
index bcfcc5af6b6e..f56fa8ac30bb 100644
@@ -2462,7 +2462,11 @@ static void i915_gem_reset_engine_cleanup(struct intel_engine_cs *engine)
 		/* Ensure irq handler finishes or is cancelled. */
 		tasklet_kill(&engine->irq_tasklet);
 
-		intel_execlists_cancel_requests(engine);
+		INIT_LIST_HEAD(&engine->execlist_queue);
+		i915_gem_request_assign(&engine->execlist_port[0].request,
+					NULL);
+		i915_gem_request_assign(&engine->execlist_port[1].request,
+					NULL);
 	}
 
 	/*
drivers/gpu/drm/i915/i915_gem_request.h +4 -20
index 3453df09befc..16dcf46bc6d0 100644
@@ -83,6 +83,9 @@ struct drm_i915_gem_request {
 	/** Position in the ringbuffer of the end of the whole request */
 	u32 tail;
 
+	/** Position in the ringbuffer after the end of the whole request */
+	u32 wa_tail;
+
 	/** Preallocate space in the ringbuffer for the emitting the request */
 	u32 reserved_space;
 
@@ -119,27 +122,8 @@ struct drm_i915_gem_request {
 	/** process identifier submitting this request */
 	struct pid *pid;
 
-	/**
-	 * The ELSP only accepts two elements at a time, so we queue
-	 * context/tail pairs on a given queue (ring->execlist_queue) until the
-	 * hardware is available. The queue serves a double purpose: we also use
-	 * it to keep track of the up to 2 contexts currently in the hardware
-	 * (usually one in execution and the other queued up by the GPU): We
-	 * only remove elements from the head of the queue when the hardware
-	 * informs us that an element has been completed.
-	 *
-	 * All accesses to the queue are mediated by a spinlock
-	 * (ring->execlist_lock).
-	 */
-
-	/** Execlist link in the submission queue.*/
+	/** Link in the execlist submission queue, guarded by execlist_lock. */
 	struct list_head execlist_link;
-
-	/** Execlists no. of times this request has been sent to the ELSP */
-	int elsp_submitted;
-
-	/** Execlists context hardware id. */
-	unsigned int ctx_hw_id;
 };
 
 extern const struct fence_ops i915_fence_ops;
drivers/gpu/drm/i915/intel_lrc.c +136 -280

531 lines not on this page · raw message

drivers/gpu/drm/i915/intel_lrc.h +0 -2
index a1d4e7f9c64c..a4b90834ecbd 100644
@@ -96,6 +96,4 @@ uint64_t intel_lr_context_descriptor(struct i915_gem_context *ctx,
 int intel_sanitize_enable_execlists(struct drm_i915_private *dev_priv,
 				    int enable_execlists);
 
-void intel_execlists_cancel_requests(struct intel_engine_cs *engine);
-
 #endif /* _INTEL_LRC_H_ */
drivers/gpu/drm/i915/intel_ringbuffer.h +5 -2
index c119e1dedbce..a5cee335881a 100644
@@ -287,11 +287,14 @@ struct intel_engine_cs {
 	/* Execlists */
 	struct tasklet_struct irq_tasklet;
 	spinlock_t execlist_lock; /* used inside tasklet, use spin_lock_bh */
+	struct execlist_port {
+		struct drm_i915_gem_request *request;
+		unsigned count;
+	} execlist_port[2];
 	struct list_head execlist_queue;
 	unsigned int fw_domains;
-	unsigned int next_context_status_buffer;
-	unsigned int idle_lite_restore_wa;
 	bool disable_lite_restore_wa;
+	bool preempt_wa;
 	u32 ctx_desc_template;
 
 	/**
Signature · 6 lines
2.8.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#16 lore raw

PATCH 3/3 reset-request-recovery

In reply to Chris Wilson
---
 drivers/gpu/drm/i915/i915_drv.c         |  4 +-
 drivers/gpu/drm/i915/i915_drv.h         |  2 +-
 drivers/gpu/drm/i915/i915_gem.c         | 66 +++++++++++++++++++++------------
 drivers/gpu/drm/i915/i915_gem_context.c | 16 --------
 drivers/gpu/drm/i915/intel_lrc.c        | 34 ++++++++++++++++-
 drivers/gpu/drm/i915/intel_ringbuffer.c | 32 ++++++++++------
 drivers/gpu/drm/i915/intel_ringbuffer.h |  2 +
 7 files changed, 100 insertions(+), 56 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +2 -2
index 869baa6a5196..d250dce0c8fb 100644
@@ -1574,7 +1574,7 @@ static int i915_drm_resume(struct drm_device *dev)
 	mutex_lock(&dev->struct_mutex);
 	if (i915_gem_init_hw(dev)) {
 		DRM_ERROR("failed to re-initialize GPU, declaring wedged!\n");
-		atomic_or(I915_WEDGED, &dev_priv->gpu_error.reset_counter);
+		i915_gem_set_wedged(dev_priv);
 	}
 	mutex_unlock(&dev->struct_mutex);
 
@@ -1798,7 +1798,7 @@ int i915_reset(struct drm_i915_private *dev_priv)
 	return 0;
 
 error:
-	atomic_or(I915_WEDGED, &error->reset_counter);
+	i915_gem_set_wedged(dev_priv);
 	mutex_unlock(&dev->struct_mutex);
 	return ret;
 }
drivers/gpu/drm/i915/i915_drv.h +1 -1
index aacce6625f84..08c212a5f1a8 100644
@@ -3224,6 +3224,7 @@ static inline u32 i915_reset_count(struct i915_gpu_error *error)
 }
 
 void i915_gem_reset(struct drm_device *dev);
+void i915_gem_set_wedged(struct drm_i915_private *dev_priv);
 bool i915_gem_clflush_object(struct drm_i915_gem_object *obj, bool force);
 int __must_check i915_gem_init(struct drm_device *dev);
 int __must_check i915_gem_init_hw(struct drm_device *dev);
@@ -3343,7 +3344,6 @@ void i915_gem_object_save_bit_17_swizzle(struct drm_i915_gem_object *obj);
 int __must_check i915_gem_context_init(struct drm_device *dev);
 void i915_gem_context_lost(struct drm_i915_private *dev_priv);
 void i915_gem_context_fini(struct drm_device *dev);
-void i915_gem_context_reset(struct drm_device *dev);
 int i915_gem_context_open(struct drm_device *dev, struct drm_file *file);
 void i915_gem_context_close(struct drm_device *dev, struct drm_file *file);
 int i915_switch_context(struct drm_i915_gem_request *req);
drivers/gpu/drm/i915/i915_gem.c +42 -24

107 lines not on this page · raw message

drivers/gpu/drm/i915/i915_gem_context.c +0 -16
index bb72af5320b0..a5b3ba4cca4a 100644
@@ -405,22 +405,6 @@ static void i915_gem_context_unpin(struct i915_gem_context *ctx,
 	}
 }
 
-void i915_gem_context_reset(struct drm_device *dev)
-{
-	struct drm_i915_private *dev_priv = to_i915(dev);
-
-	lockdep_assert_held(&dev->struct_mutex);
-
-	if (i915.enable_execlists) {
-		struct i915_gem_context *ctx;
-
-		list_for_each_entry(ctx, &dev_priv->context_list, link)
-			intel_lr_context_reset(dev_priv, ctx);
-	}
-
-	i915_gem_context_lost(dev_priv);
-}
-
 int i915_gem_context_init(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = to_i915(dev);
drivers/gpu/drm/i915/intel_lrc.c +33 -1
index 9be71a8a1d63..e24ce2d5cf90 100644
@@ -1193,6 +1193,7 @@ static int gen8_init_common_ring(struct intel_engine_cs *engine)
 {
 	struct drm_i915_private *dev_priv = engine->i915;
 
+	intel_mocs_init_engine(engine);
 	lrc_init_hws(engine);
 
 	I915_WRITE_IMR(engine,
@@ -1208,7 +1209,10 @@ static int gen8_init_common_ring(struct intel_engine_cs *engine)
 
 	intel_engine_init_hangcheck(engine);
 
-	return intel_mocs_init_engine(engine);
+	if (engine->execlist_port[0].request)
+		execlists_submit_ports(engine);
+
+	return 0;
 }
 
 static int gen8_init_render_ring(struct intel_engine_cs *engine)
@@ -1244,6 +1248,33 @@ static int gen9_init_render_ring(struct intel_engine_cs *engine)
 	return init_workarounds_ring(engine);
 }
 
+static void reset_common_ring(struct intel_engine_cs *engine,
+			      struct drm_i915_gem_request *request)
+{
+	struct drm_i915_private *dev_priv = engine->i915;
+	struct i915_gem_context *ctx = request->ctx;
+	struct intel_context *ce = &ctx->engine[engine->id];
+	u32 *reg_state;
+
+	reg_state = ce->lrc_reg_state;
+	reg_state[CTX_RING_HEAD+1] = request->postfix;
+
+	request->ring->head = request->postfix;
+	request->ring->last_retired_head = -1;
+	intel_ring_update_space(request->ring);
+
+	if (request == engine->execlist_port[1].request) {
+		i915_gem_request_put(engine->execlist_port[0].request);
+		engine->execlist_port[0] = engine->execlist_port[1];
+		memset(&engine->execlist_port[1], 0,
+		       sizeof(engine->execlist_port[1]));
+	}
+
+	engine->execlist_port[0].count = 0;
+
+	I915_WRITE(RING_CONTEXT_STATUS_PTR(engine), _MASKED_FIELD(0xffff, 0));
+}
+
 static int intel_logical_ring_emit_pdps(struct drm_i915_gem_request *req)
 {
 	struct i915_hw_ppgtt *ppgtt = req->ctx->ppgtt;
@@ -1604,6 +1635,7 @@ logical_ring_default_vfuncs(struct intel_engine_cs *engine)
 {
 	/* Default vfuncs which can be overriden by each engine. */
 	engine->init_hw = gen8_init_common_ring;
+	engine->reset_hw = reset_common_ring;
 	engine->emit_flush = gen8_emit_flush;
 	engine->emit_request = gen8_emit_request;
 	engine->submit_request = execlists_submit_request;
drivers/gpu/drm/i915/intel_ringbuffer.c +20 -12
index 54ec2faa0bf2..4730b1f178fd 100644
@@ -577,34 +577,31 @@ static int init_ring_common(struct intel_engine_cs *engine)
 	if (I915_READ_HEAD(engine))
 		DRM_DEBUG("%s initialization failed [head=%08x], fudging\n",
 			  engine->name, I915_READ_HEAD(engine));
-	I915_WRITE_HEAD(engine, 0);
-	(void)I915_READ_HEAD(engine);
+	I915_WRITE_HEAD(engine, ring->head);
+	I915_WRITE_TAIL(engine, ring->tail);
+	(void)I915_READ_TAIL(engine);
 
 	I915_WRITE_CTL(engine,
 			((ring->size - PAGE_SIZE) & RING_NR_PAGES)
 			| RING_VALID);
 
 	/* If the head is still not zero, the ring is dead */
-	if (wait_for((I915_READ_CTL(engine) & RING_VALID) != 0 &&
-		     I915_READ_START(engine) == i915_gem_obj_ggtt_offset(obj) &&
-		     (I915_READ_HEAD(engine) & HEAD_ADDR) == 0, 50)) {
+	if (intel_wait_for_register_fw(dev_priv, RING_CTL(engine->mmio_base),
+				       RING_VALID, RING_VALID,
+				       50)) {
 		DRM_ERROR("%s initialization failed "
-			  "ctl %08x (valid? %d) head %08x tail %08x start %08x [expected %08lx]\n",
+			  "ctl %08x (valid? %d) head %08x [%08x] tail %08x [%08x] start %08x [expected %08lx]\n",
 			  engine->name,
 			  I915_READ_CTL(engine),
 			  I915_READ_CTL(engine) & RING_VALID,
-			  I915_READ_HEAD(engine), I915_READ_TAIL(engine),
+			  I915_READ_HEAD(engine), ring->head,
+			  I915_READ_TAIL(engine), ring->tail,
 			  I915_READ_START(engine),
 			  (unsigned long)i915_gem_obj_ggtt_offset(obj));
 		ret = -EIO;
 		goto out;
 	}
 
-	ring->last_retired_head = -1;
-	ring->head = I915_READ_HEAD(engine);
-	ring->tail = I915_READ_TAIL(engine) & TAIL_ADDR;
-	intel_ring_update_space(ring);
-
 	intel_engine_init_hangcheck(engine);
 
 out:
@@ -613,6 +610,16 @@ out:
 	return ret;
 }
 
+static void reset_ring_common(struct intel_engine_cs *engine,
+			      struct drm_i915_gem_request *request)
+{
+	struct intel_ring *ring = request->ring;
+
+	ring->head = request->postfix;
+	ring->last_retired_head = -1;
+	intel_ring_update_space(ring);
+}
+
 void intel_fini_pipe_control(struct intel_engine_cs *engine)
 {
 	if (engine->scratch.obj == NULL)
@@ -2767,6 +2774,7 @@ static void intel_ring_default_vfuncs(struct drm_i915_private *dev_priv,
 	intel_ring_init_semaphores(dev_priv, engine);
 
 	engine->init_hw = init_ring_common;
+	engine->reset_hw = reset_ring_common;
 
 	engine->emit_request = i9xx_emit_request;
 	if (i915.semaphores)
drivers/gpu/drm/i915/intel_ringbuffer.h +2 -0
index a5cee335881a..092e5b27652f 100644
@@ -203,6 +203,8 @@ struct intel_engine_cs {
 	void		(*irq_disable)(struct intel_engine_cs *engine);
 
 	int		(*init_hw)(struct intel_engine_cs *engine);
+	void		(*reset_hw)(struct intel_engine_cs *engine,
+				    struct drm_i915_gem_request *req);
 
 	int		(*init_context)(struct drm_i915_gem_request *req);
 
Signature · 6 lines
2.8.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#17 lore raw

PATCH 6/11 drm/i915/tdr: Restart submission after engine reset

In reply to Arun Siluvery

We stop the engine during reset and recovery so after a successful reset the request that caused the hang would've been removed from the queue so we can now restart submissions to elsp.

---
 drivers/gpu/drm/i915/intel_lrc.c | 45 +++++++++++++++++++++++++++++++++++++---
 1 file changed, 42 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +42 -3
index 8fc5a3b..7834edc 100644
@@ -418,7 +418,8 @@ static inline void execlists_context_status_change(
 	atomic_notifier_call_chain(&rq->ctx->status_notifier, status, rq);
 }
 
-static void execlists_context_unqueue(struct intel_engine_cs *engine)
+static void execlists_context_unqueue(struct intel_engine_cs *engine,
+				      bool submission_after_reset)
 {
 	struct drm_i915_gem_request *req0 = NULL, *req1 = NULL;
 	struct drm_i915_gem_request *cursor, *tmp;
@@ -436,6 +437,27 @@ static void execlists_context_unqueue(struct intel_engine_cs *engine)
 				 execlist_link) {
 		if (!req0) {
 			req0 = cursor;
+
+			/*
+			 * we submit two requests at a time, req0 and req1.
+			 * Assume that req0 is the one that causes hang and
+			 * req1 is a normal batch.
+
+			 * After engine reset, once engine is
+			 * reinitialized, we skip req0 and submit req1
+			 * along with next request in the queue so we endup
+			 * incrementing req1->elsp_submitted again. But
+			 * after reset HW would've switched to req1 and
+			 * executed it so just this once, submit only req1
+			 * (which is req0 now) and don't increment
+			 * submission count. Once this is removed we submit
+			 * two requests as usual.
+			 */
+			if (submission_after_reset) {
+				if (req0->elsp_submitted)
+					req0->elsp_submitted--;
+				break;
+			}
 		} else if (req0->ctx == cursor->ctx) {
 			/* Same ctx: ignore first request, as second request
 			 * will update tail past first request's workload */
@@ -600,7 +622,7 @@ static void intel_lrc_irq_handler(unsigned long data)
 	if (submit_contexts) {
 		if (!engine->disable_lite_restore_wa ||
 		    (csb[i][0] & GEN8_CTX_STATUS_ACTIVE_IDLE))
-			execlists_context_unqueue(engine);
+			execlists_context_unqueue(engine, false);
 	}
 
 	spin_unlock(&engine->execlist_lock);
@@ -640,7 +662,7 @@ static void execlists_context_queue(struct drm_i915_gem_request *request)
 	list_add_tail(&request->execlist_link, &engine->execlist_queue);
 	request->ctx_hw_id = request->ctx->hw_id;
 	if (num_elements == 0)
-		execlists_context_unqueue(engine);
+		execlists_context_unqueue(engine, false);
 
 	spin_unlock_bh(&engine->execlist_lock);
 }
@@ -1142,6 +1164,23 @@ unlock:
 	return !continue_with_reset;
 }
 
+/**
+ * intel_execlists_restart_submission() - restarts elsp submissions after
+ * reset
+ *
+ * @engine: engine to be re-started
+ *
+ */
+void intel_execlists_restart_submission(struct intel_engine_cs *engine)
+{
+	spin_lock_bh(&engine->execlist_lock);
+
+	if (!list_empty(&engine->execlist_queue))
+		execlists_context_unqueue(engine, true);
+
+	spin_unlock_bh(&engine->execlist_lock);
+}
+
 static int intel_logical_ring_workarounds_emit(struct drm_i915_gem_request *req)
 {
 	int ret, i;
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#18 lore raw

Re: [PATCH 06/11] drm/i915/tdr: Restart submission after engine reset

Quoted 39 lines · Arun Siluvery

We stop the engine during reset and recovery so after a successful reset the request that caused the hang would've been removed from the queue so we can now restart submissions to elsp.

---
 drivers/gpu/drm/i915/intel_lrc.c | 45 +++++++++++++++++++++++++++++++++++++---
 1 file changed, 42 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +12 -1
index 8fc5a3b..7834edc 100644
@@ -418,7 +418,8 @@ static inline void execlists_context_status_change(
 	atomic_notifier_call_chain(&rq->ctx->status_notifier, status, rq);
 }
 
-static void execlists_context_unqueue(struct intel_engine_cs *engine)
+static void execlists_context_unqueue(struct intel_engine_cs *engine,
+				      bool submission_after_reset)
 {
 	struct drm_i915_gem_request *req0 = NULL, *req1 = NULL;
 	struct drm_i915_gem_request *cursor, *tmp;
@@ -436,6 +437,27 @@ static void execlists_context_unqueue(struct intel_engine_cs *engine)
 				 execlist_link) {
 		if (!req0) {
 			req0 = cursor;
+
+			/*
+			 * we submit two requests at a time, req0 and req1.
+			 * Assume that req0 is the one that causes hang and
+			 * req1 is a normal batch.
+
+			 * After engine reset, once engine is
+			 * reinitialized, we skip req0 and submit req1
+			 * along with next request in the queue so we endup
+			 * incrementing req1->elsp_submitted again. But

drivers/gpu/drm/i915/intel_lrc.c static void execlists_context_unqueue(struct intel_engine_cs *engine) · line 459

Quoted 10 lines
drivers/gpu/drm/i915/intel_lrc.c +10 -0
+			 * after reset HW would've switched to req1 and
+			 * executed it so just this once, submit only req1
+			 * (which is req0 now) and don't increment
+			 * submission count. Once this is removed we submit
+			 * two requests as usual.
+			 */
+			if (submission_after_reset) {
+				if (req0->elsp_submitted)
+					req0->elsp_submitted--;
+				break;

And no. Put the special case handling in the reset to cancel the submitted hw tracking and re-establish the request queue. -Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#19 lore raw

PATCH 7/11 drm/i915/tdr: Add support for per engine reset recovery

In reply to Arun Siluvery

This change implements support for per-engine reset as an initial, less intrusive hang recovery option to be attempted before falling back to the legacy full GPU reset recovery mode if necessary. This is only supported from Gen8 onwards.

Hangchecker determines which engines are hung and invokes error handler to recover from it. Error handler schedules recovery for each of those engines that are hung. The recovery procedure is as follows,
- force engine to idle: this is done by issuing a reset request
- identifies the request that caused the hang and it is dropped
- reset and re-init engine
- restart submissions to the engine

If engine reset fails then we fall back to heavy weight full gpu reset which resets all engines and reinitiazes complete state of HW and SW.

Possible reasons for failure,
- engine not ready for reset
- if the HW and SW doesn't agree on the context that caused the hang
- reset itself failed for some reason

---
 drivers/gpu/drm/i915/i915_drv.c     | 55 +++++++++++++++++++++++++++++++++----
 drivers/gpu/drm/i915/i915_drv.h     |  3 ++
 drivers/gpu/drm/i915/i915_gem.c     |  2 +-
 drivers/gpu/drm/i915/intel_lrc.h    |  4 +++
 drivers/gpu/drm/i915/intel_uncore.c | 33 ++++++++++++++++++++++
 5 files changed, 90 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +49 -6
index 5c20e5d..8151aa9 100644
@@ -1824,17 +1824,60 @@ error:
  * Returns zero on successful reset or otherwise an error code.
  *
  * Procedure is fairly simple:
- *  - force engine to idle
- *  - save current state which includes head and current request
- *  - reset engine
- *  - restore saved state and resubmit context
+ *    - force engine to idle: this is done by issuing a reset request
+ *    - identifies the request that caused the hang and it is retired
+ *    - reset engine
+ *    - restart submissions to the engine
  */
 int i915_reset_engine(struct intel_engine_cs *engine)
 {
+	struct drm_i915_private *dev_priv = engine->i915;
 	int ret;
 
-	/* FIXME: replace me with engine reset sequence */
-	ret = -ENODEV;
+	/* Ensure irq handler finishes or is cancelled. */
+	tasklet_kill(&engine->irq_tasklet);
+
+	i915_gem_reset_engine_status(engine);
+
+	/*Take wake lock to prevent power saving mode */
+	intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL);
+
+	ret = intel_request_for_reset(engine);
+	if (ret) {
+		DRM_ERROR("Failed to disable %s\n", engine->name);
+		goto out;
+	}
+
+	ret = intel_execlists_reset_prepare(engine);
+	if (ret)
+		goto enable_engine;
+
+	ret = intel_gpu_reset(dev_priv, intel_engine_flag(engine));
+	if (ret) {
+		DRM_ERROR("Failed to reset %s, ret=%d\n", engine->name, ret);
+		goto enable_engine;
+	}
+
+	ret = engine->init_hw(engine);
+	if (ret)
+		goto out;
+
+	/* Restart submissions to the engine after reset */
+	intel_execlists_restart_submission(engine);
+
+enable_engine:
+	/*
+	 * we only need to enable engine if we cannot prepare engine for
+	 * reset or reset fails. If the reset is successful, engine gets
+	 * enabled automatically so we can skip this step.
+	 */
+	if (ret)
+		intel_clear_reset_request(engine);
+
+out:
+	/* Wake up anything waiting on this engine's queue */
+	intel_engine_wakeup(engine);
+	intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
 
 	return ret;
 }
drivers/gpu/drm/i915/i915_drv.h +3 -0
index 61e57a8b..ac7a42c 100644
@@ -2837,6 +2837,8 @@ extern int intel_gpu_reset(struct drm_i915_private *dev_priv, u32 engine_mask);
 extern bool intel_has_gpu_reset(struct drm_i915_private *dev_priv);
 extern int i915_reset(struct drm_i915_private *dev_priv);
 extern bool intel_has_engine_reset(struct drm_i915_private *dev_priv);
+extern int intel_request_for_reset(struct intel_engine_cs *engine);
+extern int intel_clear_reset_request(struct intel_engine_cs *engine);
 extern int i915_reset_engine(struct intel_engine_cs *engine);
 extern int intel_guc_reset(struct drm_i915_private *dev_priv);
 extern void intel_engine_init_hangcheck(struct intel_engine_cs *engine);
@@ -3231,6 +3233,7 @@ static inline bool i915_engine_reset_in_progress(struct i915_gpu_error *error,
 }
 
 void i915_gem_reset(struct drm_device *dev);
+void i915_gem_reset_engine_status(struct intel_engine_cs *ring);
 bool i915_gem_clflush_object(struct drm_i915_gem_object *obj, bool force);
 int __must_check i915_gem_init(struct drm_device *dev);
 int __must_check i915_gem_init_hw(struct drm_device *dev);
drivers/gpu/drm/i915/i915_gem.c +1 -1
index 443570f..e34effb 100644
@@ -2468,7 +2468,7 @@ i915_gem_find_active_request(struct intel_engine_cs *engine)
 	return NULL;
 }
 
-static void i915_gem_reset_engine_status(struct intel_engine_cs *engine)
+void i915_gem_reset_engine_status(struct intel_engine_cs *engine)
 {
 	struct drm_i915_gem_request *request;
 	bool ring_hung;
drivers/gpu/drm/i915/intel_lrc.h +4 -0
index 1171ea1..4035f63 100644
@@ -132,4 +132,8 @@ int intel_execlists_submission(struct i915_execbuffer_params *params,
 
 void intel_execlists_cancel_requests(struct intel_engine_cs *engine);
 
+/* Engine reset */
+int intel_execlists_reset_prepare(struct intel_engine_cs *engine);
+void intel_execlists_restart_submission(struct intel_engine_cs *engine);
+
 #endif /* _INTEL_LRC_H_ */
drivers/gpu/drm/i915/intel_uncore.c +33 -0
index 418fd0d..d807871 100644
@@ -1799,6 +1799,39 @@ int intel_guc_reset(struct drm_i915_private *dev_priv)
 	return ret;
 }
 
+/*
+ * On gen8+ a reset request has to be issued via the reset control register
+ * before a GPU engine can be reset in order to stop the command streamer
+ * and idle the engine. This replaces the legacy way of stopping an engine
+ * by writing to the stop ring bit in the MI_MODE register.
+ */
+int intel_request_for_reset(struct intel_engine_cs *engine)
+{
+	if (!intel_has_engine_reset(engine->i915)) {
+		DRM_ERROR("Engine Reset not supported on Gen%d\n",
+			  INTEL_INFO(engine->i915)->gen);
+		return -EINVAL;
+	}
+
+	return gen8_request_engine_reset(engine);
+}
+
+/*
+ * It is possible to back off from a previously issued reset request by simply
+ * clearing the reset request bit in the reset control register.
+ */
+int intel_clear_reset_request(struct intel_engine_cs *engine)
+{
+	if (!intel_has_engine_reset(engine->i915)) {
+		DRM_ERROR("Request to clear reset not supported on Gen%d\n",
+			  INTEL_INFO(engine->i915)->gen);
+		return -EINVAL;
+	}
+
+	gen8_unrequest_engine_reset(engine);
+	return 0;
+}
+
 bool intel_uncore_unclaimed_mmio(struct drm_i915_private *dev_priv)
 {
 	return check_for_unclaimed_mmio(dev_priv);
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#20 lore raw

Re: [PATCH 07/11] drm/i915/tdr: Add support for per engine reset recovery

Quoted 51 lines · Arun Siluvery

This change implements support for per-engine reset as an initial, less intrusive hang recovery option to be attempted before falling back to the legacy full GPU reset recovery mode if necessary. This is only supported from Gen8 onwards.

Hangchecker determines which engines are hung and invokes error handler to recover from it. Error handler schedules recovery for each of those engines that are hung. The recovery procedure is as follows,
- force engine to idle: this is done by issuing a reset request
- identifies the request that caused the hang and it is dropped
- reset and re-init engine
- restart submissions to the engine

If engine reset fails then we fall back to heavy weight full gpu reset which resets all engines and reinitiazes complete state of HW and SW.

Possible reasons for failure,
- engine not ready for reset
- if the HW and SW doesn't agree on the context that caused the hang
- reset itself failed for some reason

---
 drivers/gpu/drm/i915/i915_drv.c     | 55 +++++++++++++++++++++++++++++++++----
 drivers/gpu/drm/i915/i915_drv.h     |  3 ++
 drivers/gpu/drm/i915/i915_gem.c     |  2 +-
 drivers/gpu/drm/i915/intel_lrc.h    |  4 +++
 drivers/gpu/drm/i915/intel_uncore.c | 33 ++++++++++++++++++++++
 5 files changed, 90 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +4 -4
index 5c20e5d..8151aa9 100644
@@ -1824,17 +1824,60 @@ error:
  * Returns zero on successful reset or otherwise an error code.
  *
  * Procedure is fairly simple:
- *  - force engine to idle
- *  - save current state which includes head and current request
- *  - reset engine
- *  - restore saved state and resubmit context
+ *    - force engine to idle: this is done by issuing a reset request
+ *    - identifies the request that caused the hang and it is retired
+ *    - reset engine
+ *    - restart submissions to the engine
  */
 int i915_reset_engine(struct intel_engine_cs *engine)

drivers/gpu/drm/i915/i915_drv.c error: · line 1840

Quoted 10 lines
drivers/gpu/drm/i915/i915_drv.c +5 -2
 {
+	struct drm_i915_private *dev_priv = engine->i915;
 	int ret;
 
-	/* FIXME: replace me with engine reset sequence */
-	ret = -ENODEV;
+	/* Ensure irq handler finishes or is cancelled. */
+	tasklet_kill(&engine->irq_tasklet);
+
+	i915_gem_reset_engine_status(engine);

Not yet safe to be used lockless.

drivers/gpu/drm/i915/i915_drv.c error: · line 1842

Quoted 1 line
drivers/gpu/drm/i915/i915_drv.c +1 -0
+	/*Take wake lock to prevent power saving mode */

Why else would you be taking it? We know the wakelock prevents the GT power well disappearing, the question is why is that important now across the entirety of this sequence? That's what you explain in comments.

Quoted 14 lines
drivers/gpu/drm/i915/i915_drv.c +14 -0
+	intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL);
+
+	ret = intel_request_for_reset(engine);
+	if (ret) {
+		DRM_ERROR("Failed to disable %s\n", engine->name);
+		goto out;
+	}
+
+	ret = intel_execlists_reset_prepare(engine);
+	if (ret)
+		goto enable_engine;
+
+	ret = intel_gpu_reset(dev_priv, intel_engine_flag(engine));
+	if (ret) {

drivers/gpu/drm/i915/i915_drv.c error: · line 1866

Quoted 10 lines
drivers/gpu/drm/i915/i915_drv.c +10 -0
+		DRM_ERROR("Failed to reset %s, ret=%d\n", engine->name, ret);
+		goto enable_engine;
+	}
+
+	ret = engine->init_hw(engine);
+	if (ret)
+		goto out;
+
+	/* Restart submissions to the engine after reset */
+	intel_execlists_restart_submission(engine);

Clumsy. See above as we already have an entry point that can initiate the hw.

drivers/gpu/drm/i915/i915_drv.c error: · line 1874

Quoted 7 lines
drivers/gpu/drm/i915/i915_drv.c +7 -0
+enable_engine:
+	/*
+	 * we only need to enable engine if we cannot prepare engine for
+	 * reset or reset fails. If the reset is successful, engine gets
+	 * enabled automatically so we can skip this step.
+	 */
+	if (ret)

Then why is the normal path coming through here?

drivers/gpu/drm/i915/i915_drv.c error: · line 1879

Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.c +5 -0
+		intel_clear_reset_request(engine);
+
+out:
+	/* Wake up anything waiting on this engine's queue */
+	intel_engine_wakeup(engine);

? Random call with incorrect locking. What do you think you are achieving here because it's not what the comment implies.

drivers/gpu/drm/i915/i915_drv.c error:

Quoted 11 lines
drivers/gpu/drm/i915/i915_drv.c +8 -0
+	intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
 
 	return ret;
 }
+/*
+ * On gen8+ a reset request has to be issued via the reset control register
+ * before a GPU engine can be reset in order to stop the command streamer
+ * and idle the engine. This replaces the legacy way of stopping an engine
+ * by writing to the stop ring bit in the MI_MODE register.
+ */
+int intel_request_for_reset(struct intel_engine_cs *engine)

intel_engine_reset_begin()

It would be preferrable if we can avoid using request here as we are talking about reseting the hung request elsewhere in this chain.

drivers/gpu/drm/i915/i915_drv.c

Quoted 4 lines
drivers/gpu/drm/i915/i915_drv.c +4 -0
+{
+	if (!intel_has_engine_reset(engine->i915)) {
+		DRM_ERROR("Engine Reset not supported on Gen%d\n",
+			  INTEL_INFO(engine->i915)->gen);

ERROR?

drivers/gpu/drm/i915/i915_drv.c

Quoted 1 line
drivers/gpu/drm/i915/i915_drv.c +1 -0
+		return -EINVAL;

return -ENODEV;

drivers/gpu/drm/i915/i915_drv.c

Quoted 4 lines
drivers/gpu/drm/i915/i915_drv.c +4 -0
+	}
+
+	return gen8_request_engine_reset(engine);
+}

gen8_engine_reset_begin()

drivers/gpu/drm/i915/i915_drv.c

Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.c +5 -0
+/*
+ * It is possible to back off from a previously issued reset request by simply
+ * clearing the reset request bit in the reset control register.
+ */
+int intel_clear_reset_request(struct intel_engine_cs *engine)

intel_engine_reset_cancel()

drivers/gpu/drm/i915/i915_drv.c

Quoted 9 lines
drivers/gpu/drm/i915/i915_drv.c +9 -0
+{
+{
+	if (!intel_has_engine_reset(engine->i915)) {
+		DRM_ERROR("Request to clear reset not supported on Gen%d\n",
+			  INTEL_INFO(engine->i915)->gen);
+		return -EINVAL;
+	}
+
+	gen8_unrequest_engine_reset(engine);

gen8_engine_reset_cancel()

(only suggestions for avoiding having confusion over requests)

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#21 lore raw

Re: [PATCH 07/11] drm/i915/tdr: Add support for per engine reset recovery

Quoted 56 lines · Chris Wilson
Quoted 55 lines · Arun Siluvery

This change implements support for per-engine reset as an initial, less intrusive hang recovery option to be attempted before falling back to the legacy full GPU reset recovery mode if necessary. This is only supported from Gen8 onwards.

Hangchecker determines which engines are hung and invokes error handler to recover from it. Error handler schedules recovery for each of those engines that are hung. The recovery procedure is as follows,
- force engine to idle: this is done by issuing a reset request
- identifies the request that caused the hang and it is dropped
- reset and re-init engine
- restart submissions to the engine

If engine reset fails then we fall back to heavy weight full gpu reset which resets all engines and reinitiazes complete state of HW and SW.

Possible reasons for failure,
- engine not ready for reset
- if the HW and SW doesn't agree on the context that caused the hang
- reset itself failed for some reason

---
  drivers/gpu/drm/i915/i915_drv.c     | 55 +++++++++++++++++++++++++++++++++----
  drivers/gpu/drm/i915/i915_drv.h     |  3 ++
  drivers/gpu/drm/i915/i915_gem.c     |  2 +-
  drivers/gpu/drm/i915/intel_lrc.h    |  4 +++
  drivers/gpu/drm/i915/intel_uncore.c | 33 ++++++++++++++++++++++
  5 files changed, 90 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +5 -4
index 5c20e5d..8151aa9 100644
@@ -1824,17 +1824,60 @@ error:
   * Returns zero on successful reset or otherwise an error code.
   *
   * Procedure is fairly simple:
- *  - force engine to idle
- *  - save current state which includes head and current request
- *  - reset engine
- *  - restore saved state and resubmit context
+ *    - force engine to idle: this is done by issuing a reset request
+ *    - identifies the request that caused the hang and it is retired
+ *    - reset engine
+ *    - restart submissions to the engine
   */
  int i915_reset_engine(struct intel_engine_cs *engine)
  {
+	struct drm_i915_private *dev_priv = engine->i915;
  	int ret;
 
Quoted 9 lines

drivers/gpu/drm/i915/i915_drv.c error: · line 1840

Quoted 6 lines
drivers/gpu/drm/i915/i915_drv.c +4 -2
-	/* FIXME: replace me with engine reset sequence */
-	ret = -ENODEV;
+	/* Ensure irq handler finishes or is cancelled. */
+	tasklet_kill(&engine->irq_tasklet);
+
+	i915_gem_reset_engine_status(engine);

Not yet safe to be used lockless.

engine is hung and intel_lrc_irq_handler() also won't be running at this point and we should've received all seqno updates, is it still not safe? do I really need struct_mutex for this? only caller is i915_gem_reset() and it takes it.

Quoted 7 lines

drivers/gpu/drm/i915/i915_drv.c error: · line 1842

Quoted 1 line
drivers/gpu/drm/i915/i915_drv.c +1 -0
+	/*Take wake lock to prevent power saving mode */

Why else would you be taking it? We know the wakelock prevents the GT power well disappearing, the question is why is that important now across the entirety of this sequence? That's what you explain in comments.

yes, not useful. It is carried over from initial patch but I agree I should've updated this.

Quoted 19 lines
Quoted 19 lines
drivers/gpu/drm/i915/i915_drv.c +19 -0
+	intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL);
+
+	ret = intel_request_for_reset(engine);
+	if (ret) {
+		DRM_ERROR("Failed to disable %s\n", engine->name);
+		goto out;
+	}
+
+	ret = intel_execlists_reset_prepare(engine);
+	if (ret)
+		goto enable_engine;
+
+	ret = intel_gpu_reset(dev_priv, intel_engine_flag(engine));
+	if (ret) {
+		DRM_ERROR("Failed to reset %s, ret=%d\n", engine->name, ret);
+		goto enable_engine;
+	}
+
+	ret = engine->init_hw(engine);
Quoted 9 lines

drivers/gpu/drm/i915/i915_drv.c error: · line 1866

Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.c +5 -0
+	if (ret)
+		goto out;
+
+	/* Restart submissions to the engine after reset */
+	intel_execlists_restart_submission(engine);

Clumsy. See above as we already have an entry point that can initiate the hw.

I think this is a separate step from init_hw().
In init_hw() we initialize hw state and keep it ready then we feed submissions.

Quoted 10 lines

drivers/gpu/drm/i915/i915_drv.c error: · line 1874

Quoted 7 lines
drivers/gpu/drm/i915/i915_drv.c +7 -0
+enable_engine:
+	/*
+	 * we only need to enable engine if we cannot prepare engine for
+	 * reset or reset fails. If the reset is successful, engine gets
+	 * enabled automatically so we can skip this step.
+	 */
+	if (ret)

Then why is the normal path coming through here?

Quoted 2 lines

drivers/gpu/drm/i915/i915_drv.c error: · line 1876

Quoted 2 lines
drivers/gpu/drm/i915/i915_drv.c +2 -0
+		intel_clear_reset_request(engine);
+

there is no harm in doing this even when reset is successful, hence included in the normal path. I will remove ret check to avoid confusion.

Quoted 6 lines

drivers/gpu/drm/i915/i915_drv.c error: · line 1879

Quoted 3 lines
drivers/gpu/drm/i915/i915_drv.c +3 -0
+out:
+	/* Wake up anything waiting on this engine's queue */
+	intel_engine_wakeup(engine);

? Random call with incorrect locking. What do you think you are achieving here because it's not what the comment implies.

sorry, I will come back on this one, I need to better understand few more things.

Quoted 15 lines

drivers/gpu/drm/i915/i915_drv.c error:

Quoted 12 lines
drivers/gpu/drm/i915/i915_drv.c +8 -0
+	intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
 
  	return ret;
  }
+/*
+ * On gen8+ a reset request has to be issued via the reset control register
+ * before a GPU engine can be reset in order to stop the command streamer
+ * and idle the engine. This replaces the legacy way of stopping an engine
+ * by writing to the stop ring bit in the MI_MODE register.
+ */
+int intel_request_for_reset(struct intel_engine_cs *engine)

intel_engine_reset_begin()

Quoted 3 lines

It would be preferrable if we can avoid using request here as we are talking about reseting the hung request elsewhere in this chain.

the term request is overloaded but here infact we are actually requesting the hw to prepare for reset and wait for it to acknowledge.

intel_engine_reset_begin() sounds fine.

Quoted 6 lines

drivers/gpu/drm/i915/i915_drv.c

Quoted 4 lines
drivers/gpu/drm/i915/i915_drv.c +4 -0
+{
+	if (!intel_has_engine_reset(engine->i915)) {
+		DRM_ERROR("Engine Reset not supported on Gen%d\n",
+			  INTEL_INFO(engine->i915)->gen);

ERROR?

This msg is probably unnecessary as we go for engine reset only when it is available.

Quoted 3 lines

drivers/gpu/drm/i915/i915_drv.c

Quoted 2 lines
drivers/gpu/drm/i915/i915_drv.c +1 -0
+		return -EINVAL;

return -ENODEV;

ok.

Quoted 28 lines

drivers/gpu/drm/i915/i915_drv.c

Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.c +4 -0
+	}
+
+	return gen8_request_engine_reset(engine);
+}

gen8_engine_reset_begin()

drivers/gpu/drm/i915/i915_drv.c

Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.c +5 -0
+/*
+ * It is possible to back off from a previously issued reset request by simply
+ * clearing the reset request bit in the reset control register.
+ */
+int intel_clear_reset_request(struct intel_engine_cs *engine)

intel_engine_reset_cancel()

drivers/gpu/drm/i915/i915_drv.c

Quoted 9 lines
drivers/gpu/drm/i915/i915_drv.c +9 -0
+{
+{
+	if (!intel_has_engine_reset(engine->i915)) {
+		DRM_ERROR("Request to clear reset not supported on Gen%d\n",
+			  INTEL_INFO(engine->i915)->gen);
+		return -EINVAL;
+	}
+
+	gen8_unrequest_engine_reset(engine);

gen8_engine_reset_cancel()

Quoted 1 line

(only suggestions for avoiding having confusion over requests)

ok, thanks for the renaming suggestions.

regards
Arun

Quoted 2 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#22 lore raw

PATCH 8/11 drm/i915: Skip reset request if there is one already

In reply to Arun Siluvery

From: Mika Kuoppala <[email protected]>

To perform engine reset we first disable engine to capture its state. This is done by issuing a reset request. Because we are reusing existing infrastructure, again when we actually reset an engine, reset function checks engine mask and issues reset request again which is unnecessary. To avoid this we check if the engine is already prepared, if so we just exit from that point.

---
 drivers/gpu/drm/i915/intel_uncore.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +7 -2
index d807871..0ad0b7f 100644
@@ -1686,10 +1686,15 @@ int intel_wait_for_register(struct drm_i915_private *dev_priv,
 static int gen8_request_engine_reset(struct intel_engine_cs *engine)
 {
 	struct drm_i915_private *dev_priv = engine->i915;
+	const i915_reg_t reset_ctrl = RING_RESET_CTL(engine->mmio_base);
+	const u32 ready = RESET_CTL_REQUEST_RESET | RESET_CTL_READY_TO_RESET;
 	int ret;
 
-	I915_WRITE_FW(RING_RESET_CTL(engine->mmio_base),
-		      _MASKED_BIT_ENABLE(RESET_CTL_REQUEST_RESET));
+	/* If engine has been already prepared, we can shortcut here */
+	if ((I915_READ_FW(reset_ctrl) & ready) == ready)
+		return 0;
+
+	I915_WRITE_FW(reset_ctrl, _MASKED_BIT_ENABLE(RESET_CTL_REQUEST_RESET));
 
 	ret = intel_wait_for_register_fw(dev_priv,
 					 RING_RESET_CTL(engine->mmio_base),
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#23 lore raw

PATCH 9/11 drm/i915/tdr: Add engine reset count to error state

In reply to Arun Siluvery

Driver maintains count of how many times a given engine is reset, useful to capture this in error state also. It gives an idea of how engine is coping up with the workloads it is executing before this error state.

---
 drivers/gpu/drm/i915/i915_drv.h       | 7 +++++++
 drivers/gpu/drm/i915/i915_gpu_error.c | 3 +++
 2 files changed, 10 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +7 -0
index ac7a42c..654bbcc 100644
@@ -520,6 +520,7 @@ struct drm_i915_error_state {
 		int hangcheck_score;
 		enum intel_ring_hangcheck_action hangcheck_action;
 		int num_requests;
+		u32 reset_count;
 
 		/* our own tracking of ring head and tail */
 		u32 cpu_ring_head;
@@ -3232,6 +3233,12 @@ static inline bool i915_engine_reset_in_progress(struct i915_gpu_error *error,
 	return test_bit(engine->id + 1, &error->flags);
 }
 
+static inline u32 i915_engine_reset_count(struct i915_gpu_error *error,
+					  struct intel_engine_cs *engine)
+{
+	return READ_ONCE(error->engine_reset_count[engine->id]);
+}
+
 void i915_gem_reset(struct drm_device *dev);
 void i915_gem_reset_engine_status(struct intel_engine_cs *ring);
 bool i915_gem_clflush_object(struct drm_i915_gem_object *obj, bool force);
drivers/gpu/drm/i915/i915_gpu_error.c +3 -0
index 4d39c72..ea14b4c 100644
@@ -303,6 +303,7 @@ static void i915_ring_error_state(struct drm_i915_error_state_buf *m,
 	err_printf(m, "  hangcheck: %s [%d]\n",
 		   hangcheck_action_to_str(ring->hangcheck_action),
 		   ring->hangcheck_score);
+	err_printf(m, "  engine reset count: %u\n", ring->reset_count);
 }
 
 void i915_error_printf(struct drm_i915_error_state_buf *e, const char *f, ...)
@@ -1022,6 +1023,8 @@ static void i915_record_ring_state(struct drm_i915_private *dev_priv,
 
 	ering->hangcheck_score = engine->hangcheck.score;
 	ering->hangcheck_action = engine->hangcheck.action;
+	ering->reset_count = i915_engine_reset_count(&dev_priv->gpu_error,
+						     engine);
 
 	if (USES_PPGTT(dev_priv)) {
 		int i;
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#24 lore raw

PATCH 10/11 drm/i915/tdr: Export reset count info to debugfs

In reply to Arun Siluvery

A new variable is added to export the reset counts to debugfs, this includes full gpu reset and engine reset count. This is useful for tests where they areexpected to trigger reset; these counts are checked before and after the test to ensure the same.

---
 drivers/gpu/drm/i915/i915_debugfs.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +19 -0
index 9aa62c5..853da76 100644
@@ -1470,6 +1470,24 @@ static int i915_hangcheck_info(struct seq_file *m, void *unused)
 	return 0;
 }
 
+static int i915_reset_info(struct seq_file *m, void *unused)
+{
+	struct drm_info_node *node = m->private;
+	struct drm_device *dev = node->minor->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct i915_gpu_error *error = &dev_priv->gpu_error;
+	struct intel_engine_cs *engine;
+
+	seq_printf(m, "full gpu reset = %u\n", i915_reset_count(error));
+
+	for_each_engine(engine, dev_priv) {
+		seq_printf(m, "%s = %u\n", engine->name,
+			   i915_engine_reset_count(error, engine));
+	}
+
+	return 0;
+}
+
 static int ironlake_drpc_info(struct seq_file *m)
 {
 	struct drm_info_node *node = m->private;
@@ -5379,6 +5397,7 @@ static const struct drm_info_list i915_debugfs_list[] = {
 	{"i915_guc_log_dump", i915_guc_log_dump, 0},
 	{"i915_frequency_info", i915_frequency_info, 0},
 	{"i915_hangcheck_info", i915_hangcheck_info, 0},
+	{"i915_reset_info", i915_reset_info, 0},
 	{"i915_drpc_info", i915_drpc_info, 0},
 	{"i915_emon_status", i915_emon_status, 0},
 	{"i915_ring_freq_table", i915_ring_freq_table, 0},
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#25 lore raw

PATCH 11/11 drm/i915/tdr: Enable Engine reset and recovery support

In reply to Arun Siluvery

Everything in place, flip the switch.

This feature is available only from Gen8, for previous gen devices driver falls back to legacy full gpu reset.

---
 drivers/gpu/drm/i915/i915_params.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_params.c +2 -2
index a96df81..dab6fc3 100644
@@ -45,7 +45,7 @@ struct i915_params i915 __read_mostly = {
 	.fastboot = 0,
 	.prefault_disable = 0,
 	.load_detect_test = 0,
-	.reset = 1,
+	.reset = 2,
 	.invert_brightness = 0,
 	.disable_display = 0,
 	.enable_cmd_parser = 1,
@@ -112,7 +112,7 @@ MODULE_PARM_DESC(vbt_sdvo_panel_type,
 	"(-2=ignore, -1=auto [default], index in VBT BIOS table)");
 
 module_param_named_unsafe(reset, i915.reset, int, 0600);
-MODULE_PARM_DESC(reset, "Attempt GPU resets (0=disabled, 1=full gpu reset [default], 2=engine reset)");
+MODULE_PARM_DESC(reset, "Attempt GPU resets (0=disabled, 1=full gpu reset, 2=engine reset [default])");
 
 module_param_named_unsafe(enable_hangcheck, i915.enable_hangcheck, bool, 0644);
 MODULE_PARM_DESC(enable_hangcheck,
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#26 lore raw

✗ Ro.CI.BAT: failure for Execlist based Engine reset patches

In reply to Arun Siluvery
== Series Details ==

== Series Details ==

Series: Execlist based Engine reset patches
URL : https://patchwork.freedesktop.org/series/10283/
State : failure

== Summary ==

Series 10283v1 Execlist based Engine reset patches
http://patchwork.freedesktop.org/api/1.0/series/10283/revisions/1/mbox

Test drv_hangman:

        Subgroup error-state-basic:
                pass       -> DMESG-WARN (ro-bdw-i7-5600u)
Test gem_exec_gttfill:
        Subgroup basic:
                pass       -> SKIP       (fi-snb-i7-2600)
Test gem_ringfill:
        Subgroup basic-default-hang:
                pass       -> DMESG-WARN (ro-bdw-i7-5600u)
Test kms_cursor_legacy:
        Subgroup basic-cursor-vs-flip-legacy:
                fail       -> PASS       (ro-ilk1-i5-650)
        Subgroup basic-flip-vs-cursor-legacy:
                fail       -> PASS       (ro-hsw-i7-4770r)
                fail       -> PASS       (ro-byt-n2820)
                fail       -> DMESG-FAIL (ro-skl3-i5-6260u)
        Subgroup basic-flip-vs-cursor-varying-size:
                pass       -> FAIL       (ro-snb-i7-2620M)
                fail       -> PASS       (ro-bdw-i5-5250u)
Test kms_pipe_crc_basic:
        Subgroup hang-read-crc-pipe-a:
                pass       -> DMESG-WARN (ro-bdw-i7-5600u)
        Subgroup hang-read-crc-pipe-b:
                pass       -> DMESG-WARN (ro-bdw-i7-5600u)
        Subgroup hang-read-crc-pipe-c:
                pass       -> DMESG-WARN (ro-bdw-i7-5600u)
fi-hsw-i7-4770k  total:235  pass:215  dwarn:0   dfail:0   fail:0   skip:20 
fi-kbl-qkkr      total:235  pass:180  dwarn:28  dfail:1   fail:0   skip:26 
fi-skl-i5-6260u  total:235  pass:223  dwarn:0   dfail:0   fail:0   skip:12 
fi-skl-i7-6700k  total:235  pass:209  dwarn:0   dfail:0   fail:0   skip:26 
fi-snb-i7-2600   total:235  pass:194  dwarn:0   dfail:0   fail:0   skip:41 
ro-bdw-i5-5250u  total:239  pass:218  dwarn:4   dfail:0   fail:1   skip:16 
ro-bdw-i7-5600u  total:239  pass:201  dwarn:5   dfail:0   fail:1   skip:32 
ro-bsw-n3050     total:239  pass:193  dwarn:0   dfail:0   fail:4   skip:42 
ro-byt-n2820     total:239  pass:196  dwarn:0   dfail:0   fail:3   skip:40 
ro-hsw-i3-4010u  total:239  pass:213  dwarn:0   dfail:0   fail:0   skip:26 
ro-hsw-i7-4770r  total:239  pass:213  dwarn:0   dfail:0   fail:0   skip:26 
ro-ilk1-i5-650   total:234  pass:172  dwarn:0   dfail:0   fail:2   skip:60 
ro-ivb-i7-3770   total:239  pass:204  dwarn:0   dfail:0   fail:0   skip:35 
ro-ivb2-i7-3770  total:239  pass:208  dwarn:0   dfail:0   fail:0   skip:31 
ro-skl3-i5-6260u total:239  pass:223  dwarn:0   dfail:1   fail:1   skip:14 
ro-snb-i7-2620M  total:239  pass:196  dwarn:0   dfail:0   fail:2   skip:41 

ro-bdw-i7-5557U failed to connect after reboot

Results at /archive/results/CI_IGT_test/RO_Patchwork_1613/

819b812 drm-intel-nightly: 2016y-07m-26d-14h-26m-25s UTC integration manifest e3836e9 drm/i915/tdr: Enable Engine reset and recovery support 5659355 drm/i915/tdr: Export reset count info to debugfs
6fadd07 drm/i915/tdr: Add engine reset count to error state 6a15b51 drm/i915: Skip reset request if there is one already 5342eeb drm/i915/tdr: Add support for per engine reset recovery 1143c7d drm/i915/tdr: Restart submission after engine reset d864b8a drm/i915/tdr: Identify hung request and drop it
8bd2892 drm/i915/tdr: Modify error handler for per engine hang recovery 7df335e drm/i915/tdr: Update reset_in_progress to account for engine reset 8513718 drm/i915: Separate out reset flags from the reset counter 8c5bc89 drm/i915: Update i915.reset to handle engine resets

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#27 lore raw

✗ Ro.CI.BAT: failure for Execlist based Engine reset patches (rev4)

In reply to Arun Siluvery
== Series Details ==

== Series Details ==

Series: Execlist based Engine reset patches (rev4)
URL : https://patchwork.freedesktop.org/series/10283/
State : failure

== Summary ==

Applying: drm/i915: Update i915.reset to handle engine resets
Applying: drm/i915: Separate out reset flags from the reset counter
Applying: drm/i915/tdr: Update reset_in_progress to account for engine reset
Applying: drm/i915/tdr: Modify error handler for per engine hang recovery
Applying: reset-request-recovery
fatal: sha1 information is lacking or useless (drivers/gpu/drm/i915/i915_drv.h).
error: could not build fake ancestor
Patch failed at 0005 reset-request-recovery
The copy of the patch that failed is found in: .git/rebase-apply/patch When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx