Commit efe79d48 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Context objects can never be active when freed

Due to how we only release the pining on the context state on
retirement and never track activity on the context vma itself, the
object can never be active at the point of release. Replace the
conditional transfer of ownership onto an active-reference with an
assert that the object is idle.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180625100604.22598-2-chris@chris-wilson.co.uk
parent dd12c6ca
...@@ -1344,7 +1344,9 @@ static void execlists_context_destroy(struct intel_context *ce) ...@@ -1344,7 +1344,9 @@ static void execlists_context_destroy(struct intel_context *ce)
return; return;
intel_ring_free(ce->ring); intel_ring_free(ce->ring);
__i915_gem_object_release_unless_active(ce->state->obj);
GEM_BUG_ON(i915_gem_object_is_active(ce->state->obj));
i915_gem_object_put(ce->state->obj);
} }
static void execlists_context_unpin(struct intel_context *ce) static void execlists_context_unpin(struct intel_context *ce)
......
...@@ -1167,8 +1167,11 @@ static void intel_ring_context_destroy(struct intel_context *ce) ...@@ -1167,8 +1167,11 @@ static void intel_ring_context_destroy(struct intel_context *ce)
{ {
GEM_BUG_ON(ce->pin_count); GEM_BUG_ON(ce->pin_count);
if (ce->state) if (!ce->state)
__i915_gem_object_release_unless_active(ce->state->obj); return;
GEM_BUG_ON(i915_gem_object_is_active(ce->state->obj));
i915_gem_object_put(ce->state->obj);
} }
static int __context_pin_ppgtt(struct i915_gem_context *ctx) static int __context_pin_ppgtt(struct i915_gem_context *ctx)
......
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