Commit 1934f5de authored by Chris Wilson's avatar Chris Wilson

drm/i915: Assert we idle in the kernel context

Now that we always switch to the kernel context upon idling, we can
make that assertion.

References: 4dfacb0b ("drm/i915: Switch to kernel context before idling at runtime")
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: default avatarMika Kuoppala <mika.kuoppala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180531224057.6036-1-chris@chris-wilson.co.uk
parent ec92ad00
...@@ -3498,6 +3498,22 @@ new_requests_since_last_retire(const struct drm_i915_private *i915) ...@@ -3498,6 +3498,22 @@ new_requests_since_last_retire(const struct drm_i915_private *i915)
work_pending(&i915->gt.idle_work.work)); work_pending(&i915->gt.idle_work.work));
} }
static void assert_kernel_context_is_current(struct drm_i915_private *i915)
{
struct intel_engine_cs *engine;
enum intel_engine_id id;
if (i915_terminally_wedged(&i915->gpu_error))
return;
GEM_BUG_ON(i915->gt.active_requests);
for_each_engine(engine, i915, id) {
GEM_BUG_ON(__i915_gem_active_peek(&engine->timeline.last_request));
GEM_BUG_ON(engine->last_retired_context !=
to_intel_context(i915->kernel_context, engine));
}
}
static void static void
i915_gem_idle_work_handler(struct work_struct *work) i915_gem_idle_work_handler(struct work_struct *work)
{ {
...@@ -3560,6 +3576,8 @@ i915_gem_idle_work_handler(struct work_struct *work) ...@@ -3560,6 +3576,8 @@ i915_gem_idle_work_handler(struct work_struct *work)
epoch = __i915_gem_park(dev_priv); epoch = __i915_gem_park(dev_priv);
assert_kernel_context_is_current(dev_priv);
rearm_hangcheck = false; rearm_hangcheck = false;
out_unlock: out_unlock:
mutex_unlock(&dev_priv->drm.struct_mutex); mutex_unlock(&dev_priv->drm.struct_mutex);
...@@ -4944,19 +4962,6 @@ void __i915_gem_object_release_unless_active(struct drm_i915_gem_object *obj) ...@@ -4944,19 +4962,6 @@ void __i915_gem_object_release_unless_active(struct drm_i915_gem_object *obj)
i915_gem_object_put(obj); i915_gem_object_put(obj);
} }
static void assert_kernel_context_is_current(struct drm_i915_private *i915)
{
struct i915_gem_context *kctx = i915->kernel_context;
struct intel_engine_cs *engine;
enum intel_engine_id id;
GEM_BUG_ON(i915->gt.active_requests);
for_each_engine(engine, i915, id) {
GEM_BUG_ON(__i915_gem_active_peek(&engine->timeline.last_request));
GEM_BUG_ON(engine->last_retired_context->gem_context != kctx);
}
}
void i915_gem_sanitize(struct drm_i915_private *i915) void i915_gem_sanitize(struct drm_i915_private *i915)
{ {
struct intel_engine_cs *engine; struct intel_engine_cs *engine;
......
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