diff mbox

[2/2] drm/i915: add hangcheck action and score to error state

Message ID 1377868769-6049-2-git-send-email-mika.kuoppala@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mika Kuoppala Aug. 30, 2013, 1:19 p.m. UTC
Score and action reveal what the rings were doing
when hang was declared.

Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h       |    2 ++
 drivers/gpu/drm/i915/i915_gpu_error.c |   22 ++++++++++++++++++++++
 2 files changed, 24 insertions(+)

Comments

Chris Wilson Sept. 6, 2013, 9:15 a.m. UTC | #1
On Fri, Aug 30, 2013 at 04:19:29PM +0300, Mika Kuoppala wrote:
> Score and action reveal what the rings were doing
> when hang was declared.
> 
> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.h       |    2 ++
>  drivers/gpu/drm/i915/i915_gpu_error.c |   22 ++++++++++++++++++++++
>  2 files changed, 24 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 2c5f3bc..16629cc 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -326,6 +326,8 @@ struct drm_i915_error_state {
>  	u32 *active_bo_count, *pinned_bo_count;
>  	struct intel_overlay_error_state *overlay;
>  	struct intel_display_error_state *display;
> +	int hangcheck_score[I915_NUM_RINGS];
> +	enum intel_ring_hangcheck_action hangcheck_action[I915_NUM_RINGS];
>  };
>  
>  struct intel_crtc_config;
> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
> index aba9d74..7e92ba8 100644
> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
> @@ -213,6 +213,22 @@ static void print_error_buffers(struct drm_i915_error_state_buf *m,
>  	}
>  }
>  
> +static const char *hangcheck_action_to_str(enum intel_ring_hangcheck_action a)
> +{
> +	switch (a) {
> +	case HANGCHECK_WAIT:
> +		return "wait";
> +	case HANGCHECK_ACTIVE:
> +		return "active";
> +	case HANGCHECK_KICK:
> +		return "kick";
> +	case HANGCHECK_HUNG:
> +		return "hung";
> +	}
> +
> +	return "unknown";

Should be "none" or perhaps "idle".

> +}
> +
>  static void i915_ring_error_state(struct drm_i915_error_state_buf *m,
>  				  struct drm_device *dev,
>  				  struct drm_i915_error_state *error,
> @@ -253,6 +269,9 @@ static void i915_ring_error_state(struct drm_i915_error_state_buf *m,
>  	err_printf(m, "  waiting: %s\n", yesno(error->waiting[ring]));
>  	err_printf(m, "  ring->head: 0x%08x\n", error->cpu_ring_head[ring]);
>  	err_printf(m, "  ring->tail: 0x%08x\n", error->cpu_ring_tail[ring]);
> +	err_printf(m, "  hangcheck_action: %s\n",
> +		   hangcheck_action_to_str(error->hangcheck_action[ring]));
> +	err_printf(m, "  hangcheck_score: %d\n", error->hangcheck_score[ring]);
>  }

I would condense this to a single line
  hangcheck: wait [5]

So err_printf(m, "  hangcheck: %s [%d]\n", 
	      hangcheck_action_to_str(error->hangcheck_action[ring]),
	      error->hangcheck_score[ring]));
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 2c5f3bc..16629cc 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -326,6 +326,8 @@  struct drm_i915_error_state {
 	u32 *active_bo_count, *pinned_bo_count;
 	struct intel_overlay_error_state *overlay;
 	struct intel_display_error_state *display;
+	int hangcheck_score[I915_NUM_RINGS];
+	enum intel_ring_hangcheck_action hangcheck_action[I915_NUM_RINGS];
 };
 
 struct intel_crtc_config;
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index aba9d74..7e92ba8 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -213,6 +213,22 @@  static void print_error_buffers(struct drm_i915_error_state_buf *m,
 	}
 }
 
+static const char *hangcheck_action_to_str(enum intel_ring_hangcheck_action a)
+{
+	switch (a) {
+	case HANGCHECK_WAIT:
+		return "wait";
+	case HANGCHECK_ACTIVE:
+		return "active";
+	case HANGCHECK_KICK:
+		return "kick";
+	case HANGCHECK_HUNG:
+		return "hung";
+	}
+
+	return "unknown";
+}
+
 static void i915_ring_error_state(struct drm_i915_error_state_buf *m,
 				  struct drm_device *dev,
 				  struct drm_i915_error_state *error,
@@ -253,6 +269,9 @@  static void i915_ring_error_state(struct drm_i915_error_state_buf *m,
 	err_printf(m, "  waiting: %s\n", yesno(error->waiting[ring]));
 	err_printf(m, "  ring->head: 0x%08x\n", error->cpu_ring_head[ring]);
 	err_printf(m, "  ring->tail: 0x%08x\n", error->cpu_ring_tail[ring]);
+	err_printf(m, "  hangcheck_action: %s\n",
+		   hangcheck_action_to_str(error->hangcheck_action[ring]));
+	err_printf(m, "  hangcheck_score: %d\n", error->hangcheck_score[ring]);
 }
 
 void i915_error_printf(struct drm_i915_error_state_buf *e, const char *f, ...)
@@ -718,6 +737,9 @@  static void i915_record_ring_state(struct drm_device *dev,
 
 	error->cpu_ring_head[ring->id] = ring->head;
 	error->cpu_ring_tail[ring->id] = ring->tail;
+
+	error->hangcheck_score[ring->id] = ring->hangcheck.score;
+	error->hangcheck_action[ring->id] = ring->hangcheck.action;
 }