Skip to contentSkip to conversation

drm/dp: Power cycle display if LINK_ADDRESS fails.

PATCH In review Dhinakaran Pandiyan 5 participants 13 messages Dec 21, 2017 – Jan 5, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/dp: Power cycle display if LINK_ADDRESS fails.

Occasionally there are LINK_ADDRESS sideband messages timing out with the Lenovo MST dock + Dell MST monitor(w/ in-built branch) setup I have. These failures lead to the display not coming up on boot. Power cycling the port corresponding to the MST monitor's branch device and resending the message fixes the issue. I am not entirely sure if this is specific to my setup. However, as the power state is toggled conditionally on LINK_ADDRESS timeouts, this should not affect the working cases.

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +11 -2
index 70dcfa58d3c2..e06defcdcf18 100644
@@ -1596,8 +1596,9 @@ static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
 	int len;
 	struct drm_dp_sideband_msg_tx *txmsg;
 	int ret;
+	int attempts = 5;
 
-	txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
+retry:	txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
 	if (!txmsg)
 		return;
 
@@ -1635,9 +1636,17 @@ static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
 			}
 			(*mgr->cbs->hotplug)(mgr);
 		}
+	} else if (attempts--) {
+		kfree(txmsg);
+		drm_dp_send_power_updown_phy(mstb->mgr, mstb->port_parent,
+					     false);
+		drm_dp_send_power_updown_phy(mstb->mgr, mstb->port_parent,
+					     true);
+		DRM_DEBUG_KMS("link address failed %d, retrying\n", ret);
+		goto retry;
 	} else {
 		mstb->link_address_sent = false;
-		DRM_DEBUG_KMS("link address failed %d\n", ret);
+		DRM_DEBUG_KMS("link address failed %d, giving up\n", ret);
 	}
 
 	kfree(txmsg);
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 7 lines · Dhinakaran Pandiyan

Occasionally there are LINK_ADDRESS sideband messages timing out with the Lenovo MST dock + Dell MST monitor(w/ in-built branch) setup I have. These failures lead to the display not coming up on boot. Power cycling the port corresponding to the MST monitor's branch device and resending the message fixes the issue. I am not entirely sure if this is specific to my setup. However, as the power state is toggled conditionally on LINK_ADDRESS timeouts, this should not affect the working cases.

With stuff like this, I always wonder if catering for a failing setup blocks us from improving working setups, because once we add this, we can't regress it. For example, is there a valid scenario where we'd want to fail fast here, instead of retrying?

Some nits below.

Quoted 24 lines
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +2 -1
index 70dcfa58d3c2..e06defcdcf18 100644
@@ -1596,8 +1596,9 @@ static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
 	int len;
 	struct drm_dp_sideband_msg_tx *txmsg;
 	int ret;
+	int attempts = 5;
 
-	txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
+retry:	txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
 	if (!txmsg)
 		return;
 

drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, · line 1639

Quoted 4 lines
drivers/gpu/drm/drm_dp_mst_topology.c +1 -0
@@ -1635,9 +1636,17 @@ static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
 			}
 			(*mgr->cbs->hotplug)(mgr);
 		}
+	} else if (attempts--) {

You'll end up doing (attempts + 1) attempts, including the first one.

drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, · line 1640

Quoted 1 line
drivers/gpu/drm/drm_dp_mst_topology.c +1 -0
+		kfree(txmsg);

How about memset(txmsg, 0, sizoef(*txmsg)); here and move the goto label down to avoid repeated allocations?

drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, · line 1645

Quoted 5 lines
drivers/gpu/drm/drm_dp_mst_topology.c +5 -0
+		drm_dp_send_power_updown_phy(mstb->mgr, mstb->port_parent,
+					     false);
+		drm_dp_send_power_updown_phy(mstb->mgr, mstb->port_parent,
+					     true);
+		DRM_DEBUG_KMS("link address failed %d, retrying\n", ret);

Maybe do the debug message before you power down/up?

BR,
Jani.

Quoted 8 lines
drivers/gpu/drm/drm_dp_mst_topology.c +2 -1
+		goto retry;
 	} else {
 		mstb->link_address_sent = false;
-		DRM_DEBUG_KMS("link address failed %d\n", ret);
+		DRM_DEBUG_KMS("link address failed %d, giving up\n", ret);
 	}
 
 	kfree(txmsg);
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw
Quoted 9 lines · Jani Nikula
Quoted 7 lines · Dhinakaran Pandiyan

Occasionally there are LINK_ADDRESS sideband messages timing out with the Lenovo MST dock + Dell MST monitor(w/ in-built branch) setup I have. These failures lead to the display not coming up on boot. Power cycling the port corresponding to the MST monitor's branch device and resending the message fixes the issue. I am not entirely sure if this is specific to my setup. However, as the power state is toggled conditionally on LINK_ADDRESS timeouts, this should not affect the working cases.

Quoted 4 lines

With stuff like this, I always wonder if catering for a failing setup blocks us from improving working setups, because once we add this, we can't regress it. For example, is there a valid scenario where we'd want to fail fast here, instead of retrying?

Link address failure would result in not probing a branch device that already has been detected. I guess the fail fast case will be applicable if the said device was not really present but the parent branch told us otherwise.

Quoted 26 lines

Some nits below.

Quoted 23 lines
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +2 -1
index 70dcfa58d3c2..e06defcdcf18 100644
@@ -1596,8 +1596,9 @@ static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
 	int len;
 	struct drm_dp_sideband_msg_tx *txmsg;
 	int ret;
+	int attempts = 5;
 
-	txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
+retry:	txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
 	if (!txmsg)
 		return;
 
Quoted 7 lines

drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, · line 1639

Quoted 5 lines
drivers/gpu/drm/drm_dp_mst_topology.c +1 -0
@@ -1635,9 +1636,17 @@ static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
 			}
 			(*mgr->cbs->hotplug)(mgr);
 		}
+	} else if (attempts--) {

You'll end up doing (attempts + 1) attempts, including the first one.

Yeah, that is what I intended to do :) I renamed it from 'retry' to 'attempt' at the last moment, which made it a bit confusing I suppose.

I am stressing testing my setup more to see how well this recovery works and update this patch.

Quoted 5 lines

drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, · line 1640

Quoted 2 lines
drivers/gpu/drm/drm_dp_mst_topology.c +1 -0
+		kfree(txmsg);

How about memset(txmsg, 0, sizoef(*txmsg)); here and move the goto label down to avoid repeated allocations?

Absolutely.

Quoted 8 lines

drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, · line 1645

Quoted 6 lines
drivers/gpu/drm/drm_dp_mst_topology.c +5 -0
+		drm_dp_send_power_updown_phy(mstb->mgr, mstb->port_parent,
+					     false);
+		drm_dp_send_power_updown_phy(mstb->mgr, mstb->port_parent,
+					     true);
+		DRM_DEBUG_KMS("link address failed %d, retrying\n", ret);

Maybe do the debug message before you power down/up?

Ok.

Quoted 4 lines

BR,
Jani.

Quoted 9 lines

drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, · line 1652

Quoted 8 lines
drivers/gpu/drm/drm_dp_mst_topology.c +2 -1
+		goto retry;
 	} else {
 		mstb->link_address_sent = false;
-		DRM_DEBUG_KMS("link address failed %d\n", ret);
+		DRM_DEBUG_KMS("link address failed %d, giving up\n", ret);
 	}
 
 	kfree(txmsg);

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
Quoted 15 lines · Dhinakaran
Quoted 9 lines · Jani Nikula
Quoted 7 lines · Dhinakaran Pandiyan

Occasionally there are LINK_ADDRESS sideband messages timing out with the Lenovo MST dock + Dell MST monitor(w/ in-built branch) setup I have. These failures lead to the display not coming up on boot. Power cycling the port corresponding to the MST monitor's branch device and resending the message fixes the issue. I am not entirely sure if this is specific to my setup. However, as the power state is toggled conditionally on LINK_ADDRESS timeouts, this should not affect the working cases.

Quoted 4 lines

With stuff like this, I always wonder if catering for a failing setup blocks us from improving working setups, because once we add this, we can't regress it. For example, is there a valid scenario where we'd want to fail fast here, instead of retrying?

Quoted 5 lines

Link address failure would result in not probing a branch device that already has been detected. I guess the fail fast case will be applicable if the said device was not really present but the parent branch told us otherwise.

The other option is we could check the device ID of the dock and implement this as a quirk.

Btw I found some relevant information in the spec.

"The Message Transaction originator must perform the reply timeout check. If an error to a request causes the system to be in an invalid state (e.g., all nodes failed to delete a virtual channel, it is the responsibility of the Message Transaction originator to return the system to a valid state). The Message Transaction originator is responsible for any retries."

and

"SET_POWER_STATE
Must be programmed to 001 (binary) upon power-on reset or an upstream device disconnect.
001 = Set local Sink device and all downstream Sink devices to D0 (normal operation mode)."

I wonder if the dock is missing this step because the monitor seems to work well with a discrete MST hub.

Quoted 33 lines
Quoted 26 lines

Some nits below.

Quoted 23 lines
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +2 -1
index 70dcfa58d3c2..e06defcdcf18 100644
@@ -1596,8 +1596,9 @@ static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
 	int len;
 	struct drm_dp_sideband_msg_tx *txmsg;
 	int ret;
+	int attempts = 5;
 
-	txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
+retry:	txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
 	if (!txmsg)
 		return;
 
Quoted 7 lines

drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, · line 1639

Quoted 5 lines
drivers/gpu/drm/drm_dp_mst_topology.c +1 -0
@@ -1635,9 +1636,17 @@ static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
 			}
 			(*mgr->cbs->hotplug)(mgr);
 		}
+	} else if (attempts--) {

You'll end up doing (attempts + 1) attempts, including the first one.

Quoted 7 lines

Yeah, that is what I intended to do :) I renamed it from 'retry' to 'attempt' at the last moment, which made it a bit confusing I suppose.

I am stressing testing my setup more to see how well this recovery works and update this patch.

Here's what I got with 266 rounds of reboots.
Correct link address at
1st try 180
Retry 1 45
Retry 2 32
Retry 3 0
Retry 4 0
Retry 5 2
Giving up 3
Incorrect link address 4

The retries help about 30% of the cases.

Quoted 29 lines
Quoted 7 lines

drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, · line 1640

Quoted 4 lines
drivers/gpu/drm/drm_dp_mst_topology.c +1 -0
+		kfree(txmsg);

How about memset(txmsg, 0, sizoef(*txmsg)); here and move the goto label down to avoid repeated allocations?

Absolutely.

Quoted 8 lines

drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, · line 1645

Quoted 6 lines
drivers/gpu/drm/drm_dp_mst_topology.c +5 -0
+		drm_dp_send_power_updown_phy(mstb->mgr, mstb->port_parent,
+					     false);
+		drm_dp_send_power_updown_phy(mstb->mgr, mstb->port_parent,
+					     true);
+		DRM_DEBUG_KMS("link address failed %d, retrying\n", ret);

Maybe do the debug message before you power down/up?

Ok.

Quoted 11 lines

BR,
Jani.

Quoted 7 lines
drivers/gpu/drm/drm_dp_mst_topology.c +2 -1
+		goto retry;
 	} else {
 		mstb->link_address_sent = false;
-		DRM_DEBUG_KMS("link address failed %d\n", ret);
+		DRM_DEBUG_KMS("link address failed %d, giving up\n", ret);
 	}
 
Quoted 6 lines
Quoted 2 lines

drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, · line 1652

Quoted 1 line
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
 	kfree(txmsg);

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw

✓ Fi.CI.BAT: success for drm/dp: Power cycle display if LINK_ADDRESS fails.

In reply to Dhinakaran Pandiyan
== Series Details ==

== Series Details ==

Series: drm/dp: Power cycle display if LINK_ADDRESS fails.
URL : https://patchwork.freedesktop.org/series/35659/
State : success

== Summary ==

Series 35659v1 drm/dp: Power cycle display if LINK_ADDRESS fails.
https://patchwork.freedesktop.org/api/1.0/series/35659/revisions/1/mbox/

Test debugfs_test:

        Subgroup read_all_entries:
                fail       -> PASS       (fi-elk-e7500) fdo#103989
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-b:
                pass       -> INCOMPLETE (fi-snb-2520m) fdo#103713

fdo#103989 https://bugs.freedesktop.org/show_bug.cgi?id=103989
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:434s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:387s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:507s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:277s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:499s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:494s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:479s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:464s
fi-elk-e7500     total:224  pass:163  dwarn:15  dfail:0   fail:0   skip:45 
fi-gdg-551       total:288  pass:178  dwarn:1   dfail:0   fail:1   skip:108 time:263s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:533s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:410s
fi-hsw-4770r     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:413s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:387s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:479s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:427s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:481s
fi-kbl-7560u     total:288  pass:268  dwarn:1   dfail:0   fail:0   skip:19  time:521s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:469s
fi-kbl-r         total:288  pass:260  dwarn:1   dfail:0   fail:0   skip:27  time:528s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:448s
fi-skl-6600u     total:288  pass:260  dwarn:1   dfail:0   fail:0   skip:27  time:530s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:553s
fi-skl-6700k2    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:508s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:510s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:448s
fi-snb-2520m     total:245  pass:211  dwarn:0   dfail:0   fail:0   skip:33 
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:419s
Blacklisted hosts:
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:588s
fi-cnl-y         total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:635s

fi-pnv-d510 failed to collect. IGT log at Patchwork_7555/fi-pnv-d510/igt.log

e17acd399942e58eacf1c7c619db88d7abd8a8f4 drm-tip: 2017y-12m-21d-00h-38m-27s UTC integration manifest 0232ba334c09 drm/dp: Power cycle display if LINK_ADDRESS fails.

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7555/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

✓ Fi.CI.IGT: success for drm/dp: Power cycle display if LINK_ADDRESS fails.

In reply to Dhinakaran Pandiyan
== Series Details ==

== Series Details ==

Series: drm/dp: Power cycle display if LINK_ADDRESS fails.
URL : https://patchwork.freedesktop.org/series/35659/
State : success

== Summary ==

Test kms_cursor_crc:

        Subgroup cursor-64x64-suspend:
                skip       -> PASS       (shard-snb) fdo#102365
Test gem_tiled_swapping:
        Subgroup non-threaded:
                incomplete -> PASS       (shard-hsw) fdo#104218
Test kms_frontbuffer_tracking:
        Subgroup fbc-1p-offscren-pri-shrfb-draw-blt:
                pass       -> FAIL       (shard-snb) fdo#101623

fdo#102365 https://bugs.freedesktop.org/show_bug.cgi?id=102365
fdo#104218 https://bugs.freedesktop.org/show_bug.cgi?id=104218
fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623

shard-hsw        total:2712 pass:1537 dwarn:1   dfail:0   fail:10  skip:1164 time:9436s
shard-snb        total:2712 pass:1309 dwarn:1   dfail:0   fail:11  skip:1391 time:8116s
Blacklisted hosts:
shard-apl        total:2712 pass:1685 dwarn:1   dfail:0   fail:24  skip:1001 time:13868s
shard-kbl        total:2712 pass:1807 dwarn:1   dfail:0   fail:23  skip:881 time:11152s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7555/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw
In reply to Dhinakaran Pandiyan
Quoted 22 lines · Dhinakaran Pandiyan

Occasionally there are LINK_ADDRESS sideband messages timing out with the Lenovo MST dock + Dell MST monitor(w/ in-built branch) setup I have. These failures lead to the display not coming up on boot. Power cycling the port corresponding to the MST monitor's branch device and resending the message fixes the issue. I am not entirely sure if this is specific to my setup. However, as the power state is toggled conditionally on LINK_ADDRESS timeouts, this should not affect the working cases.

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
index 70dcfa58d3c2..e06defcdcf18 100644

drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, · line 1600

Quoted 5 lines
drivers/gpu/drm/drm_dp_mst_topology.c +1 -0
@@ -1596,8 +1596,9 @@ static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
 	int len;
 	struct drm_dp_sideband_msg_tx *txmsg;
 	int ret;
+	int attempts = 5;
 

Does the spec say this should be retried 5 times or is this just an experimental number?
We have such magical numbers for retries all over the DP code and that makes debugging harder later, so atleast a comment of why its 5 would help.

drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, · line 1639

Quoted 10 lines
drivers/gpu/drm/drm_dp_mst_topology.c +2 -1
-	txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
+retry:	txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
 	if (!txmsg)
 		return;
 
@@ -1635,9 +1636,17 @@ static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
 			}
 			(*mgr->cbs->hotplug)(mgr);
 		}
+	} else if (attempts--) {

This should be --attempts if you want the total attempts to be 5

Manasi

Quoted 21 lines
drivers/gpu/drm/drm_dp_mst_topology.c +8 -1
+		kfree(txmsg);
+		drm_dp_send_power_updown_phy(mstb->mgr, mstb->port_parent,
+					     false);
+		drm_dp_send_power_updown_phy(mstb->mgr, mstb->port_parent,
+					     true);
+		DRM_DEBUG_KMS("link address failed %d, retrying\n", ret);
+		goto retry;
 	} else {
 		mstb->link_address_sent = false;
-		DRM_DEBUG_KMS("link address failed %d\n", ret);
+		DRM_DEBUG_KMS("link address failed %d, giving up\n", ret);
 	}
 
 	kfree(txmsg);
Signature · 6 lines
2.11.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw
Quoted 18 lines · Manasi Navare
Quoted 17 lines · Dhinakaran Pandiyan

Occasionally there are LINK_ADDRESS sideband messages timing out with the Lenovo MST dock + Dell MST monitor(w/ in-built branch) setup I have. These failures lead to the display not coming up on boot. Power cycling the port corresponding to the MST monitor's branch device and resending the message fixes the issue. I am not entirely sure if this is specific to my setup. However, as the power state is toggled conditionally on LINK_ADDRESS timeouts, this should not affect the working cases.

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
Quoted 13 lines

drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, · line 1600

Quoted 10 lines
drivers/gpu/drm/drm_dp_mst_topology.c +1 -0
index 70dcfa58d3c2..e06defcdcf18 100644
@@ -1596,8 +1596,9 @@ static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
 	int len;
 	struct drm_dp_sideband_msg_tx *txmsg;
 	int ret;
+	int attempts = 5;
 

Does the spec say this should be retried 5 times or is this just an experimental number?

The spec. does not say how many times to retry, but it does say the source is responsible for retrying.

Quoted 2 lines

We have such magical numbers for retries all over the DP code and that makes debugging harder later, so atleast a comment of why its 5 would help.

Takes about 22 seconds from boot to complete 5 retries on my SKL, I think that's enough trying from the kernel side before pulling out the DP cable makes sense :)

Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
-	txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
+retry:	txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
 	if (!txmsg)
 		return;
 
Quoted 7 lines

drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, · line 1639

Quoted 5 lines
drivers/gpu/drm/drm_dp_mst_topology.c +1 -0
@@ -1635,9 +1636,17 @@ static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
 			}
 			(*mgr->cbs->hotplug)(mgr);
 		}
+	} else if (attempts--) {

This should be --attempts if you want the total attempts to be 5

I don't.

Quoted 20 lines

Manasi

Quoted 17 lines
drivers/gpu/drm/drm_dp_mst_topology.c +8 -1
+		kfree(txmsg);
+		drm_dp_send_power_updown_phy(mstb->mgr, mstb->port_parent,
+					     false);
+		drm_dp_send_power_updown_phy(mstb->mgr, mstb->port_parent,
+					     true);
+		DRM_DEBUG_KMS("link address failed %d, retrying\n", ret);
+		goto retry;
 	} else {
 		mstb->link_address_sent = false;
-		DRM_DEBUG_KMS("link address failed %d\n", ret);
+		DRM_DEBUG_KMS("link address failed %d, giving up\n", ret);
 	}
 
 	kfree(txmsg);
Signature · 1 line
2.11.0
Quoted 8 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#8 lore raw
Quoted 36 lines · Dhinakaran
Quoted 18 lines · Manasi Navare
Quoted 17 lines · Dhinakaran Pandiyan

Occasionally there are LINK_ADDRESS sideband messages timing out with the Lenovo MST dock + Dell MST monitor(w/ in-built branch) setup I have. These failures lead to the display not coming up on boot. Power cycling the port corresponding to the MST monitor's branch device and resending the message fixes the issue. I am not entirely sure if this is specific to my setup. However, as the power state is toggled conditionally on LINK_ADDRESS timeouts, this should not affect the working cases.

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
Quoted 13 lines

drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, · line 1600

Quoted 10 lines
drivers/gpu/drm/drm_dp_mst_topology.c +1 -0
index 70dcfa58d3c2..e06defcdcf18 100644
@@ -1596,8 +1596,9 @@ static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
 	int len;
 	struct drm_dp_sideband_msg_tx *txmsg;
 	int ret;
+	int attempts = 5;
 

Does the spec say this should be retried 5 times or is this just an experimental number?

The spec. does not say how many times to retry, but it does say the source is responsible for retrying.

Quoted 8 lines
Quoted 2 lines

We have such magical numbers for retries all over the DP code and that makes debugging harder later, so atleast a comment of why its 5 would help.

Takes about 22 seconds from boot to complete 5 retries on my SKL, I think that's enough trying from the kernel side before pulling out the DP cable makes sense :)

It still appears to be a magical number so better to comment it properly. Helps in the debug

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
-	txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
+retry:	txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
 	if (!txmsg)
 		return;
 
Quoted 8 lines
Quoted 7 lines

drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, · line 1639

Quoted 5 lines
drivers/gpu/drm/drm_dp_mst_topology.c +1 -0
@@ -1635,9 +1636,17 @@ static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
 			}
 			(*mgr->cbs->hotplug)(mgr);
 		}
+	} else if (attempts--) {

This should be --attempts if you want the total attempts to be 5

I don't.

Yes the variable attempts is misleading in that case. Probably call it "tries"

Manasi

Quoted 20 lines
Quoted 20 lines

Manasi

Quoted 17 lines
drivers/gpu/drm/drm_dp_mst_topology.c +8 -1
+		kfree(txmsg);
+		drm_dp_send_power_updown_phy(mstb->mgr, mstb->port_parent,
+					     false);
+		drm_dp_send_power_updown_phy(mstb->mgr, mstb->port_parent,
+					     true);
+		DRM_DEBUG_KMS("link address failed %d, retrying\n", ret);
+		goto retry;
 	} else {
 		mstb->link_address_sent = false;
-		DRM_DEBUG_KMS("link address failed %d\n", ret);
+		DRM_DEBUG_KMS("link address failed %d, giving up\n", ret);
 	}
 
 	kfree(txmsg);
Signature · 1 line
2.11.0
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw
Quoted 62 lines · Manasi Navare
Quoted 36 lines · Dhinakaran
Quoted 18 lines · Manasi Navare
Quoted 17 lines · Dhinakaran Pandiyan

Occasionally there are LINK_ADDRESS sideband messages timing out with the Lenovo MST dock + Dell MST monitor(w/ in-built branch) setup I have. These failures lead to the display not coming up on boot. Power cycling the port corresponding to the MST monitor's branch device and resending the message fixes the issue. I am not entirely sure if this is specific to my setup. However, as the power state is toggled conditionally on LINK_ADDRESS timeouts, this should not affect the working cases.

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
Quoted 13 lines

drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, · line 1600

Quoted 10 lines
drivers/gpu/drm/drm_dp_mst_topology.c +1 -0
index 70dcfa58d3c2..e06defcdcf18 100644
@@ -1596,8 +1596,9 @@ static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
 	int len;
 	struct drm_dp_sideband_msg_tx *txmsg;
 	int ret;
+	int attempts = 5;
 

Does the spec say this should be retried 5 times or is this just an experimental number?

The spec. does not say how many times to retry, but it does say the source is responsible for retrying.

Quoted 8 lines
Quoted 2 lines

We have such magical numbers for retries all over the DP code and that makes debugging harder later, so atleast a comment of why its 5 would help.

Takes about 22 seconds from boot to complete 5 retries on my SKL, I think that's enough trying from the kernel side before pulling out the DP cable makes sense :)

It still appears to be a magical number so better to comment it properly. Helps in the debug

Quoted 13 lines
Quoted 13 lines

drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, · line 1639

Quoted 11 lines
drivers/gpu/drm/drm_dp_mst_topology.c +2 -1
-	txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
+retry:	txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
 	if (!txmsg)
 		return;
 
@@ -1635,9 +1636,17 @@ static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
 			}
 			(*mgr->cbs->hotplug)(mgr);
 		}
+	} else if (attempts--) {

This should be --attempts if you want the total attempts to be 5

Quoted 4 lines
Quoted 1 line

I don't.

Yes the variable attempts is misleading in that case. Probably call it "tries"

I meant retries..

Manasi

Quoted 30 lines

Manasi

Quoted 20 lines
Quoted 20 lines

Manasi

Quoted 17 lines
drivers/gpu/drm/drm_dp_mst_topology.c +8 -1
+		kfree(txmsg);
+		drm_dp_send_power_updown_phy(mstb->mgr, mstb->port_parent,
+					     false);
+		drm_dp_send_power_updown_phy(mstb->mgr, mstb->port_parent,
+					     true);
+		DRM_DEBUG_KMS("link address failed %d, retrying\n", ret);
+		goto retry;
 	} else {
 		mstb->link_address_sent = false;
-		DRM_DEBUG_KMS("link address failed %d\n", ret);
+		DRM_DEBUG_KMS("link address failed %d, giving up\n", ret);
 	}
 
 	kfree(txmsg);
Signature · 1 line
2.11.0
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#10 lore raw
In reply to Dhinakaran Pandiyan

Sorry for the late reply, I've been having very similar issues on my own MST hub and I wanted to make sure that they were the same issue, although it seems like they aren't.

So; I've been doing a lot of MST debugging this week and last and something I've discovered needs to be taken into account sometimes with MST hubs is the actual state that they're in at the point that the DRM driver detects them. I've managed to on multiple occasions, get my hub into a weird state by:

- Plugging in MST displays into the hub
- Turning on the machine
- Unplugging MST displays from the hub (while still in the BIOS)
- Booting into linux
- Plugging MST displays into the hub
- Everything times out, the world explodes, the economy collapses, etc.

I think maybe, especially since this should be perfectly valid behavior and not break well or poor behaving hubs, we should do a power cycle with the display like this when the DP port initially detects an MST hub and before we start doing any serious communication with it. Could you see if this fixes your issue instead of the patch you've got here?

As well, mind attaching your full dmesg with drm.debug=0x6?

Quoted 52 lines · Dhinakaran Pandiyan

Occasionally there are LINK_ADDRESS sideband messages timing out with the Lenovo MST dock + Dell MST monitor(w/ in-built branch) setup I have. These failures lead to the display not coming up on boot. Power cycling the port corresponding to the MST monitor's branch device and resending the message fixes the issue. I am not entirely sure if this is specific to my setup. However, as the power state is toggled conditionally on LINK_ADDRESS timeouts, this should not affect the working cases.

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +11 -2
index 70dcfa58d3c2..e06defcdcf18 100644
@@ -1596,8 +1596,9 @@ static void drm_dp_send_link_address(struct
 drm_dp_mst_topology_mgr *mgr,
 	int len;
 	struct drm_dp_sideband_msg_tx *txmsg;
 	int ret;
+	int attempts = 5;
 
-	txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
+retry:	txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
 	if (!txmsg)
 		return;
@@ -1635,9 +1636,17 @@ static void drm_dp_send_link_address(struct
 drm_dp_mst_topology_mgr *mgr,
 			}
 			(*mgr->cbs->hotplug)(mgr);
 		}
+	} else if (attempts--) {
+		kfree(txmsg);
+		drm_dp_send_power_updown_phy(mstb->mgr, mstb->port_parent,
+					     false);
+		drm_dp_send_power_updown_phy(mstb->mgr, mstb->port_parent,
+					     true);
+		DRM_DEBUG_KMS("link address failed %d, retrying\n", ret);
+		goto retry;
 	} else {
 		mstb->link_address_sent = false;
-		DRM_DEBUG_KMS("link address failed %d\n", ret);
+		DRM_DEBUG_KMS("link address failed %d, giving up\n", ret);
 	}
 
Quoted 1 line

kfree(txmsg);

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#11 lore raw
Quoted 16 lines · Lyude Paul

Sorry for the late reply, I've been having very similar issues on my own MST hub and I wanted to make sure that they were the same issue, although it seems like they aren't.

So; I've been doing a lot of MST debugging this week and last and something I've discovered needs to be taken into account sometimes with MST hubs is the actual state that they're in at the point that the DRM driver detects them. I've managed to on multiple occasions, get my hub into a weird state by:

- Plugging in MST displays into the hub
- Turning on the machine
- Unplugging MST displays from the hub (while still in the BIOS)
- Booting into linux
- Plugging MST displays into the hub
- Everything times out, the world explodes, the economy collapses, etc.

Quoted 6 lines

I think maybe, especially since this should be perfectly valid behavior and not break well or poor behaving hubs, we should do a power cycle with the display like this when the DP port initially detects an MST hub and before we start doing any serious communication with it. Could you see if this fixes your issue instead of the patch you've got here?

Well, my reasoning to power cycle after a failure was to not affect hubs that work. Besides that I also saw an odd cycle of timeouts and late replies when I did this.

1. Detect hub
2. Toggle power state and send LINK_ADDRESS req.
3. LINK_ADDRESS req times out.
4. Toggle power state and send LINK_ADDRESS req.
5. Get late response for the first (and expired) LINK_ADDRESS req.
6. Go to step 3

It seems like toggling the power states flushes out some message buffers in the MST hub.

But, in the retry approach, power cycling resulted in getting the response for the current LINK_ADDRESS request along with the previous one that timed out.

I could not come up with an explanation for all the behavior. So, I decided to get back to this later.

Quoted 1 line

As well, mind attaching your full dmesg with drm.debug=0x6?

I don't have the old logs anymore, will try to get something for you.

-DK
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#12 lore raw
Quoted 42 lines · Dhinakaran
Quoted 16 lines · Lyude Paul

Sorry for the late reply, I've been having very similar issues on my own MST hub and I wanted to make sure that they were the same issue, although it seems like they aren't.

So; I've been doing a lot of MST debugging this week and last and something I've discovered needs to be taken into account sometimes with MST hubs is the actual state that they're in at the point that the DRM driver detects them. I've managed to on multiple occasions, get my hub into a weird state by:

- Plugging in MST displays into the hub
- Turning on the machine
- Unplugging MST displays from the hub (while still in the BIOS)
- Booting into linux
- Plugging MST displays into the hub
- Everything times out, the world explodes, the economy collapses, etc.

Quoted 6 lines

I think maybe, especially since this should be perfectly valid behavior and not break well or poor behaving hubs, we should do a power cycle with the display like this when the DP port initially detects an MST hub and before we start doing any serious communication with it. Could you see if this fixes your issue instead of the patch you've got here?

Well, my reasoning to power cycle after a failure was to not affect hubs that work. Besides that I also saw an odd cycle of timeouts and late replies when I did this.

1. Detect hub
2. Toggle power state and send LINK_ADDRESS req.
3. LINK_ADDRESS req times out.
4. Toggle power state and send LINK_ADDRESS req.
5. Get late response for the first (and expired) LINK_ADDRESS req.
6. Go to step 3

It seems like toggling the power states flushes out some message buffers in the MST hub.

But, in the retry approach, power cycling resulted in getting the response for the current LINK_ADDRESS request along with the previous one that timed out.

Quoted 7 lines

I could not come up with an explanation for all the behavior. So, I decided to get back to this later.

Quoted 1 line

As well, mind attaching your full dmesg with drm.debug=0x6?

I don't have the old logs anymore, will try to get something for you.

Here you go

Setup: Laptop -> ThinkPad dock -> Dell MST monitor -> Dell monitor Hotplugged display to dock[passed] - https://pastebin.com/CemRGsCb
Connected boot[failed] - https://pastebin.com/jjXP6HzB

Quoted 6 lines

-DK
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel