Skip to content

Commit fd0c064

Browse files
committed
drm/i915: disable interrupts earlier in the driver unload code
Our rps code relies on the interrupts being off to prevent re-arming of the work items at inopportune moments. Also drop the redundant cancel_work for the main rps work, disable_gt_powersave already takes care of that. Finally add a WARN_ON to ensure we obey that piece of ordering constraint. Long term I want to lock down the setup/teardown code in a similar way to how we painstakingly check modeset sequence constraints already. v2: Disable polling after hpd handling is shut down - since Egbert's hpd irq storm handling the hotplug work can re-arm the polling handler. Spotted by Jani Nikula. Cc: Jesse Barnes <[email protected]> Cc: Jani Nikula <[email protected]> Reviewed-by: Jani Nikula <[email protected]> Signed-off-by: Daniel Vetter <[email protected]>
1 parent d20d4f0 commit fd0c064

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

drivers/gpu/drm/i915/intel_display.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9530,12 +9530,23 @@ void intel_modeset_cleanup(struct drm_device *dev)
95309530
struct drm_crtc *crtc;
95319531
struct intel_crtc *intel_crtc;
95329532

9533+
/*
9534+
* Interrupts and polling as the first thing to avoid creating havoc.
9535+
* Too much stuff here (turning of rps, connectors, ...) would
9536+
* experience fancy races otherwise.
9537+
*/
9538+
drm_irq_uninstall(dev);
9539+
cancel_work_sync(&dev_priv->hotplug_work);
9540+
/*
9541+
* Due to the hpd irq storm handling the hotplug work can re-arm the
9542+
* poll handlers. Hence disable polling after hpd handling is shut down.
9543+
*/
95339544
drm_kms_helper_poll_fini(dev);
9545+
95349546
mutex_lock(&dev->struct_mutex);
95359547

95369548
intel_unregister_dsm_handler();
95379549

9538-
95399550
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
95409551
/* Skip inactive CRTCs */
95419552
if (!crtc->fb)
@@ -9553,12 +9564,6 @@ void intel_modeset_cleanup(struct drm_device *dev)
95539564

95549565
mutex_unlock(&dev->struct_mutex);
95559566

9556-
/* Disable the irq before mode object teardown, for the irq might
9557-
* enqueue unpin/hotplug work. */
9558-
drm_irq_uninstall(dev);
9559-
cancel_work_sync(&dev_priv->hotplug_work);
9560-
cancel_work_sync(&dev_priv->rps.work);
9561-
95629567
/* flush any delayed tasks or pending work */
95639568
flush_scheduled_work();
95649569

drivers/gpu/drm/i915/intel_pm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3671,6 +3671,9 @@ void intel_disable_gt_powersave(struct drm_device *dev)
36713671
{
36723672
struct drm_i915_private *dev_priv = dev->dev_private;
36733673

3674+
/* Interrupts should be disabled already to avoid re-arming. */
3675+
WARN_ON(dev->irq_enabled);
3676+
36743677
if (IS_IRONLAKE_M(dev)) {
36753678
ironlake_disable_drps(dev);
36763679
ironlake_disable_rc6(dev);

0 commit comments

Comments
 (0)