Commit 19d0a572 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Defer enabling hangcheck to the first fake breadcrumb interrupt

By deferring hangcheck to the fake breadcrumb interrupt, we can simply
the enabling procedure slightly - as by enabling the fake, we then
enable the hangcheck. By always enabling the hangcheck from each fake
interrupt (it will be a no-op for an already queued hangcheck), it will
make restoring the breadcrumbs after a reset simpler in the next patch.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227205850.2828-3-chris@chris-wilson.co.uk
parent 56299fb7
...@@ -75,17 +75,6 @@ static void intel_breadcrumbs_hangcheck(unsigned long data) ...@@ -75,17 +75,6 @@ static void intel_breadcrumbs_hangcheck(unsigned long data)
DRM_DEBUG("Hangcheck timer elapsed... %s idle\n", engine->name); DRM_DEBUG("Hangcheck timer elapsed... %s idle\n", engine->name);
set_bit(engine->id, &engine->i915->gpu_error.missed_irq_rings); set_bit(engine->id, &engine->i915->gpu_error.missed_irq_rings);
mod_timer(&engine->breadcrumbs.fake_irq, jiffies + 1); mod_timer(&engine->breadcrumbs.fake_irq, jiffies + 1);
/* Ensure that even if the GPU hangs, we get woken up.
*
* However, note that if no one is waiting, we never notice
* a gpu hang. Eventually, we will have to wait for a resource
* held by the GPU and so trigger a hangcheck. In the most
* pathological case, this will be upon memory starvation! To
* prevent this, we also queue the hangcheck from the retire
* worker.
*/
i915_queue_hangcheck(engine->i915);
} }
static void intel_breadcrumbs_fake_irq(unsigned long data) static void intel_breadcrumbs_fake_irq(unsigned long data)
...@@ -99,8 +88,21 @@ static void intel_breadcrumbs_fake_irq(unsigned long data) ...@@ -99,8 +88,21 @@ static void intel_breadcrumbs_fake_irq(unsigned long data)
* every jiffie in order to kick the oldest waiter to do the * every jiffie in order to kick the oldest waiter to do the
* coherent seqno check. * coherent seqno check.
*/ */
if (intel_engine_wakeup(engine)) if (!intel_engine_wakeup(engine))
return;
mod_timer(&engine->breadcrumbs.fake_irq, jiffies + 1); mod_timer(&engine->breadcrumbs.fake_irq, jiffies + 1);
/* Ensure that even if the GPU hangs, we get woken up.
*
* However, note that if no one is waiting, we never notice
* a gpu hang. Eventually, we will have to wait for a resource
* held by the GPU and so trigger a hangcheck. In the most
* pathological case, this will be upon memory starvation! To
* prevent this, we also queue the hangcheck from the retire
* worker.
*/
i915_queue_hangcheck(engine->i915);
} }
static void irq_enable(struct intel_engine_cs *engine) static void irq_enable(struct intel_engine_cs *engine)
...@@ -179,13 +181,11 @@ static void __intel_breadcrumbs_enable_irq(struct intel_breadcrumbs *b) ...@@ -179,13 +181,11 @@ static void __intel_breadcrumbs_enable_irq(struct intel_breadcrumbs *b)
b->irq_enabled = true; b->irq_enabled = true;
} }
if (!b->irq_enabled || use_fake_irq(b)) {
mod_timer(&b->fake_irq, jiffies + 1);
i915_queue_hangcheck(i915);
} else {
/* Ensure we never sleep indefinitely */ /* Ensure we never sleep indefinitely */
if (!b->irq_enabled || use_fake_irq(b))
mod_timer(&b->fake_irq, jiffies + 1);
else
mod_timer(&b->hangcheck, wait_timeout()); mod_timer(&b->hangcheck, wait_timeout());
}
} }
static void __intel_breadcrumbs_disable_irq(struct intel_breadcrumbs *b) static void __intel_breadcrumbs_disable_irq(struct intel_breadcrumbs *b)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment