Commit 141f3767 authored by Janusz Krzysztofik's avatar Janusz Krzysztofik Committed by Chris Wilson

drm/i915: Mark GEM wedged right after marking device unplugged

As soon as a device is considered unplugged, not only prevent pending
users from accessing the device structures but also cancel all their
pending requests so all consumed resources can be cleaned up as soon
as possible.
Suggested-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarJanusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20190406104034.31380-1-chris@chris-wilson.co.uk
parent 95007efb
...@@ -1907,6 +1907,13 @@ void i915_driver_unload(struct drm_device *dev) ...@@ -1907,6 +1907,13 @@ void i915_driver_unload(struct drm_device *dev)
i915_driver_unregister(dev_priv); i915_driver_unregister(dev_priv);
/*
* After unregistering the device to prevent any new users, cancel
* all in-flight requests so that we can quickly unbind the active
* resources.
*/
i915_gem_set_wedged(dev_priv);
/* Flush any external code that still may be under the RCU lock */ /* Flush any external code that still may be under the RCU lock */
synchronize_rcu(); synchronize_rcu();
......
...@@ -2917,6 +2917,7 @@ static inline void i915_gem_drain_workqueue(struct drm_i915_private *i915) ...@@ -2917,6 +2917,7 @@ static inline void i915_gem_drain_workqueue(struct drm_i915_private *i915)
int pass = 2; int pass = 2;
do { do {
rcu_barrier(); rcu_barrier();
i915_gem_drain_freed_objects(i915);
drain_workqueue(i915->wq); drain_workqueue(i915->wq);
} while (--pass); } while (--pass);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment