diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2017-08-16 04:52:05 -0400 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2017-08-18 06:57:13 -0400 |
commit | 8bcbfb12818f811d63801b71d25809690d1798fc (patch) | |
tree | 530b7c882fc4cbba06f77f2f102d79545f73026d | |
parent | f2f5c0610fbc251b127a6fffda6c651288695430 (diff) |
drm/i915: Check context status before looking up our obj/vma
Since we keep the context around across the slow lookup where we may
drop the struct_mutex, we should double check that the context is still
valid upon reacquisition.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20170816085210.4199-2-chris@chris-wilson.co.uk
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_execbuffer.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 359d5dc6d8df..044fb1205554 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | |||
@@ -679,13 +679,6 @@ static int eb_select_context(struct i915_execbuffer *eb) | |||
679 | if (unlikely(!ctx)) | 679 | if (unlikely(!ctx)) |
680 | return -ENOENT; | 680 | return -ENOENT; |
681 | 681 | ||
682 | if (unlikely(i915_gem_context_is_banned(ctx))) { | ||
683 | DRM_DEBUG("Context %u tried to submit while banned\n", | ||
684 | ctx->user_handle); | ||
685 | i915_gem_context_put(ctx); | ||
686 | return -EIO; | ||
687 | } | ||
688 | |||
689 | eb->ctx = ctx; | 682 | eb->ctx = ctx; |
690 | eb->vm = ctx->ppgtt ? &ctx->ppgtt->base : &eb->i915->ggtt.base; | 683 | eb->vm = ctx->ppgtt ? &ctx->ppgtt->base : &eb->i915->ggtt.base; |
691 | 684 | ||
@@ -707,6 +700,12 @@ static int eb_lookup_vmas(struct i915_execbuffer *eb) | |||
707 | int slow_pass = -1; | 700 | int slow_pass = -1; |
708 | int err; | 701 | int err; |
709 | 702 | ||
703 | if (unlikely(i915_gem_context_is_closed(eb->ctx))) | ||
704 | return -ENOENT; | ||
705 | |||
706 | if (unlikely(i915_gem_context_is_banned(eb->ctx))) | ||
707 | return -EIO; | ||
708 | |||
710 | INIT_LIST_HEAD(&eb->relocs); | 709 | INIT_LIST_HEAD(&eb->relocs); |
711 | INIT_LIST_HEAD(&eb->unbound); | 710 | INIT_LIST_HEAD(&eb->unbound); |
712 | 711 | ||