mirror of https://gitee.com/openkylin/linux.git
drm/i915: track ring progression using seqnos
Instead of relying in acthd, track ring seqno progression to detect if ring has hung. v2: put hangcheck stuff inside struct (Chris Wilson) v3: initialize hangcheck.seqno (Ben Widawsky) Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com> Reviewed-by: Ben Widawsky <ben@bwidawsk.net> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
79ee20dc85
commit
92cab73451
|
@ -842,8 +842,6 @@ struct i915_gpu_error {
|
||||||
#define DRM_I915_HANGCHECK_JIFFIES msecs_to_jiffies(DRM_I915_HANGCHECK_PERIOD)
|
#define DRM_I915_HANGCHECK_JIFFIES msecs_to_jiffies(DRM_I915_HANGCHECK_PERIOD)
|
||||||
struct timer_list hangcheck_timer;
|
struct timer_list hangcheck_timer;
|
||||||
int hangcheck_count;
|
int hangcheck_count;
|
||||||
uint32_t last_acthd[I915_NUM_RINGS];
|
|
||||||
uint32_t prev_instdone[I915_NUM_INSTDONE_REG];
|
|
||||||
|
|
||||||
/* For reset and error_state handling. */
|
/* For reset and error_state handling. */
|
||||||
spinlock_t lock;
|
spinlock_t lock;
|
||||||
|
|
|
@ -2384,22 +2384,19 @@ void i915_hangcheck_elapsed(unsigned long data)
|
||||||
{
|
{
|
||||||
struct drm_device *dev = (struct drm_device *)data;
|
struct drm_device *dev = (struct drm_device *)data;
|
||||||
drm_i915_private_t *dev_priv = dev->dev_private;
|
drm_i915_private_t *dev_priv = dev->dev_private;
|
||||||
uint32_t acthd[I915_NUM_RINGS], instdone[I915_NUM_INSTDONE_REG];
|
|
||||||
struct intel_ring_buffer *ring;
|
struct intel_ring_buffer *ring;
|
||||||
bool err = false, idle;
|
bool err = false, idle;
|
||||||
int i;
|
int i;
|
||||||
|
u32 seqno[I915_NUM_RINGS];
|
||||||
|
bool work_done;
|
||||||
|
|
||||||
if (!i915_enable_hangcheck)
|
if (!i915_enable_hangcheck)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
memset(acthd, 0, sizeof(acthd));
|
|
||||||
idle = true;
|
idle = true;
|
||||||
for_each_ring(ring, dev_priv, i) {
|
for_each_ring(ring, dev_priv, i) {
|
||||||
u32 seqno;
|
seqno[i] = ring->get_seqno(ring, false);
|
||||||
|
idle &= i915_hangcheck_ring_idle(ring, seqno[i], &err);
|
||||||
seqno = ring->get_seqno(ring, false);
|
|
||||||
idle &= i915_hangcheck_ring_idle(ring, seqno, &err);
|
|
||||||
acthd[i] = intel_ring_get_active_head(ring);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If all work is done then ACTHD clearly hasn't advanced. */
|
/* If all work is done then ACTHD clearly hasn't advanced. */
|
||||||
|
@ -2415,20 +2412,19 @@ void i915_hangcheck_elapsed(unsigned long data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
i915_get_extra_instdone(dev, instdone);
|
work_done = false;
|
||||||
if (memcmp(dev_priv->gpu_error.last_acthd, acthd,
|
for_each_ring(ring, dev_priv, i) {
|
||||||
sizeof(acthd)) == 0 &&
|
if (ring->hangcheck.seqno != seqno[i]) {
|
||||||
memcmp(dev_priv->gpu_error.prev_instdone, instdone,
|
work_done = true;
|
||||||
sizeof(instdone)) == 0) {
|
ring->hangcheck.seqno = seqno[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!work_done) {
|
||||||
if (i915_hangcheck_hung(dev))
|
if (i915_hangcheck_hung(dev))
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
dev_priv->gpu_error.hangcheck_count = 0;
|
dev_priv->gpu_error.hangcheck_count = 0;
|
||||||
|
|
||||||
memcpy(dev_priv->gpu_error.last_acthd, acthd,
|
|
||||||
sizeof(acthd));
|
|
||||||
memcpy(dev_priv->gpu_error.prev_instdone, instdone,
|
|
||||||
sizeof(instdone));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
repeat:
|
repeat:
|
||||||
|
|
|
@ -1502,6 +1502,7 @@ void intel_ring_init_seqno(struct intel_ring_buffer *ring, u32 seqno)
|
||||||
}
|
}
|
||||||
|
|
||||||
ring->set_seqno(ring, seqno);
|
ring->set_seqno(ring, seqno);
|
||||||
|
ring->hangcheck.seqno = seqno;
|
||||||
}
|
}
|
||||||
|
|
||||||
void intel_ring_advance(struct intel_ring_buffer *ring)
|
void intel_ring_advance(struct intel_ring_buffer *ring)
|
||||||
|
|
|
@ -37,6 +37,10 @@ struct intel_hw_status_page {
|
||||||
#define I915_READ_SYNC_0(ring) I915_READ(RING_SYNC_0((ring)->mmio_base))
|
#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))
|
#define I915_READ_SYNC_1(ring) I915_READ(RING_SYNC_1((ring)->mmio_base))
|
||||||
|
|
||||||
|
struct intel_ring_hangcheck {
|
||||||
|
u32 seqno;
|
||||||
|
};
|
||||||
|
|
||||||
struct intel_ring_buffer {
|
struct intel_ring_buffer {
|
||||||
const char *name;
|
const char *name;
|
||||||
enum intel_ring_id {
|
enum intel_ring_id {
|
||||||
|
@ -137,6 +141,8 @@ struct intel_ring_buffer {
|
||||||
struct i915_hw_context *default_context;
|
struct i915_hw_context *default_context;
|
||||||
struct i915_hw_context *last_context;
|
struct i915_hw_context *last_context;
|
||||||
|
|
||||||
|
struct intel_ring_hangcheck hangcheck;
|
||||||
|
|
||||||
void *private;
|
void *private;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue