[Intel-gfx] [RFC][PATCH 11/11] drm: Sprinkle lockdep asserts for edid/display_info
Ville Syrjala
ville.syrjala at linux.intel.com
Tue Feb 27 12:57:00 UTC 2018
From: Ville Syrjälä <ville.syrjala at linux.intel.com>
edid and display_info are protected by mode_config.mutex. Add lockdep
asserts to make sure we're not accessing things w/o the lock.
FIXME: pretty sure this will blow up with amdgpu as they seem
to be doing edid updates even from the modeset path. Need to figure
out what to do about that. Maybe protect the edid/display info with
with connection_mutex instead of mode_config.mutex?
Cc: Keith Packard <keithp at keithp.com>
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
Cc: Harry Wentland <harry.wentland at amd.com>
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
drivers/gpu/drm/drm_connector.c | 4 ++++
drivers/gpu/drm/drm_edid.c | 2 ++
drivers/gpu/drm/drm_probe_helper.c | 2 +-
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 122060792b6f..a9f3536f4e94 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -1374,6 +1374,8 @@ int drm_mode_connector_update_edid_property(struct drm_connector *connector,
size_t size = 0;
int ret;
+ lockdep_assert_held(&dev->mode_config.mutex);
+
/* ignore requests to set edid when overridden */
if (connector->override_edid)
return 0;
@@ -1770,6 +1772,8 @@ void drm_connector_reset_display_info(struct drm_connector *connector)
{
struct drm_display_info *info = &connector->display_info;
+ lockdep_assert_held(&connector->dev->mode_config.mutex);
+
memset(info, 0, sizeof(*info));
}
EXPORT_SYMBOL_GPL(drm_connector_reset_display_info);
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 618093c4a039..7f9e9236114b 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -4440,6 +4440,8 @@ u32 drm_add_display_info(struct drm_connector *connector, const struct edid *edi
struct drm_display_info *info = &connector->display_info;
u32 quirks = edid_get_quirks(edid);
+ lockdep_assert_held(&connector->dev->mode_config.mutex);
+
info->width_mm = edid->width_cm * 10;
info->height_mm = edid->height_cm * 10;
diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
index 7dc7e635d7e4..2a2afcf72788 100644
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -400,7 +400,7 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
enum drm_connector_status old_status;
struct drm_modeset_acquire_ctx ctx;
- WARN_ON(!mutex_is_locked(&dev->mode_config.mutex));
+ lockdep_assert_held(&dev->mode_config.mutex);
drm_modeset_acquire_init(&ctx, 0);
--
2.13.6
More information about the Intel-gfx
mailing list