[lkml]   [2020]   [Mar]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 2/3] drm/dp_mst: Don't show connectors as connected before probing available PBN
It's next to impossible for us to do connector probing on topologies
without occasionally racing with userspace, since creating a connector
itself causes a hotplug event which we have to send before probing the
available PBN of a connector. Even if we didn't have this hotplug event
sent, there's still always a chance that userspace started probing
connectors before we finished probing the topology.

This can be a problem when validating a new MST state since the
connector will be shown as connected briefly, but without any available
PBN - causing any atomic state which would enable said connector to fail
with -ENOSPC. So, let's simply workaround this by telling userspace new
MST connectors are disconnected until we've finished probing their PBN.
Since we always send a hotplug event at the end of the link address
probing process, userspace will still know to reprobe the connector when
we're ready.

Signed-off-by: Lyude Paul <>
Fixes: cd82d82cbc04 ("drm/dp_mst: Add branch bandwidth validation to MST atomic check")
Cc: Mikita Lipski <>
Cc: Alex Deucher <>
Cc: Sean Paul <>
Cc: Hans de Goede <>
drivers/gpu/drm/drm_dp_mst_topology.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index 207eef08d12c..7b0ff0cff954 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -4033,6 +4033,19 @@ drm_dp_mst_detect_port(struct drm_connector *connector,
ret = connector_status_connected;
+ /* We don't want to tell userspace the port is actually plugged into
+ * anything until we've finished probing it's available_pbn, otherwise
+ * userspace will see racy atomic check failures
+ *
+ * Since we always send a hotplug at the end of probing topology
+ * state, we can just let userspace reprobe this connector later.
+ */
+ if (ret == connector_status_connected && !port->available_pbn) {
+ DRM_DEBUG_KMS("[CONNECTOR:%d:%s] not ready yet (PBN not probed)\n",
+ connector->, connector->name);
+ ret = connector_status_disconnected;
+ }
return ret;
 \ /
  Last update: 2020-03-04 23:37    [W:0.102 / U:19.820 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site