[PATCH v2 3/3] drm/i915: Check for a stuck waiter before a missed interrupt

Chris Wilson
2016-07-21T06:57:52Z

As the interrupt wakeup counter only increments when we have a waiter,
before testing to see if that counter is unchanged we have to first
check that we do expect it to change (i.e. we have a waiter).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
drivers/gpu/drm/i915/i915_irq.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 7104dc1463eb..45afcdfe89b1 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -3062,7 +3062,9 @@ static unsigned long kick_waiters(struct intel_engine_cs *engine)
struct drm_i915_private *i915 = engine->i915;
unsigned long irq_count = READ_ONCE(engine->breadcrumbs.irq_wakeups);

- if (engine->hangcheck.user_interrupts == irq_count &&
+ rcu_read_lock();
+ if (intel_engine_wakeup(engine) &&
+ engine->hangcheck.user_interrupts == irq_count &&
!test_and_set_bit(engine->id, &i915->gpu_error.missed_irq_rings)) {
if (!test_bit(engine->id, &i915->gpu_error.test_irq_rings))
DRM_ERROR("Hangcheck timer elapsed... %s idle\n",
@@ -3070,6 +3072,7 @@ static unsigned long kick_waiters(struct intel_engine_cs *engine)

intel_engine_enable_fake_irq(engine);
}
+ rcu_read_unlock();

return irq_count;
}
--
2.8.1