Skip to content

Commit 1cec344

Browse files
jkrzyszt-intelAndi Shyti
authored and
Andi Shyti
committed
drm/i915/gem: Flush contexts on driver release
Due to i915_perf assuming that it can use the i915_gem_context reference to protect its i915->gem.contexts.list iteration, we need to defer removal of the context from the list until last reference to the context is put. However, there is a risk of triggering kernel warning on contexts list not empty at driver release time if we deleagate that task to a worker for i915_gem_context_release_work(), unless that work is flushed first. Unfortunately, it is not flushed on driver release. Fix it. Instead of additionally calling flush_workqueue(), either directly or via a new dedicated wrapper around it, replace last call to i915_gem_drain_freed_objects() with existing i915_gem_drain_workqueue() that performs both tasks. Fixes: 75eefd8 ("drm/i915: Release i915_gem_context from a worker") Suggested-by: Chris Wilson <[email protected]> Signed-off-by: Janusz Krzysztofik <[email protected]> Reviewed-by: Andi Shyti <[email protected]> Cc: [email protected] # v5.16+ Signed-off-by: Andi Shyti <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 14f2f9b commit 1cec344

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/gpu/drm/i915/i915_gem.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,8 @@ void i915_gem_driver_release(struct drm_i915_private *dev_priv)
12141214
intel_uc_cleanup_firmwares(&gt->uc);
12151215
}
12161216

1217-
i915_gem_drain_freed_objects(dev_priv);
1217+
/* Flush any outstanding work, including i915_gem_context.release_work. */
1218+
i915_gem_drain_workqueue(dev_priv);
12181219

12191220
drm_WARN_ON(&dev_priv->drm, !list_empty(&dev_priv->gem.contexts.list));
12201221
}

0 commit comments

Comments
 (0)