Commit 6c0d9350 authored by Daniel Vetter's avatar Daniel Vetter Committed by Chris Wilson

drm/i915: unload: fix hotplug_work races

hotplug_work is queued by the hotplug interrupt and only either emits
a hotplug uevent or queues a crt poll slow-work. No other locking.  So
it's safe to cancel this work _after_ irq's have been turned off.  But
before the modesetting objects are destroyed because the hotplug
function accesses them (without locking).

The current code (for kms) only switches irqs off after modesetting
teardown, hence move the irq teardown into the modeset cleanup right
before the crtc cleanup.
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
parent bc0c7f14
...@@ -2275,7 +2275,7 @@ int i915_driver_unload(struct drm_device *dev) ...@@ -2275,7 +2275,7 @@ int i915_driver_unload(struct drm_device *dev)
dev_priv->child_dev = NULL; dev_priv->child_dev = NULL;
dev_priv->child_dev_num = 0; dev_priv->child_dev_num = 0;
} }
drm_irq_uninstall(dev);
vga_switcheroo_unregister_client(dev->pdev); vga_switcheroo_unregister_client(dev->pdev);
vga_client_register(dev->pdev, NULL, NULL, NULL); vga_client_register(dev->pdev, NULL, NULL, NULL);
} }
......
...@@ -6073,6 +6073,11 @@ void intel_modeset_cleanup(struct drm_device *dev) ...@@ -6073,6 +6073,11 @@ void intel_modeset_cleanup(struct drm_device *dev)
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
/* Disable the irq before mode object teardown, for the irq might
* enqueue unpin/hotplug work. */
drm_irq_uninstall(dev);
cancel_work_sync(&dev_priv->hotplug_work);
drm_mode_config_cleanup(dev); drm_mode_config_cleanup(dev);
} }
......
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