]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
drm/i915: Hold mode_config->mutex during hotplug processing
authorKeith Packard <keithp@keithp.com>
Mon, 25 Jul 2011 17:04:56 +0000 (10:04 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 16 Aug 2011 01:31:35 +0000 (18:31 -0700)
commit a65e34c79c88895766ab1f8a5afa451eed26622b upstream.

Hotplug detection is a mode setting operation and must hold the
struct_mutex or risk colliding with other mode setting operations.

In particular, the display port hotplug function attempts to re-train
the link if the monitor is supposed to be running when plugged back
in. If that happens while mode setting is underway, the link will get
scrambled, leaving it in an inconsistent state.

This is a special case -- usually the driver mode setting entry points
are covered by the upper level DRM code, but in this case the function
is invoked as a work function not under the control of DRM.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/gpu/drm/i915/i915_irq.c

index 3b03f85ea6276fc1f3d6d5beb67e7c004172a472..9da2a2c9995306bd8a6efb475e68cb84a4ebc831 100644 (file)
@@ -306,6 +306,7 @@ static void i915_hotplug_work_func(struct work_struct *work)
        struct drm_mode_config *mode_config = &dev->mode_config;
        struct intel_encoder *encoder;
 
+       mutex_lock(&mode_config->mutex);
        DRM_DEBUG_KMS("running encoder hotplug functions\n");
 
        list_for_each_entry(encoder, &mode_config->encoder_list, base.head)
@@ -314,6 +315,8 @@ static void i915_hotplug_work_func(struct work_struct *work)
 
        /* Just fire off a uevent and let userspace tell us what to do */
        drm_helper_hpd_irq_event(dev);
+
+       mutex_unlock(&mode_config->mutex);
 }
 
 static void i915_handle_rps_change(struct drm_device *dev)