Skip to contentSkip to conversation

Allow error capture without a request / on reset failure

PATCH In review [email protected] 4 participants 11 messages Nov 29, 2022 – Dec 16, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Allow error capture without a request / on reset failure

From: John Harrison <[email protected]>

It is technically possible to get a hung context without a valid request. In such a situation, try to provide as much information in the error capture as possible rather than just aborting and capturing nothing.

Similarly, in the case of a engine reset failure the GuC is not able to report the guilty context. So try a manual search instead of reporting nothing.

John Harrison (2):
drm/i915: Allow error capture without a request drm/i915/guc: Look for a guilty context when an engine reset fails

 .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 15 ++++-
 drivers/gpu/drm/i915/i915_gpu_error.c         | 55 ++++++++++++++-----
 2 files changed, 54 insertions(+), 16 deletions(-)
Signature · 1 line
2.37.3
#1 lore raw

PATCH 1/2 drm/i915: Allow error capture without a request

From: John Harrison <[email protected]>

There was a report of error captures occurring without any hung context being indicated despite the capture being initiated by a 'hung context notification' from GuC. The problem was not reproducible. However, it is possible to happen if the context in question has no active requests. For example, if the hang was in the context switch itself then the breadcrumb write would have occurred and the KMD would see an idle context.

In the interests of attempting to provide as much information as possible about a hang, it seems wise to include the engine info regardless of whether a request was found or not. As opposed to just prentending there was no hang at all.

So update the error capture code to always record engine information if an engine is given. Which means updating record_context() to take a context instead of a request (which it only ever used to find the context anyway). And split the request agnostic parts of intel_engine_coredump_add_request() out into a seaprate function.

---
 drivers/gpu/drm/i915/i915_gpu_error.c | 55 +++++++++++++++++++--------
 1 file changed, 40 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_gpu_error.c +40 -15
index 9d5d5a397b64e..2ed1c84c9fab4 100644
@@ -1370,14 +1370,14 @@ static void engine_record_execlists(struct intel_engine_coredump *ee)
 }
 
 static bool record_context(struct i915_gem_context_coredump *e,
-			   const struct i915_request *rq)
+			   struct intel_context *ce)
 {
 	struct i915_gem_context *ctx;
 	struct task_struct *task;
 	bool simulated;
 
 	rcu_read_lock();
-	ctx = rcu_dereference(rq->context->gem_context);
+	ctx = rcu_dereference(ce->gem_context);
 	if (ctx && !kref_get_unless_zero(&ctx->ref))
 		ctx = NULL;
 	rcu_read_unlock();
@@ -1396,8 +1396,8 @@ static bool record_context(struct i915_gem_context_coredump *e,
 	e->guilty = atomic_read(&ctx->guilty_count);
 	e->active = atomic_read(&ctx->active_count);
 
-	e->total_runtime = intel_context_get_total_runtime_ns(rq->context);
-	e->avg_runtime = intel_context_get_avg_runtime_ns(rq->context);
+	e->total_runtime = intel_context_get_total_runtime_ns(ce);
+	e->avg_runtime = intel_context_get_avg_runtime_ns(ce);
 
 	simulated = i915_gem_context_no_error_capture(ctx);
 
@@ -1532,15 +1532,37 @@ intel_engine_coredump_alloc(struct intel_engine_cs *engine, gfp_t gfp, u32 dump_
 	return ee;
 }
 
+static struct intel_engine_capture_vma *
+engine_coredump_add_context(struct intel_engine_coredump *ee,
+			    struct intel_context *ce,
+			    gfp_t gfp)
+{
+	struct intel_engine_capture_vma *vma = NULL;
+
+	ee->simulated |= record_context(&ee->context, ce);
+	if (ee->simulated)
+		return NULL;
+
+	/*
+	 * We need to copy these to an anonymous buffer
+	 * as the simplest method to avoid being overwritten
+	 * by userspace.
+	 */
+	vma = capture_vma(vma, ce->ring->vma, "ring", gfp);
+	vma = capture_vma(vma, ce->state, "HW context", gfp);
+
+	return vma;
+}
+
 struct intel_engine_capture_vma *
 intel_engine_coredump_add_request(struct intel_engine_coredump *ee,
 				  struct i915_request *rq,
 				  gfp_t gfp)
 {
-	struct intel_engine_capture_vma *vma = NULL;
+	struct intel_engine_capture_vma *vma;
 
-	ee->simulated |= record_context(&ee->context, rq);
-	if (ee->simulated)
+	vma = engine_coredump_add_context(ee, rq->context, gfp);
+	if (!vma)
 		return NULL;
 
 	/*
@@ -1550,8 +1572,6 @@ intel_engine_coredump_add_request(struct intel_engine_coredump *ee,
 	 */
 	vma = capture_vma_snapshot(vma, rq->batch_res, gfp, "batch");
 	vma = capture_user(vma, rq, gfp);
-	vma = capture_vma(vma, rq->ring->vma, "ring", gfp);
-	vma = capture_vma(vma, rq->context->state, "HW context", gfp);
 
 	ee->rq_head = rq->head;
 	ee->rq_post = rq->postfix;
@@ -1608,8 +1628,11 @@ capture_engine(struct intel_engine_cs *engine,
 	if (ce) {
 		intel_engine_clear_hung_context(engine);
 		rq = intel_context_find_active_request(ce);
-		if (!rq || !i915_request_started(rq))
-			goto no_request_capture;
+		if (rq && !i915_request_started(rq)) {
+			drm_info(&engine->gt->i915->drm, "Got hung context on %s with no active request!\n",
+				 engine->name);
+			rq = NULL;
+		}
 	} else {
 		/*
 		 * Getting here with GuC enabled means it is a forced error capture
@@ -1625,12 +1648,14 @@ capture_engine(struct intel_engine_cs *engine,
 	if (rq)
 		rq = i915_request_get_rcu(rq);
 
-	if (!rq)
-		goto no_request_capture;
+	if (rq)
+		capture = intel_engine_coredump_add_request(ee, rq, ATOMIC_MAYFAIL);
+	else if (ce)
+		capture = engine_coredump_add_context(ee, ce, ATOMIC_MAYFAIL);
 
-	capture = intel_engine_coredump_add_request(ee, rq, ATOMIC_MAYFAIL);
 	if (!capture) {
-		i915_request_put(rq);
+		if (rq)
+			i915_request_put(rq);
 		goto no_request_capture;
 	}
 	if (dump_flags & CORE_DUMP_FLAG_IS_GUC_CAPTURE)
Signature · 1 line
2.37.3
Reviewed-by on v1 1/2
#2 lore raw

Re: [Intel-gfx] [PATCH 1/2] drm/i915: Allow error capture without a request

Quoted 123 lines · On Tue, Nov 29, 2022 at 01:12:52PM -0800, [email protected] wrote:

From: John Harrison <[email protected]>

There was a report of error captures occurring without any hung context being indicated despite the capture being initiated by a 'hung context notification' from GuC. The problem was not reproducible. However, it is possible to happen if the context in question has no active requests. For example, if the hang was in the context switch itself then the breadcrumb write would have occurred and the KMD would see an idle context.

In the interests of attempting to provide as much information as possible about a hang, it seems wise to include the engine info regardless of whether a request was found or not. As opposed to just prentending there was no hang at all.

So update the error capture code to always record engine information if an engine is given. Which means updating record_context() to take a context instead of a request (which it only ever used to find the context anyway). And split the request agnostic parts of intel_engine_coredump_add_request() out into a seaprate function.

---
drivers/gpu/drm/i915/i915_gpu_error.c | 55 +++++++++++++++++++--------

1 file changed, 40 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_gpu_error.c +26 -4
index 9d5d5a397b64e..2ed1c84c9fab4 100644
@@ -1370,14 +1370,14 @@ static void engine_record_execlists(struct intel_engine_coredump *ee)
 }
 
 static bool record_context(struct i915_gem_context_coredump *e,
-			   const struct i915_request *rq)
+			   struct intel_context *ce)
 {
 	struct i915_gem_context *ctx;
 	struct task_struct *task;
 	bool simulated;
 
 	rcu_read_lock();
-	ctx = rcu_dereference(rq->context->gem_context);
+	ctx = rcu_dereference(ce->gem_context);
 	if (ctx && !kref_get_unless_zero(&ctx->ref))
 		ctx = NULL;
 	rcu_read_unlock();
@@ -1396,8 +1396,8 @@ static bool record_context(struct i915_gem_context_coredump *e,
 	e->guilty = atomic_read(&ctx->guilty_count);
 	e->active = atomic_read(&ctx->active_count);
 
-	e->total_runtime = intel_context_get_total_runtime_ns(rq->context);
-	e->avg_runtime = intel_context_get_avg_runtime_ns(rq->context);
+	e->total_runtime = intel_context_get_total_runtime_ns(ce);
+	e->avg_runtime = intel_context_get_avg_runtime_ns(ce);
 
 	simulated = i915_gem_context_no_error_capture(ctx);
 
@@ -1532,15 +1532,37 @@ intel_engine_coredump_alloc(struct intel_engine_cs *engine, gfp_t gfp, u32 dump_
 	return ee;
 }
 
+static struct intel_engine_capture_vma *
+engine_coredump_add_context(struct intel_engine_coredump *ee,
+			    struct intel_context *ce,
+			    gfp_t gfp)
+{
+	struct intel_engine_capture_vma *vma = NULL;
+
+	ee->simulated |= record_context(&ee->context, ce);
+	if (ee->simulated)
+		return NULL;
+
+	/*
+	 * We need to copy these to an anonymous buffer
+	 * as the simplest method to avoid being overwritten
+	 * by userspace.
+	 */
+	vma = capture_vma(vma, ce->ring->vma, "ring", gfp);
+	vma = capture_vma(vma, ce->state, "HW context", gfp);
+
+	return vma;
+}
+

struct intel_engine_capture_vma * intel_engine_coredump_add_request(struct intel_engine_coredump *ee,
struct i915_request *rq, gfp_t gfp)
{

drivers/gpu/drm/i915/i915_gpu_error.c +3 -3
-	struct intel_engine_capture_vma *vma = NULL;
+	struct intel_engine_capture_vma *vma;
 
-	ee->simulated |= record_context(&ee->context, rq);
-	if (ee->simulated)
+	vma = engine_coredump_add_context(ee, rq->context, gfp);
+	if (!vma)
		return NULL;

	/*
drivers/gpu/drm/i915/i915_gpu_error.c +5 -4
@@ -1550,8 +1572,6 @@ intel_engine_coredump_add_request(struct intel_engine_coredump *ee,
 	 */
 	vma = capture_vma_snapshot(vma, rq->batch_res, gfp, "batch");
 	vma = capture_user(vma, rq, gfp);
-	vma = capture_vma(vma, rq->ring->vma, "ring", gfp);
-	vma = capture_vma(vma, rq->context->state, "HW context", gfp);
 
 	ee->rq_head = rq->head;
 	ee->rq_post = rq->postfix;
@@ -1608,8 +1628,11 @@ capture_engine(struct intel_engine_cs *engine,
 	if (ce) {
 		intel_engine_clear_hung_context(engine);
 		rq = intel_context_find_active_request(ce);
-		if (!rq || !i915_request_started(rq))
-			goto no_request_capture;
+		if (rq && !i915_request_started(rq)) {
+			drm_info(&engine->gt->i915->drm, "Got hung context on %s with no active request!\n",
+				 engine->name);
+			rq = NULL;
+		}
 	} else {
 		/*
 		 * Getting here with GuC enabled means it is a forced error capture

drivers/gpu/drm/i915/i915_gpu_error.c capture_engine(struct intel_engine_cs *engine, · line 1652

Quoted 7 lines
drivers/gpu/drm/i915/i915_gpu_error.c +2 -2
@@ -1625,12 +1648,14 @@ capture_engine(struct intel_engine_cs *engine,
 	if (rq)
 		rq = i915_request_get_rcu(rq);
 
-	if (!rq)
-		goto no_request_capture;
+	if (rq)
+		capture = intel_engine_coredump_add_request(ee, rq, ATOMIC_MAYFAIL);

2 back-to-back if (rq) could merge together,

otherwise, lgtm

Umesh

Quoted 14 lines
drivers/gpu/drm/i915/i915_gpu_error.c +4 -2
+	else if (ce)
+		capture = engine_coredump_add_context(ee, ce, ATOMIC_MAYFAIL);
 
-	capture = intel_engine_coredump_add_request(ee, rq, ATOMIC_MAYFAIL);
 	if (!capture) {
-		i915_request_put(rq);
+		if (rq)
+			i915_request_put(rq);
 		goto no_request_capture;
 	}
 	if (dump_flags & CORE_DUMP_FLAG_IS_GUC_CAPTURE)
Signature · 1 line
2.37.3
#3 lore raw

Re: [Intel-gfx] [PATCH 1/2] drm/i915: Allow error capture without a request

Quoted 141 lines · Umesh Nerlige Ramappa
Quoted 128 lines · On Tue, Nov 29, 2022 at 01:12:52PM -0800, [email protected] wrote:

From: John Harrison <[email protected]>

There was a report of error captures occurring without any hung context being indicated despite the capture being initiated by a 'hung context notification' from GuC. The problem was not reproducible. However, it is possible to happen if the context in question has no active requests. For example, if the hang was in the context switch itself then the breadcrumb write would have occurred and the KMD would see an idle context.

In the interests of attempting to provide as much information as possible about a hang, it seems wise to include the engine info regardless of whether a request was found or not. As opposed to just prentending there was no hang at all.

So update the error capture code to always record engine information if an engine is given. Which means updating record_context() to take a context instead of a request (which it only ever used to find the context anyway). And split the request agnostic parts of intel_engine_coredump_add_request() out into a seaprate function.

---
drivers/gpu/drm/i915/i915_gpu_error.c | 55 +++++++++++++++++++--------

1 file changed, 40 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_gpu_error.c +2 -2
index 9d5d5a397b64e..2ed1c84c9fab4 100644
@@ -1370,14 +1370,14 @@ static void engine_record_execlists(struct 
 intel_engine_coredump *ee)
 }
 
 static bool record_context(struct i915_gem_context_coredump *e,
-               const struct i915_request *rq)
+               struct intel_context *ce)
 {
     struct i915_gem_context *ctx;
     struct task_struct *task;
     bool simulated;
 
     rcu_read_lock();
-    ctx = rcu_dereference(rq->context->gem_context);
+    ctx = rcu_dereference(ce->gem_context);
     if (ctx && !kref_get_unless_zero(&ctx->ref))
         ctx = NULL;

    rcu_read_unlock();

drivers/gpu/drm/i915/i915_gpu_error.c +2 -2
@@ -1396,8 +1396,8 @@ static bool record_context(struct 
 i915_gem_context_coredump *e,
     e->guilty = atomic_read(&ctx->guilty_count);
     e->active = atomic_read(&ctx->active_count);
 
-    e->total_runtime = intel_context_get_total_runtime_ns(rq->context);
-    e->avg_runtime = intel_context_get_avg_runtime_ns(rq->context);
+    e->total_runtime = intel_context_get_total_runtime_ns(ce);
+    e->avg_runtime = intel_context_get_avg_runtime_ns(ce);
 
     simulated = i915_gem_context_no_error_capture(ctx);
@@ -1532,15 +1532,37 @@ intel_engine_coredump_alloc(struct 

intel_engine_cs *engine, gfp_t gfp, u32 dump_
    return ee;
}

drivers/gpu/drm/i915/i915_gpu_error.c +22 -0
+static struct intel_engine_capture_vma *
+engine_coredump_add_context(struct intel_engine_coredump *ee,
+                struct intel_context *ce,
+                gfp_t gfp)
+{
+    struct intel_engine_capture_vma *vma = NULL;
+
+    ee->simulated |= record_context(&ee->context, ce);
+    if (ee->simulated)
+        return NULL;
+
+    /*
+     * We need to copy these to an anonymous buffer
+     * as the simplest method to avoid being overwritten
+     * by userspace.
+     */
+    vma = capture_vma(vma, ce->ring->vma, "ring", gfp);
+    vma = capture_vma(vma, ce->state, "HW context", gfp);
+
+    return vma;
+}
+

struct intel_engine_capture_vma * intel_engine_coredump_add_request(struct intel_engine_coredump *ee, struct i915_request *rq,
                  gfp_t gfp)
{
-    struct intel_engine_capture_vma *vma = NULL;
+    struct intel_engine_capture_vma *vma;

-    ee->simulated |= record_context(&ee->context, rq); -    if (ee->simulated)
+    vma = engine_coredump_add_context(ee, rq->context, gfp); +    if (!vma)
        return NULL;

    /*

drivers/gpu/drm/i915/i915_gpu_error.c +0 -2
@@ -1550,8 +1572,6 @@ intel_engine_coredump_add_request(struct 
 intel_engine_coredump *ee,
      */
     vma = capture_vma_snapshot(vma, rq->batch_res, gfp, "batch");
     vma = capture_user(vma, rq, gfp);
-    vma = capture_vma(vma, rq->ring->vma, "ring", gfp);
-    vma = capture_vma(vma, rq->context->state, "HW context", gfp);
 
     ee->rq_head = rq->head;

    ee->rq_post = rq->postfix;

drivers/gpu/drm/i915/i915_gpu_error.c +5 -2
@@ -1608,8 +1628,11 @@ capture_engine(struct intel_engine_cs *engine,
     if (ce) {
         intel_engine_clear_hung_context(engine);
         rq = intel_context_find_active_request(ce);
-        if (!rq || !i915_request_started(rq))
-            goto no_request_capture;
+        if (rq && !i915_request_started(rq)) {
+            drm_info(&engine->gt->i915->drm, "Got hung context on %s 
 with no active request!\n",
+                 engine->name);
+            rq = NULL;
+        }
     } else {
         /*

         * Getting here with GuC enabled means it is a forced error capture

drivers/gpu/drm/i915/i915_gpu_error.c capture_engine(struct intel_engine_cs *engine, · line 1653

Quoted 8 lines
drivers/gpu/drm/i915/i915_gpu_error.c +2 -2
@@ -1625,12 +1648,14 @@ capture_engine(struct intel_engine_cs *engine,
     if (rq)
         rq = i915_request_get_rcu(rq);
 
-    if (!rq)
-        goto no_request_capture;
+    if (rq)
+        capture = intel_engine_coredump_add_request(ee, rq, 
 ATOMIC_MAYFAIL);

2 back-to-back if (rq) could merge together,

Quoted 5 lines

otherwise, lgtm

Umesh

There was actually an unconditional put of rq just after the block below. So will need to repost to fix that anyway. Not sure how it didn't manage to bang when testing captures with the rq forced to null!?

John.

Quoted 15 lines
Quoted 15 lines
drivers/gpu/drm/i915/i915_gpu_error.c +4 -2
+    else if (ce)
+        capture = engine_coredump_add_context(ee, ce, ATOMIC_MAYFAIL);
 
-    capture = intel_engine_coredump_add_request(ee, rq, 
 ATOMIC_MAYFAIL);
     if (!capture) {
-        i915_request_put(rq);
+        if (rq)
+            i915_request_put(rq);
         goto no_request_capture;

    }
    if (dump_flags & CORE_DUMP_FLAG_IS_GUC_CAPTURE)

Signature · 1 line
2.37.3
#4 lore raw

PATCH 2/2 drm/i915/guc: Look for a guilty context when an engine reset fails

In reply to [email protected]

From: John Harrison <[email protected]>

Engine resets are supposed to never happen. But in the case when one does (due to unknwon reasons that normally come down to a missing w/a), it is useful to get as much information out of the system as possible. Given that the GuC effectively dies on such a situation, it is not possible to get a guilty context notification back. So do a manual search instead. Given that GuC is dead, this is safe because GuC won't be changing the engine state asynchronously.

---
 drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +14 -1
index 0a42f1807f52c..c82730804a1c4 100644
@@ -4751,11 +4751,24 @@ static void reset_fail_worker_func(struct work_struct *w)
 	guc->submission_state.reset_fail_mask = 0;
 	spin_unlock_irqrestore(&guc->submission_state.lock, flags);
 
-	if (likely(reset_fail_mask))
+	if (likely(reset_fail_mask)) {
+		struct intel_engine_cs *engine;
+		enum intel_engine_id id;
+
+		/*
+		 * GuC is toast at this point - it dead loops after sending the failed
+		 * reset notification. So need to manually determine the guilty context.
+		 * Note that it should be safe/reliable to do this here because the GuC
+		 * is toast and will not be scheduling behind the KMD's back.
+		 */
+		for_each_engine_masked(engine, gt, reset_fail_mask, id)
+			intel_guc_find_hung_context(engine);
+
 		intel_gt_handle_error(gt, reset_fail_mask,
 				      I915_ERROR_CAPTURE,
 				      "GuC failed to reset engine mask=0x%x\n",
 				      reset_fail_mask);
+	}
 }
 
 int intel_guc_engine_failure_process_msg(struct intel_guc *guc,
Signature · 1 line
2.37.3
#5 lore raw

Re: [Intel-gfx] [PATCH 2/2] drm/i915/guc: Look for a guilty context when an engine reset fails

Quoted 3 lines · On 29/11/2022 21:12, [email protected] wrote:

From: John Harrison <[email protected]>

Engine resets are supposed to never happen. But in the case when one

Engine resets or engine reset failures? Hopefully the latter.

Quoted 28 lines

does (due to unknwon reasons that normally come down to a missing w/a), it is useful to get as much information out of the system as possible. Given that the GuC effectively dies on such a situation, it is not possible to get a guilty context notification back. So do a manual search instead. Given that GuC is dead, this is safe because GuC won't be changing the engine state asynchronously.

---
  drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 15 ++++++++++++++-
  1 file changed, 14 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +7 -1
index 0a42f1807f52c..c82730804a1c4 100644
@@ -4751,11 +4751,24 @@ static void reset_fail_worker_func(struct work_struct *w)
  	guc->submission_state.reset_fail_mask = 0;
  	spin_unlock_irqrestore(&guc->submission_state.lock, flags);
 
-	if (likely(reset_fail_mask))
+	if (likely(reset_fail_mask)) {
+		struct intel_engine_cs *engine;
+		enum intel_engine_id id;
+
+		/*
+		 * GuC is toast at this point - it dead loops after sending the failed
+		 * reset notification. So need to manually determine the guilty context.

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c static void reset_fail_worker_func(struct work_struct *w) · line 4770

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +6 -0
+		 * Note that it should be safe/reliable to do this here because the GuC
+		 * is toast and will not be scheduling behind the KMD's back.
+		 */
+		for_each_engine_masked(engine, gt, reset_fail_mask, id)
+			intel_guc_find_hung_context(engine);
+
  		intel_gt_handle_error(gt, reset_fail_mask,
  				      I915_ERROR_CAPTURE,
  				      "GuC failed to reset engine mask=0x%x\n",
  				      reset_fail_mask);

If GuC is defined by ABI contract to be dead, should the flow be attempting to do a full GPU reset here, or maybe it happens somewhere else as a consequence anyway? (In which case is the engine reset here even needed?)

Regards,

Tvrtko

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +1 -0
+	}
  }
 
  int intel_guc_engine_failure_process_msg(struct intel_guc *guc,
#6 lore raw

Re: [Intel-gfx] [PATCH 2/2] drm/i915/guc: Look for a guilty context when an engine reset fails

Quoted 7 lines · Tvrtko Ursulin
Quoted 3 lines · On 29/11/2022 21:12, [email protected] wrote:

From: John Harrison <[email protected]>

Engine resets are supposed to never happen. But in the case when one

Engine resets or engine reset failures? Hopefully the latter.

Oops. Yes, that was meant to say "engine resets are never supposed to fail."

Quoted 1 line
Quoted 1 line

does (due to unknwon reasons that normally come down to a missing

unknwon -> unknown

Quoted 34 lines
Quoted 34 lines

w/a), it is useful to get as much information out of the system as possible. Given that the GuC effectively dies on such a situation, it is not possible to get a guilty context notification back. So do a manual search instead. Given that GuC is dead, this is safe because GuC won't be changing the engine state asynchronously.

---
  drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 15 ++++++++++++++-

  1 file changed, 14 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +6 -0
index 0a42f1807f52c..c82730804a1c4 100644
@@ -4751,11 +4751,24 @@ static void reset_fail_worker_func(struct 
 work_struct *w)
       guc->submission_state.reset_fail_mask = 0;
       spin_unlock_irqrestore(&guc->submission_state.lock, flags);
   -    if (likely(reset_fail_mask))
+    if (likely(reset_fail_mask)) {
+        struct intel_engine_cs *engine;
+        enum intel_engine_id id;
+
+        /*
+         * GuC is toast at this point - it dead loops after sending 

the failed
+         * reset notification. So need to manually determine the guilty context.
+         * Note that it should be safe/reliable to do this here because the GuC
+         * is toast and will not be scheduling behind the KMD's back. +         */
+        for_each_engine_masked(engine, gt, reset_fail_mask, id)

Quoted 8 lines
Quoted 6 lines

+            intel_guc_find_hung_context(engine);
+
          intel_gt_handle_error(gt, reset_fail_mask, I915_ERROR_CAPTURE,
                        "GuC failed to reset engine mask=0x%x\n", reset_fail_mask);

If GuC is defined by ABI contract to be dead, should the flow be attempting to do a full GPU reset here, or maybe it happens somewhere else as a consequence anyway? (In which case is the engine reset here even needed?)

This is a full GT reset. i915 is not allowed to perform an engine reset when using GuC submission. Those can only be done by GuC. So any forced reset by i915 will be escalated to full GT internally.

John.

Quoted 8 lines

Regards,

Tvrtko

Quoted 3 lines

+    }
  }
    int intel_guc_engine_failure_process_msg(struct intel_guc *guc,

#7 lore raw

Re: [Intel-gfx] [PATCH 2/2] drm/i915/guc: Look for a guilty context when an engine reset fails

Quoted 55 lines · John Harrison
Quoted 7 lines · Tvrtko Ursulin
Quoted 3 lines · On 29/11/2022 21:12, [email protected] wrote:

From: John Harrison <[email protected]>

Engine resets are supposed to never happen. But in the case when one

Engine resets or engine reset failures? Hopefully the latter.

Oops. Yes, that was meant to say "engine resets are never supposed to fail."

Quoted 1 line
Quoted 1 line

does (due to unknwon reasons that normally come down to a missing

unknwon -> unknown

Quoted 34 lines
Quoted 34 lines

w/a), it is useful to get as much information out of the system as possible. Given that the GuC effectively dies on such a situation, it is not possible to get a guilty context notification back. So do a manual search instead. Given that GuC is dead, this is safe because GuC won't be changing the engine state asynchronously.

---
  drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 15 ++++++++++++++-

  1 file changed, 14 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +6 -0
index 0a42f1807f52c..c82730804a1c4 100644
@@ -4751,11 +4751,24 @@ static void reset_fail_worker_func(struct 
 work_struct *w)
       guc->submission_state.reset_fail_mask = 0;
       spin_unlock_irqrestore(&guc->submission_state.lock, flags);
   -    if (likely(reset_fail_mask))
+    if (likely(reset_fail_mask)) {
+        struct intel_engine_cs *engine;
+        enum intel_engine_id id;
+
+        /*
+         * GuC is toast at this point - it dead loops after sending 

the failed
+         * reset notification. So need to manually determine the guilty context.
+         * Note that it should be safe/reliable to do this here because the GuC
+         * is toast and will not be scheduling behind the KMD's back. +         */
+        for_each_engine_masked(engine, gt, reset_fail_mask, id)

Quoted 8 lines
Quoted 6 lines

+            intel_guc_find_hung_context(engine);
+
          intel_gt_handle_error(gt, reset_fail_mask, I915_ERROR_CAPTURE,
                        "GuC failed to reset engine mask=0x%x\n", reset_fail_mask);

If GuC is defined by ABI contract to be dead, should the flow be attempting to do a full GPU reset here, or maybe it happens somewhere else as a consequence anyway? (In which case is the engine reset here even needed?)

Quoted 1 line

This is a full GT reset. i915 is not allowed to perform an engine reset when using GuC submission. Those can only be done by GuC. So any forced reset by i915 will be escalated to full GT internally.

Okay, I saw passing in of the engine mask and drew the wrong conclusion.

Regards,

Tvrtko

#8 lore raw

Re: [PATCH 2/2] drm/i915/guc: Look for a guilty context when an engine reset fails

In reply to [email protected]
Quoted 24 lines · On Tue, Nov 29, 2022 at 01:12:53PM -0800, [email protected] wrote:

From: John Harrison <[email protected]>

Engine resets are supposed to never happen. But in the case when one does (due to unknwon reasons that normally come down to a missing w/a), it is useful to get as much information out of the system as possible. Given that the GuC effectively dies on such a situation, it is not possible to get a guilty context notification back. So do a manual search instead. Given that GuC is dead, this is safe because GuC won't be changing the engine state asynchronously.

---
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 15 ++++++++++++++-

1 file changed, 14 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +0 -1
index 0a42f1807f52c..c82730804a1c4 100644
@@ -4751,11 +4751,24 @@ static void reset_fail_worker_func(struct work_struct *w)
 	guc->submission_state.reset_fail_mask = 0;
 	spin_unlock_irqrestore(&guc->submission_state.lock, flags);
 
-	if (likely(reset_fail_mask))

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c static void reset_fail_worker_func(struct work_struct *w) · line 4763

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +10 -0
+	if (likely(reset_fail_mask)) {
+		struct intel_engine_cs *engine;
+		enum intel_engine_id id;
+
+		/*
+		 * GuC is toast at this point - it dead loops after sending the failed
+		 * reset notification. So need to manually determine the guilty context.
+		 * Note that it should be safe/reliable to do this here because the GuC
+		 * is toast and will not be scheduling behind the KMD's back.
+		 */

Is that defined by the kmd-GuC interface that following a failed reset notification, GuC will always dead-loop OR not schedule anything (even on other engines) until KMD takes some action? What action should KMD take?

Regards,
Umesh

Quoted 14 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +4 -0
+		for_each_engine_masked(engine, gt, reset_fail_mask, id)
+			intel_guc_find_hung_context(engine);
+
 		intel_gt_handle_error(gt, reset_fail_mask,
 				      I915_ERROR_CAPTURE,
 				      "GuC failed to reset engine mask=0x%x\n",
 				      reset_fail_mask);
+	}
 }
 
 int intel_guc_engine_failure_process_msg(struct intel_guc *guc,
Signature · 1 line
2.37.3
#9 lore raw

[Intel-gfx] ✗ Fi.CI.SPARSE: warning for Allow error capture without a request / on reset failure

In reply to [email protected]
== Series Details ==

== Series Details ==

Series: Allow error capture without a request / on reset failure
URL : https://patchwork.freedesktop.org/series/111454/
State : warning

== Summary ==

Error: dim sparse failed
Sparse version: v0.6.2
Fast mode used, each commit won't be checked separately. +./arch/x86/include/asm/bitops.h:117:1: warning: unreplaced symbol 'return' +./arch/x86/include/asm/bitops.h:148:1: warning: unreplaced symbol 'return' +./arch/x86/include/asm/bitops.h:150:9: warning: unreplaced symbol 'oldbit' +./arch/x86/include/asm/bitops.h:154:26: warning: unreplaced symbol 'oldbit' +./arch/x86/include/asm/bitops.h:156:16: warning: unreplaced symbol 'oldbit' +./arch/x86/include/asm/bitops.h:156:9: warning: unreplaced symbol 'return' +./arch/x86/include/asm/bitops.h:174:1: warning: unreplaced symbol 'return' +./arch/x86/include/asm/bitops.h:176:9: warning: unreplaced symbol 'oldbit' +./arch/x86/include/asm/bitops.h:180:35: warning: unreplaced symbol 'oldbit' +./arch/x86/include/asm/bitops.h:182:16: warning: unreplaced symbol 'oldbit' +./arch/x86/include/asm/bitops.h:182:9: warning: unreplaced symbol 'return' +./arch/x86/include/asm/bitops.h:186:1: warning: unreplaced symbol 'return' +./arch/x86/include/asm/bitops.h:188:9: warning: unreplaced symbol 'oldbit' +./arch/x86/include/asm/bitops.h:192:35: warning: unreplaced symbol 'oldbit' +./arch/x86/include/asm/bitops.h:195:16: warning: unreplaced symbol 'oldbit' +./arch/x86/include/asm/bitops.h:195:9: warning: unreplaced symbol 'return' +./arch/x86/include/asm/bitops.h:237:1: warning: unreplaced symbol 'return' +./arch/x86/include/asm/bitops.h:239:9: warning: unreplaced symbol 'return' +./arch/x86/include/asm/bitops.h:66:1: warning: unreplaced symbol 'return' +./arch/x86/include/asm/bitops.h:92:1: warning: unreplaced symbol 'return' +./drivers/gpu/drm/i915/intel_uncore.h:333:1: warning: trying to copy expression type 31 +./include/asm-generic/bitops/generic-non-atomic.h:100:17: warning: unreplaced symbol 'old' +./include/asm-generic/bitops/generic-non-atomic.h:100:23: warning: unreplaced symbol 'mask' +./include/asm-generic/bitops/generic-non-atomic.h:100:9: warning: unreplaced symbol 'return' +./include/asm-generic/bitops/generic-non-atomic.h:105:1: warning: unreplaced symbol 'return' +./include/asm-generic/bitops/generic-non-atomic.h:107:9: warning: unreplaced symbol 'mask' +./include/asm-generic/bitops/generic-non-atomic.h:108:9: warning: unreplaced symbol 'p' +./include/asm-generic/bitops/generic-non-atomic.h:109:9: warning: unreplaced symbol 'old' +./include/asm-generic/bitops/generic-non-atomic.h:111:10: warning: unreplaced symbol 'p' +./include/asm-generic/bitops/generic-non-atomic.h:111:14: warning: unreplaced symbol 'old' +./include/asm-generic/bitops/generic-non-atomic.h:111:20: warning: unreplaced symbol 'mask' +./include/asm-generic/bitops/generic-non-atomic.h:112:17: warning: unreplaced symbol 'old' +./include/asm-generic/bitops/generic-non-atomic.h:112:23: warning: unreplaced symbol 'mask' +./include/asm-generic/bitops/generic-non-atomic.h:112:9: warning: unreplaced symbol 'return' +./include/asm-generic/bitops/generic-non-atomic.h:121:1: warning: unreplaced symbol 'return' +./include/asm-generic/bitops/generic-non-atomic.h:128:9: warning: unreplaced symbol 'return' +./include/asm-generic/bitops/generic-non-atomic.h:166:1: warning: unreplaced symbol 'return' +./include/asm-generic/bitops/generic-non-atomic.h:168:9: warning: unreplaced symbol 'p' +./include/asm-generic/bitops/generic-non-atomic.h:169:9: warning: unreplaced symbol 'mask' +./include/asm-generic/bitops/generic-non-atomic.h:170:9: warning: unreplaced symbol 'val' +./include/asm-generic/bitops/generic-non-atomic.h:172:19: warning: unreplaced symbol 'val' +./include/asm-generic/bitops/generic-non-atomic.h:172:25: warning: unreplaced symbol 'mask' +./include/asm-generic/bitops/generic-non-atomic.h:172:9: warning: unreplaced symbol 'return' +./include/asm-generic/bitops/generic-non-atomic.h:28:1: warning: unreplaced symbol 'return' +./include/asm-generic/bitops/generic-non-atomic.h:30:9: warning: unreplaced symbol 'mask' +./include/asm-generic/bitops/generic-non-atomic.h:31:9: warning: unreplaced symbol 'p' +./include/asm-generic/bitops/generic-non-atomic.h:33:10: warning: unreplaced symbol 'p' +./include/asm-generic/bitops/generic-non-atomic.h:33:16: warning: unreplaced symbol 'mask' +./include/asm-generic/bitops/generic-non-atomic.h:37:1: warning: unreplaced symbol 'return' +./include/asm-generic/bitops/generic-non-atomic.h:39:9: warning: unreplaced symbol 'mask' +./include/asm-generic/bitops/generic-non-atomic.h:40:9: warning: unreplaced symbol 'p' +./include/asm-generic/bitops/generic-non-atomic.h:42:10: warning: unreplaced symbol 'p' +./include/asm-generic/bitops/generic-non-atomic.h:42:16: warning: unreplaced symbol 'mask' +./include/asm-generic/bitops/generic-non-atomic.h:55:1: warning: unreplaced symbol 'return' +./include/asm-generic/bitops/generic-non-atomic.h:57:9: warning: unreplaced symbol 'mask' +./include/asm-generic/bitops/generic-non-atomic.h:58:9: warning: unreplaced symbol 'p' +./include/asm-generic/bitops/generic-non-atomic.h:60:10: warning: unreplaced symbol 'p' +./include/asm-generic/bitops/generic-non-atomic.h:60:15: warning: unreplaced symbol 'mask' +./include/asm-generic/bitops/generic-non-atomic.h:73:1: warning: unreplaced symbol 'return' +./include/asm-generic/bitops/generic-non-atomic.h:75:9: warning: unreplaced symbol 'mask' +./include/asm-generic/bitops/generic-non-atomic.h:76:9: warning: unreplaced symbol 'p' +./include/asm-generic/bitops/generic-non-atomic.h:77:9: warning: unreplaced symbol 'old' +./include/asm-generic/bitops/generic-non-atomic.h:79:10: warning: unreplaced symbol 'p' +./include/asm-generic/bitops/generic-non-atomic.h:79:14: warning: unreplaced symbol 'old' +./include/asm-generic/bitops/generic-non-atomic.h:79:20: warning: unreplaced symbol 'mask' +./include/asm-generic/bitops/generic-non-atomic.h:80:17: warning: unreplaced symbol 'old' +./include/asm-generic/bitops/generic-non-atomic.h:80:23: warning: unreplaced symbol 'mask' +./include/asm-generic/bitops/generic-non-atomic.h:80:9: warning: unreplaced symbol 'return' +./include/asm-generic/bitops/generic-non-atomic.h:93:1: warning: unreplaced symbol 'return' +./include/asm-generic/bitops/generic-non-atomic.h:95:9: warning: unreplaced symbol 'mask' +./include/asm-generic/bitops/generic-non-atomic.h:96:9: warning: unreplaced symbol 'p' +./include/asm-generic/bitops/generic-non-atomic.h:97:9: warning: unreplaced symbol 'old' +./include/asm-generic/bitops/generic-non-atomic.h:99:10: warning: unreplaced symbol 'p' +./include/asm-generic/bitops/generic-non-atomic.h:99:14: warning: unreplaced symbol 'old' +./include/asm-generic/bitops/generic-non-atomic.h:99:21: warning: unreplaced symbol 'mask' +./include/asm-generic/bitops/instrumented-non-atomic.h:100:9: warning: unreplaced symbol 'return' +./include/asm-generic/bitops/instrumented-non-atomic.h:112:1: warning: unreplaced symbol 'return' +./include/asm-generic/bitops/instrumented-non-atomic.h:115:9: warning: unreplaced symbol 'return' +./include/asm-generic/bitops/instrumented-non-atomic.h:127:1: warning: unreplaced symbol 'return' +./include/asm-generic/bitops/instrumented-non-atomic.h:130:9: warning: unreplaced symbol 'return' +./include/asm-generic/bitops/instrumented-non-atomic.h:139:1: warning: unreplaced symbol 'return' +./include/asm-generic/bitops/instrumented-non-atomic.h:142:9: warning: unreplaced symbol 'return' +./include/asm-generic/bitops/instrumented-non-atomic.h:26:1: warning: unreplaced symbol 'return' +./include/asm-generic/bitops/instrumented-non-atomic.h:42:1: warning: unreplaced symbol 'return' +./include/asm-generic/bitops/instrumented-non-atomic.h:58:1: warning: unreplaced symbol 'return' +./include/asm-generic/bitops/instrumented-non-atomic.h:97:1: warning: unreplaced symbol 'return'

#10 lore raw

[Intel-gfx] ✗ Fi.CI.BAT: failure for Allow error capture without a request / on reset failure

In reply to [email protected]
== Series Details ==

== Series Details ==

Series: Allow error capture without a request / on reset failure
URL : https://patchwork.freedesktop.org/series/111454/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_12449 -> Patchwork_111454v1
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_111454v1 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_111454v1, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111454v1/index.html

Participating hosts (36 -> 35)
------------------------------

Missing (1): bat-rpls-2

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_111454v1:

### CI changes ###

#### Possible regressions ####

* boot:
- fi-ilk-650: [PASS][1] -> [FAIL][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12449/fi-ilk-650/boot.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111454v1/fi-ilk-650/boot.html

### IGT changes ###

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* igt@i915_suspend@basic-s3-without-i915:
- {bat-rpls-1}: NOTRUN -> [INCOMPLETE][3]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111454v1/bat-rpls-1/igt@[email protected]

Known issues
------------

Here are the changes found in Patchwork_111454v1 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_lmem_swapping@basic:
- fi-apl-guc: NOTRUN -> [SKIP][4] ([fdo#109271] / [i915#4613]) +3 similar issues
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111454v1/fi-apl-guc/igt@[email protected]

* igt@kms_chamelium@hdmi-crc-fast:
- fi-apl-guc: NOTRUN -> [SKIP][5] ([fdo#109271] / [fdo#111827]) +8 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111454v1/fi-apl-guc/igt@[email protected]

* igt@kms_force_connector_basic@force-connector-state:
- fi-apl-guc: NOTRUN -> [SKIP][6] ([fdo#109271]) +11 similar issues
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111454v1/fi-apl-guc/igt@[email protected]

* igt@kms_pipe_crc_basic@suspend-read-crc:
- fi-ivb-3770: NOTRUN -> [SKIP][7] ([fdo#109271])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111454v1/fi-ivb-3770/igt@[email protected]

#### Possible fixes ####

* igt@gem_render_tiled_blits@basic:
- fi-apl-guc: [INCOMPLETE][8] ([i915#7056]) -> [PASS][9]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12449/fi-apl-guc/igt@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111454v1/fi-apl-guc/igt@[email protected]

* igt@i915_selftest@live@gt_pm:
- {bat-adln-1}: [DMESG-FAIL][10] ([i915#4258]) -> [PASS][11]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12449/bat-adln-1/igt@i915_selftest@live@gt_pm.html
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111454v1/bat-adln-1/igt@i915_selftest@live@gt_pm.html

#### Warnings ####

* igt@i915_suspend@basic-s3-without-i915:
- fi-rkl-11600: [FAIL][12] ([fdo#103375]) -> [INCOMPLETE][13] ([i915#4817])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12449/fi-rkl-11600/igt@[email protected]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111454v1/fi-rkl-11600/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#4258]: https://gitlab.freedesktop.org/drm/intel/issues/4258
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4817]: https://gitlab.freedesktop.org/drm/intel/issues/4817
[i915#5334]: https://gitlab.freedesktop.org/drm/intel/issues/5334
[i915#6794]: https://gitlab.freedesktop.org/drm/intel/issues/6794
[i915#7056]: https://gitlab.freedesktop.org/drm/intel/issues/7056
[i915#7535]: https://gitlab.freedesktop.org/drm/intel/issues/7535

Build changes
-------------

* Linux: CI_DRM_12449 -> Patchwork_111454v1

CI-20190529: 20190529
CI_DRM_12449: bd21d688743bbb6b97f7591203f388af4a018c6b @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7075: ae0ad0ffa147445cdf9d33c96a018f5a8b21a5ee @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_111454v1: bd21d688743bbb6b97f7591203f388af4a018c6b @ git://anongit.freedesktop.org/gfx-ci/linux

### Linux commits

3149db3c75dc drm/i915/guc: Look for a guilty context when an engine reset fails 8f44e6363ca8 drm/i915: Allow error capture without a request

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111454v1/index.html