[PATCH] drm/i915/gt: Warn more clearly if the context state is still pinned

Chris Wilson chris at chris-wilson.co.uk
Wed Apr 22 21:24:57 UTC 2020


When recording the default context state, we submit an ordinary context
and then steal the context image for our defaults. To be able to steal
the state, we must have total ownership of the context. During CI we
want to make this error extremely obvious, as otherwise we will fail the
user's module load.

References: https://gitlab.freedesktop.org/drm/intel/-/issues/1763
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/gt/intel_gt.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/intel_gt.c
index 1c99cc72305a..b082a26aa08e 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt.c
@@ -379,6 +379,13 @@ static int __intel_context_flush_retire(struct intel_context *ce)
 		return PTR_ERR(tl);
 
 	intel_context_timeline_unlock(tl);
+
+	/* Wait for the barrier */
+	if (i915_active_wait(&ce->active))
+		return -EINTR;
+
+	i915_active_unlock_wait(&ce->active);
+
 	return 0;
 }
 
@@ -472,6 +479,7 @@ static int __engines_record_defaults(struct intel_gt *gt)
 
 		/* We want to be able to unbind the state from the GGTT */
 		GEM_BUG_ON(intel_context_is_pinned(rq->context));
+		GEM_BUG_ON(i915_vma_is_pinned(state));
 
 		/*
 		 * As we will hold a reference to the logical state, it will
-- 
2.20.1



More information about the Intel-gfx-trybot mailing list