aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2014-06-05 05:12:03 -0400
committerDave Airlie <airlied@redhat.com>2014-06-05 17:08:17 -0400
commitc7560f1281640b1232d1c3cb242aabf5bd83a857 (patch)
tree72970588b2e6ebbb98aecc61c02208b5a3e9ebf8
parent8d4ad9d4bb0a618c975a32d77087694ec6336f68 (diff)
drm: Fix getconnector connection_mutex locking
I've fumbled my own idea and enthusiastically wrapped all the getconnector code with the connection_mutex. But we only need it to chase the connector->encoder link. Even there it's not really needed since races with userspace won't matter, but better paranoid and consistent about this stuff. If we grap it everywhere connector probe callbacks can't grab it themselves, which means they'll deadlock. i915 does that for the load detect pipe. Furthermore i915 needs to do a ww dance since we also need to grab the mutex of the load detect crtc. This is a regression from commit 6e9f798d91c526982cca0026cd451e8fdbf18aaf Author: Daniel Vetter <daniel.vetter@ffwll.ch> Date: Thu May 29 23:54:47 2014 +0200 drm: Split connection_mutex out of mode_config.mutex (v3) Cc: Rob Clark <robdclark@gmail.com> Cc: Dave Airlie <airlied@redhat.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/drm_crtc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 43735f38cd17..239342f554b4 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1838,7 +1838,6 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
1838 DRM_DEBUG_KMS("[CONNECTOR:%d:?]\n", out_resp->connector_id); 1838 DRM_DEBUG_KMS("[CONNECTOR:%d:?]\n", out_resp->connector_id);
1839 1839
1840 mutex_lock(&dev->mode_config.mutex); 1840 mutex_lock(&dev->mode_config.mutex);
1841 drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
1842 1841
1843 connector = drm_connector_find(dev, out_resp->connector_id); 1842 connector = drm_connector_find(dev, out_resp->connector_id);
1844 if (!connector) { 1843 if (!connector) {
@@ -1872,10 +1871,12 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
1872 out_resp->mm_height = connector->display_info.height_mm; 1871 out_resp->mm_height = connector->display_info.height_mm;
1873 out_resp->subpixel = connector->display_info.subpixel_order; 1872 out_resp->subpixel = connector->display_info.subpixel_order;
1874 out_resp->connection = connector->status; 1873 out_resp->connection = connector->status;
1874 drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
1875 if (connector->encoder) 1875 if (connector->encoder)
1876 out_resp->encoder_id = connector->encoder->base.id; 1876 out_resp->encoder_id = connector->encoder->base.id;
1877 else 1877 else
1878 out_resp->encoder_id = 0; 1878 out_resp->encoder_id = 0;
1879 drm_modeset_unlock(&dev->mode_config.connection_mutex);
1879 1880
1880 /* 1881 /*
1881 * This ioctl is called twice, once to determine how much space is 1882 * This ioctl is called twice, once to determine how much space is
@@ -1937,7 +1938,6 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
1937 out_resp->count_encoders = encoders_count; 1938 out_resp->count_encoders = encoders_count;
1938 1939
1939out: 1940out:
1940 drm_modeset_unlock(&dev->mode_config.connection_mutex);
1941 mutex_unlock(&dev->mode_config.mutex); 1941 mutex_unlock(&dev->mode_config.mutex);
1942 1942
1943 return ret; 1943 return ret;