aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <[email protected]>2021-01-04 11:51:43 +0000
committerChris Wilson <[email protected]>2021-01-05 09:18:05 +0000
commit0e58de9fc939e7552808f267bffde0b31feaf08a (patch)
tree8e97cdb386f1a4ec5616f7d4ec0a719880258009
parent0a7d355ec6043bc28929844e74ac2b0046409ebc (diff)
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/2877 Signed-off-by: Chris Wilson <[email protected]> Reviewed-by: Andi Shyti <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
-rw-r--r--drivers/gpu/drm/i915/gt/intel_execlists_submission.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/gt/intel_execlists_submission.c b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
index f02e3ae10d28..a5b442683c18 100644
--- a/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
+++ b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
@@ -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 @@ check_secondary:
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 @@ check_secondary:
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);