[Intel-gfx] [RFC 21/37] drm/i915/error: add GuC state error capture & decode

John.C.Harrison at Intel.com John.C.Harrison at Intel.com
Mon Nov 23 03:41:56 PST 2015


From: Dave Gordon <david.s.gordon at intel.com>

For: VIZ-2021
Signed-off-by: Dave Gordon <david.s.gordon at intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h       |   4 ++
 drivers/gpu/drm/i915/i915_gpu_error.c | 110 ++++++++++++++++++++++++++++++++++
 2 files changed, 114 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 9e0e9da..df01863 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -617,6 +617,10 @@ struct drm_i915_error_state {
 
 	u32 *active_bo_count, *pinned_bo_count;
 	u32 vm_count;
+
+	struct intel_guc guc;
+	struct i915_guc_client execbuf_client;
+	struct i915_guc_client preempt_client;
 };
 
 struct intel_connector;
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index e3777ba..346c831 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -362,6 +362,100 @@ static void i915_ring_error_state(struct drm_i915_error_state_buf *m,
 	}
 }
 
+static void i915_guc_firmware_info(struct drm_i915_error_state_buf *m,
+				   struct drm_i915_private *dev_priv,
+				   struct intel_guc_fw *guc_fw)
+{
+	err_printf(m, "GuC firmware status:\n");
+	err_printf(m, "\tpath: %s\n",
+		guc_fw->guc_fw_path);
+	err_printf(m, "\tfetch: %s\n",
+		intel_guc_fw_status_repr(guc_fw->guc_fw_fetch_status));
+	err_printf(m, "\tload: %s\n",
+		intel_guc_fw_status_repr(guc_fw->guc_fw_load_status));
+	err_printf(m, "\tversion wanted: %d.%d\n",
+		guc_fw->guc_fw_major_wanted, guc_fw->guc_fw_minor_wanted);
+	err_printf(m, "\tversion found: %d.%d\n",
+		guc_fw->guc_fw_major_found, guc_fw->guc_fw_minor_found);
+}
+
+static void i915_guc_action_info(struct drm_i915_error_state_buf *m,
+				 struct drm_i915_private *dev_priv,
+				 struct intel_guc *guc)
+{
+	struct intel_engine_cs *ring;
+	u64 total = 0, preempts = 0;
+	int i;
+
+	err_printf(m, "GuC action status:\n");
+	err_printf(m, "\ttotal action count: %llu\n", guc->action_count);
+	err_printf(m, "\tlast action command: 0x%x\n", guc->action_cmd);
+	err_printf(m, "\tlast action status: 0x%x\n", guc->action_status);
+
+	err_printf(m, "\taction failure count: %u\n", guc->action_fail_count);
+	err_printf(m, "\tlast failed action: 0x%x\n", guc->action_fail_cmd);
+	err_printf(m, "\tlast failed status: 0x%x\n", guc->action_fail_status);
+	err_printf(m, "\tlast error code: %d\n", guc->action_err);
+
+	err_printf(m, "GuC submissions:\n");
+	for_each_ring(ring, dev_priv, i) {
+		err_printf(m, "\t%-24s: %10llu, last %-8s 0x%08x %9d\n",
+			ring->name, guc->submissions[i], "seqno",
+			guc->last_seqno[i], guc->last_seqno[i]);
+		err_printf(m, "\t%-24s: %10u, last %-8s 0x%08x %9d\n",
+			"    preemptions", guc->preemptions[i], "preempt",
+			guc->last_preempt[i], guc->last_preempt[i]);
+		total += guc->submissions[i];
+		preempts += guc->preemptions[i];
+	}
+	err_printf(m, "\t%s: %10llu\n", "Total regular", total);
+	err_printf(m, "\t%s: %10llu\n", "     preempts", preempts);
+}
+
+static void i915_guc_client_info(struct drm_i915_error_state_buf *m,
+				 struct drm_i915_private *dev_priv,
+				 struct i915_guc_client *client)
+{
+	struct intel_engine_cs *ring;
+	uint64_t tot = 0;
+	uint32_t i;
+
+	err_printf(m, "\tPriority %d, GuC ctx index: %u, PD offset 0x%x\n",
+		client->priority, client->ctx_index, client->proc_desc_offset);
+	err_printf(m, "\tDoorbell id %d, offset: 0x%x, cookie 0x%x\n",
+		client->doorbell_id, client->doorbell_offset, client->doorbell_cookie);
+	err_printf(m, "\tWQ size %d, offset: 0x%x, tail %d\n",
+		client->wq_size, client->wq_offset, client->wq_tail);
+
+	err_printf(m, "\tFailed to queue: %u\n", client->q_fail);
+	err_printf(m, "\tFailed doorbell: %u\n", client->b_fail);
+	err_printf(m, "\tLast submission result: %d\n", client->retcode);
+
+	for_each_ring(ring, dev_priv, i) {
+		err_printf(m, "\tSubmissions: %llu %s\n",
+				client->submissions[i],
+				ring->name);
+		tot += client->submissions[i];
+	}
+	err_printf(m, "\tTotal: %llu\n", tot);
+}
+
+static void i915_guc_error_state(struct drm_i915_error_state_buf *m,
+				 struct drm_i915_private *dev_priv,
+				 struct drm_i915_error_state *error)
+{
+	struct intel_guc *guc = &error->guc;
+
+	i915_guc_firmware_info(m, dev_priv, &guc->guc_fw);
+	i915_guc_action_info(m, dev_priv, guc);
+
+	err_printf(m, "GuC execbuf client @ %p:\n", guc->execbuf_client);
+	i915_guc_client_info(m, dev_priv, &error->execbuf_client);
+
+	err_printf(m, "GuC preempt client @ %p:\n", guc->preempt_client);
+	i915_guc_client_info(m, dev_priv, &error->preempt_client);
+}
+
 void i915_error_printf(struct drm_i915_error_state_buf *e, const char *f, ...)
 {
 	va_list args;
@@ -467,6 +561,9 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
 	if (INTEL_INFO(dev)->gen == 7)
 		err_printf(m, "ERR_INT: 0x%08x\n", error->err_int);
 
+	if (HAS_GUC_UCODE(dev) || HAS_GUC_SCHED(dev))
+		i915_guc_error_state(m, dev_priv, error);
+
 	for (i = 0; i < ARRAY_SIZE(error->ring); i++)
 		i915_ring_error_state(m, dev, error, i);
 
@@ -1394,6 +1491,18 @@ static void i915_capture_reg_state(struct drm_i915_private *dev_priv,
 	i915_get_extra_instdone(dev, error->extra_instdone);
 }
 
+/* Capture information about GuC loading and submission, where enabled */
+static void i915_capture_guc_state(struct drm_i915_private *dev_priv,
+				   struct drm_i915_error_state *error)
+{
+	/* Just copy the state of the device for now */
+	error->guc = dev_priv->guc;
+	if (error->guc.execbuf_client)
+		error->execbuf_client = *error->guc.execbuf_client;
+	if (error->guc.preempt_client)
+		error->preempt_client = *error->guc.preempt_client;
+}
+
 static void i915_error_capture_msg(struct drm_device *dev,
 				   struct drm_i915_error_state *error,
 				   bool wedged,
@@ -1461,6 +1570,7 @@ void i915_capture_error_state(struct drm_device *dev, bool wedged,
 
 	i915_capture_gen_state(dev_priv, error);
 	i915_capture_reg_state(dev_priv, error);
+	i915_capture_guc_state(dev_priv, error);
 	i915_gem_capture_buffers(dev_priv, error);
 	i915_gem_record_fences(dev, error);
 	i915_gem_record_rings(dev, error);
-- 
1.9.1



More information about the Intel-gfx mailing list