From ad8beaeada276b4b2d31e1c3422346e8829a67d6 Mon Sep 17 00:00:00 2001 From: Mika Kuoppala Date: Wed, 12 Jun 2013 12:35:32 +0300 Subject: [PATCH] drm/i915: store ring hangcheck action For guilty batchbuffer analysis later on when rings are reset, store what state the ring was on when hang was declared. This helps to weed out the waiting rings from the active ones. Signed-off-by: Mika Kuoppala Reviewed-by: Chris Wilson Acked-by: Ben Widawsky Signed-off-by: Daniel Vetter --- drivers/gpu/drm/i915/i915_irq.c | 8 ++++++-- drivers/gpu/drm/i915/intel_ringbuffer.h | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index b26243f09c91..208e6753aec5 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c @@ -2380,7 +2380,8 @@ static void semaphore_clear_deadlocks(struct drm_i915_private *dev_priv) ring->hangcheck.deadlock = false; } -static enum { wait, active, kick, hung } ring_stuck(struct intel_ring_buffer *ring, u32 acthd) +static enum intel_ring_hangcheck_action +ring_stuck(struct intel_ring_buffer *ring, u32 acthd) { struct drm_device *dev = ring->dev; struct drm_i915_private *dev_priv = dev->dev_private; @@ -2483,7 +2484,10 @@ void i915_hangcheck_elapsed(unsigned long data) * being repeatedly kicked and so responsible * for stalling the machine. */ - switch (ring_stuck(ring, acthd)) { + ring->hangcheck.action = ring_stuck(ring, + acthd); + + switch (ring->hangcheck.action) { case wait: score = 0; break; diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index a3e96103dbe5..799f04c9da45 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h @@ -37,11 +37,14 @@ struct intel_hw_status_page { #define I915_READ_SYNC_0(ring) I915_READ(RING_SYNC_0((ring)->mmio_base)) #define I915_READ_SYNC_1(ring) I915_READ(RING_SYNC_1((ring)->mmio_base)) +enum intel_ring_hangcheck_action { wait, active, kick, hung }; + struct intel_ring_hangcheck { bool deadlock; u32 seqno; u32 acthd; int score; + enum intel_ring_hangcheck_action action; }; struct intel_ring_buffer { -- 2.39.5