Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [RFC 2/2] drm/i915: Use user engine names in error state ecode
Date: Wed,  4 Nov 2020 12:20:43 +0000	[thread overview]
Message-ID: <20201104122043.876567-2-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <20201104122043.876567-1-tvrtko.ursulin@linux.intel.com>

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Instead of printing out the internal engine mask, which can change between
kernel versions making it difficult to map to actual engines, list user
friendly engine names in the ecode string. For example:

  [drm] GPU HANG: ecode 9:vcs1:a77ffefe, in gem_exec_captur [929]

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/i915_gpu_error.c | 38 ++++++++++++++++-----------
 drivers/gpu/drm/i915/i915_gpu_error.h |  2 +-
 2 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index 857db66cc4a3..ce876e3f3ec5 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -1659,32 +1659,40 @@ static u32 generate_ecode(const struct intel_engine_coredump *ee)
 static const char *error_msg(struct i915_gpu_coredump *error)
 {
 	struct intel_engine_coredump *first = NULL;
+	int space = sizeof(error->error_msg) - 1, len;
 	struct intel_gt_coredump *gt;
-	intel_engine_mask_t engines;
-	int len;
+	char *p = error->error_msg;
+
+	len = scnprintf(p, space, "GPU HANG: ecode %d:",
+			INTEL_GEN(error->i915));
+	p += len;
+	space -= len;
 
-	engines = 0;
 	for (gt = error->gt; gt; gt = gt->next) {
 		struct intel_engine_coredump *cs;
 
 		for (cs = gt->engine; cs; cs = cs->next) {
-			if (cs->hung) {
-				engines |= cs->engine->mask;
-				if (!first)
-					first = cs;
-			}
+			if (!cs->hung)
+				continue;
+
+			len = scnprintf(p, space, "%s%s",
+					first ? "," : "",
+					cs->engine->name);
+			p += len;
+			space -= len;
+
+			if (!first)
+				first = cs;
 		}
 	}
 
-	len = scnprintf(error->error_msg, sizeof(error->error_msg),
-			"GPU HANG: ecode %d:%x:%08x",
-			INTEL_GEN(error->i915), engines,
-			generate_ecode(first));
+	len = scnprintf(p, space, ":%08x", generate_ecode(first));
+	p += len;
+	space -= len;
+
 	if (first && first->context.pid) {
 		/* Just show the first executing process, more is confusing */
-		len += scnprintf(error->error_msg + len,
-				 sizeof(error->error_msg) - len,
-				 ", in %s [%d]",
+		len += scnprintf(p, space, ", in %s [%d]",
 				 first->context.comm, first->context.pid);
 	}
 
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.h b/drivers/gpu/drm/i915/i915_gpu_error.h
index 3a7ca90a3436..6b8573ddbe67 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.h
+++ b/drivers/gpu/drm/i915/i915_gpu_error.h
@@ -168,7 +168,7 @@ struct i915_gpu_coredump {
 
 	struct intel_gt_coredump *gt;
 
-	char error_msg[128];
+	char error_msg[256];
 	bool simulated;
 	bool wakelock;
 	bool suspended;
-- 
2.25.1

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

  reply	other threads:[~2020-11-04 12:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-04 12:20 [Intel-gfx] [RFC 1/2] drm/i915: Improve record of hung engines in error state Tvrtko Ursulin
2020-11-04 12:20 ` Tvrtko Ursulin [this message]
2020-11-04 12:33   ` [Intel-gfx] [RFC 2/2] drm/i915: Use user engine names in error state ecode Chris Wilson
2020-11-04 13:06     ` Tvrtko Ursulin
2020-11-04 13:21       ` Chris Wilson
2020-11-04 12:30 ` [Intel-gfx] [RFC 1/2] drm/i915: Improve record of hung engines in error state Chris Wilson
2020-11-04 13:03   ` Tvrtko Ursulin
2020-11-04 13:19 ` [Intel-gfx] ✓ Fi.CI.BAT: success for series starting with [RFC,1/2] " Patchwork
2020-11-04 15:37 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201104122043.876567-2-tvrtko.ursulin@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox