diff options
author | Jani Nikula <jani.nikula@intel.com> | 2022-09-05 18:00:51 +0300 |
---|---|---|
committer | Jani Nikula <jani.nikula@intel.com> | 2022-09-06 16:06:21 +0300 |
commit | 230bb131a6143b19a78031c64fb8f3b9320dc122 (patch) | |
tree | f4556833f1c63563e411532deff7eb4cfafe4963 /drivers/gpu/drm/i915/i915_gem.c | |
parent | c1bdf4aabc093f7741f6fc6f1a6e942b946283b2 (diff) | |
download | linux-230bb131a6143b19a78031c64fb8f3b9320dc122.tar.xz |
drm/i915: un-inline i915_gem_drain_workqueue()
i915_gem_drain_workqueue() is not used on any hot paths. Un-unline it.
Replace the do-while with a for loop while at it.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/2c89e7e0a3528caf7ba9ffa29b2bb9f13f2357d1.1662390010.git.jani.nikula@intel.com
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index c2d6172ba4bb..4c89b33ada95 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -1085,6 +1085,28 @@ out: return err; } +/* + * Similar to objects above (see i915_gem_drain_freed-objects), in general we + * have workers that are armed by RCU and then rearm themselves in their + * callbacks. To be paranoid, we need to drain the workqueue a second time after + * waiting for the RCU grace period so that we catch work queued via RCU from + * the first pass. As neither drain_workqueue() nor flush_workqueue() report a + * result, we make an assumption that we only don't require more than 3 passes + * to catch all _recursive_ RCU delayed work. + */ +void i915_gem_drain_workqueue(struct drm_i915_private *i915) +{ + int i; + + for (i = 0; i < 3; i++) { + flush_workqueue(i915->wq); + rcu_barrier(); + i915_gem_drain_freed_objects(i915); + } + + drain_workqueue(i915->wq); +} + int i915_gem_init(struct drm_i915_private *dev_priv) { int ret; |