[PATCH 00/10] RFC: hot-unplug safe connector list locking

Daniel Vetter daniel.vetter at ffwll.ch
Tue Jun 21 09:10:25 UTC 2016


Hi all,

This is a bit nightmare fuel, but I think it's the best we can aim for:
- locking doesn't leak to callers/drivers, no headaches with locking inversions
- it allows us (once fbdev is fixed) to drop the modeset_lock_all from mst
  unplug, cleaning up our locking hirarchy quite a bit

As a teaser of what this enables I've thrown three patches on top to drop a bit
of now superflous locking.

Todo:
- survive nightmares when reviewing this
- make sure all bits in i915 are covered (mostly depends upon Maarten's atomic
  iterator cleanup, which is progressing well)
- apply same love to amdgpu/radeon to handle hot-unplugging there too

Some of the other approaches I've discussed with Dave on irc, but didn't
implemented here:
- Go with a reallocating (rcu-protected) array instead of connector_list. Has
  the upside of catching every offender, but the downside of forcing churn onto
  every driver which doesn't care.
- Rework locking to again protect the connector_list with mode_config.mutex. Imo
  too hairy since that leaks the locking context out of every
  drm_connector_unreference (since it's no longer a pure leaf lock protecting
  things). Which tends to be real painful.
- Hope it works - we have the oopses already to prove otherwise :(

I think this implementation here strikes the best balance between invasiveness
and keeping locking concerns separated as much as possible. The one downside is
the implementation of the hot-unplug safe connector_list iterator.

Comments, screams of agony, testing and review highly welcome.

Cheers, Daniel

Daniel Vetter (10):
  drm/amd-kfd: Clean up inline handling
  drm: Don't compute obj counts expensively in get_resources
  drm: Add explicit iter struct to drm_for_each_connector
  drm/i915: Use use the drm_for_each_connector in i915_debugfs.c
  drm/i915: Roll out drm_for_each_connector in intel_hotplug.c
  drm: Drop cargo-culted modeset_lock_all from encoder/plane
    init/cleanup
  drm: Revamp connector_list protection
  drm: Drop mode_config.mutex from connector_register_all
  drm: Drop mode_config.mutex from get_resources ioctl
  drm: Drop mode_config.mutex from _reset()

 .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.h  |   4 +-
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h              |   3 -
 drivers/gpu/drm/drm_atomic.c                       |   3 +-
 drivers/gpu/drm/drm_atomic_helper.c                |  12 ++-
 drivers/gpu/drm/drm_crtc.c                         | 109 ++++++++++++---------
 drivers/gpu/drm/drm_crtc_helper.c                  |  21 ++--
 drivers/gpu/drm/drm_edid.c                         |   3 +-
 drivers/gpu/drm/drm_fb_helper.c                    |   3 +-
 drivers/gpu/drm/drm_plane_helper.c                 |   3 +-
 drivers/gpu/drm/drm_probe_helper.c                 |   9 +-
 drivers/gpu/drm/exynos/exynos_drm_drv.c            |   6 +-
 drivers/gpu/drm/i915/i915_debugfs.c                |  22 ++---
 drivers/gpu/drm/i915/intel_display.c               |   6 +-
 drivers/gpu/drm/i915/intel_dp_mst.c                |   2 +-
 drivers/gpu/drm/i915/intel_hotplug.c               |  16 +--
 drivers/gpu/drm/vc4/vc4_crtc.c                     |   3 +-
 include/drm/drm_crtc.h                             |  79 +++++++++++----
 17 files changed, 189 insertions(+), 115 deletions(-)

-- 
2.8.1



More information about the dri-devel mailing list