[RFCv2 12/12] drm/i915: Extended error state with TDR count, watchdog count and engine reset count

Tomas Elf
2015-07-21T14:00:59Z

These new TDR-specific metrics have previously been added to
i915_hangcheck_info() in debugfs. During design review Chris Wilson asked for
these metrics to be added to the error state as well.

Signed-off-by: Tomas Elf <tomas.elf@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
drivers/gpu/drm/i915/i915_drv.h | 3 +++
drivers/gpu/drm/i915/i915_gpu_error.c | 6 ++++++
2 files changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 2cf8b38..862e995 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -447,6 +447,9 @@ struct drm_i915_error_state {
int hangcheck_score;
enum intel_ring_hangcheck_action hangcheck_action;
int num_requests;
+ int hangcheck_tdr_count;
+ int hangcheck_watchdog_count;
+ int hangcheck_reset_count;

/* our own tracking of ring head and tail */
u32 cpu_ring_head;
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index cee1825..f4d89df 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -303,6 +303,9 @@ 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, " TDR count: %d\n", ring->hangcheck_tdr_count);
+ err_printf(m, " Watchdog count: %d\n", ring->hangcheck_watchdog_count);
+ err_printf(m, " Engine reset count: %d\n", ring->hangcheck_reset_count);
}

void i915_error_printf(struct drm_i915_error_state_buf *e, const char *f, ...)
@@ -920,6 +923,9 @@ static void i915_record_ring_state(struct drm_device *dev,

ering->hangcheck_score = ring->hangcheck.score;
ering->hangcheck_action = ring->hangcheck.action;
+ ering->hangcheck_tdr_count = ring->hangcheck.tdr_count;
+ ering->hangcheck_watchdog_count = ring->hangcheck.watchdog_count;
+ ering->hangcheck_reset_count = ring->hangcheck.reset_count;

if (USES_PPGTT(dev)) {
int i;