[PATCH 35/35] drm/i915: Drop some RCU usage around context VMs

Jason Ekstrand jason at jlekstrand.net
Fri Jun 4 22:11:25 UTC 2021


This instance now only happens during context creation so there's no way
we can race with a context close/destroy.  We don't need to bother with
the RCU and can access the pointer directly.

Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
---
 drivers/gpu/drm/i915/gem/i915_gem_context.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c
index bd9214f0911f1..e659773814952 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
@@ -787,15 +787,12 @@ static int intel_context_set_gem(struct intel_context *ce,
 
 	ce->ring_size = SZ_16K;
 
-	if (rcu_access_pointer(ctx->vm)) {
-		struct i915_address_space *vm;
-
-		rcu_read_lock();
-		vm = context_get_vm_rcu(ctx); /* hmm */
-		rcu_read_unlock();
-
+	if (ctx->vm) {
+		/* This only happens during context creation so no need to
+		 * bother with any RCU nonsense.
+		 */
 		i915_vm_put(ce->vm);
-		ce->vm = vm;
+		ce->vm = i915_vm_get(ctx->vm);
 	}
 
 	if (ctx->sched.priority >= I915_PRIORITY_NORMAL &&
-- 
2.31.1



More information about the Intel-gfx-trybot mailing list