Commit 0e58de9f authored by Chris Wilson's avatar Chris Wilson

drm/i915/gt: Check the virtual still matches upon locking

If another sibling is able to claim the virtual request, by the time we
inspect the request under the lock it may no longer match the local
engine.

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/2877Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarAndi Shyti <andi.shyti@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210104115145.24460-4-chris@chris-wilson.co.uk
parent 0a7d355e
......@@ -1016,6 +1016,9 @@ static bool virtual_matches(const struct virtual_engine *ve,
{
const struct intel_engine_cs *inflight;
if (!rq)
return false;
if (!(rq->execution_mask & engine->mask)) /* We peeked too soon! */
return false;
......@@ -1423,8 +1426,8 @@ static void execlists_dequeue(struct intel_engine_cs *engine)
spin_lock(&ve->base.active.lock);
rq = ve->request;
if (unlikely(!rq)) /* lost the race to a sibling */
goto unlock;
if (unlikely(!virtual_matches(ve, rq, engine)))
goto unlock; /* lost the race to a sibling */
GEM_BUG_ON(rq->engine != &ve->base);
GEM_BUG_ON(rq->context != &ve->context);
......@@ -1434,8 +1437,6 @@ static void execlists_dequeue(struct intel_engine_cs *engine)
break;
}
GEM_BUG_ON(!virtual_matches(ve, rq, engine));
if (last && !can_merge_rq(last, rq)) {
spin_unlock(&ve->base.active.lock);
spin_unlock(&engine->active.lock);
......
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