]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/gt: Wait for RCUs frees before asserting idle on unload
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 12 Mar 2020 11:53:07 +0000 (11:53 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Thu, 12 Mar 2020 20:47:24 +0000 (20:47 +0000)
During driver unload, we have many asserts that we have released our
bookkeeping structs and are idle. In some cases, these struct are
protected by RCU and we do not release them until after an RCU grace
period.

Reported-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Fixes: 4f15002c8cb0 ("drm/i915/gem: Consolidate ctx->engines[] release")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200312115307.16460-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gem/i915_gem_context.c
drivers/gpu/drm/i915/gt/intel_gt.c

index 895cedc3f0234074eade09a7a21b71d4f86c1c46..026999b34abdc93c64fccd5be89acb686c05fa53 100644 (file)
@@ -903,6 +903,7 @@ void i915_gem_init__contexts(struct drm_i915_private *i915)
 void i915_gem_driver_release__contexts(struct drm_i915_private *i915)
 {
        flush_work(&i915->gem.contexts.free_work);
+       rcu_barrier(); /* and flush the left over RCU frees */
 }
 
 static int gem_context_register(struct i915_gem_context *ctx,
index 3dea8881e915c16d18bb5c1a58548d327f3dafc6..d09f7596cb98b4fbb3e3d94edf54fb2740b430e4 100644 (file)
@@ -667,6 +667,9 @@ void intel_gt_driver_release(struct intel_gt *gt)
 
 void intel_gt_driver_late_release(struct intel_gt *gt)
 {
+       /* We need to wait for inflight RCU frees to release their grip */
+       rcu_barrier();
+
        intel_uc_driver_late_release(&gt->uc);
        intel_gt_fini_requests(gt);
        intel_gt_fini_reset(gt);