Skip to contentSkip to conversation

drm/i915/dp: Give up link training clock recovery after 10 failed attempts

PATCH Superseded Nathan Ciobanu 5 participants 7 messages Jul 13, 2018

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915/dp: Give up link training clock recovery after 10 failed attempts

Limit the link training clock recovery loop to 10 failed attempts at LANEx_CR_DONE per DP 1.4 spec. Some USB-C MST hubs cause us to get stuck in this loop on hot-plugging indefinitely as drm_dp_clock_recovery_ok() never returns true and none of the other conditions occur.

---
 drivers/gpu/drm/i915/intel_dp_link_training.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp_link_training.c +7 -1
index 4da6e33c7fa1..66c1a70343ba 100644
@@ -129,7 +129,7 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)
 intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp)
 {
 	uint8_t voltage;
-	int voltage_tries, max_vswing_tries;
+	int voltage_tries, max_vswing_tries, cr_tries;
 	uint8_t link_config[2];
 	uint8_t link_bw, rate_select;
 
@@ -172,6 +172,7 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)
 
 	voltage_tries = 1;
 	max_vswing_tries = 0;
+	cr_tries = 0;
 	for (;;) {
 		uint8_t link_status[DP_LINK_STATUS_SIZE];
 
@@ -215,6 +216,11 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)
 		if (intel_dp_link_max_vswing_reached(intel_dp))
 			++max_vswing_tries;
 
+		if (cr_tries == 9) {
+			DRM_ERROR("Failed clock recovery 10 times, giving up!\n");
+			return false;
+		}
+		++cr_tries;
 	}
 }
 
Signature · 6 lines
1.9.1

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

✓ Fi.CI.BAT: success for drm/i915/dp: Give up link training clock recovery after 10 failed attempts

== Series Details ==

== Series Details ==

Series: drm/i915/dp: Give up link training clock recovery after 10 failed attempts
URL : https://patchwork.freedesktop.org/series/46506/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4487 -> Patchwork_9651 =

== Summary - SUCCESS ==

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/46506/revisions/1/mbox/

== Known issues ==

Here are the changes found in Patchwork_9651 that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@kms_chamelium@dp-edid-read:
      fi-kbl-7500u:       PASS -> FAIL (fdo#103841)

    igt@kms_flip@basic-flip-vs-modeset:
      fi-skl-6700hq:      PASS -> DMESG-WARN (fdo#105998)

    igt@kms_flip@basic-flip-vs-wf_vblank:
      fi-glk-j4005:       PASS -> FAIL (fdo#103928)

    igt@kms_frontbuffer_tracking@basic:
      fi-hsw-peppy:       PASS -> DMESG-FAIL (fdo#102614, fdo#106103)

fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614
fdo#103841 https://bugs.freedesktop.org/show_bug.cgi?id=103841
fdo#103928 https://bugs.freedesktop.org/show_bug.cgi?id=103928
fdo#105998 https://bugs.freedesktop.org/show_bug.cgi?id=105998
fdo#106103 https://bugs.freedesktop.org/show_bug.cgi?id=106103

== Participating hosts (46 -> 42) ==

Missing (4): fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u

== Build changes ==

* Linux: CI_DRM_4487 -> Patchwork_9651

CI_DRM_4487: 627ed020cac6a73f0a014537dac7191efbb57084 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4556: caea9c5b3aa1191c0152d7c0f22a94efca4fd048 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_9651: cf5336bcc531278ec2b0046a05a474b4b630c206 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

cf5336bcc531 drm/i915/dp: Give up link training clock recovery after 10 failed attempts

== Logs ==

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

maintainer
#2 lore raw
In reply to Nathan Ciobanu
Quoted 2 lines · Nathan Ciobanu

Limit the link training clock recovery loop to 10 failed attempts at LANEx_CR_DONE per DP 1.4 spec.

Where exactly in the spec?

Quoted 4 lines

Some USB-C MST hubs cause us to get
stuck in this loop on hot-plugging indefinitely as drm_dp_clock_recovery_ok() never returns true and none of the other conditions occur.

Although it seems really bad situation that we need to avoid...

Quoted 28 lines
---
 drivers/gpu/drm/i915/intel_dp_link_training.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp_link_training.c +2 -1
index 4da6e33c7fa1..66c1a70343ba 100644
@@ -129,7 +129,7 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)
 intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp)
 {
 	uint8_t voltage;
-	int voltage_tries, max_vswing_tries;
+	int voltage_tries, max_vswing_tries, cr_tries;
 	uint8_t link_config[2];
 	uint8_t link_bw, rate_select;
 
@@ -172,6 +172,7 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)
 
 	voltage_tries = 1;
 	max_vswing_tries = 0;
+	cr_tries = 0;
 	for (;;) {
 		uint8_t link_status[DP_LINK_STATUS_SIZE];
 

drivers/gpu/drm/i915/intel_dp_link_training.c static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp) · line 223

Quoted 8 lines
drivers/gpu/drm/i915/intel_dp_link_training.c +5 -0
@@ -215,6 +216,11 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)
 		if (intel_dp_link_max_vswing_reached(intel_dp))
 			++max_vswing_tries;
 
+		if (cr_tries == 9) {
+			DRM_ERROR("Failed clock recovery 10 times, giving up!\n");
+			return false;
+		}
+		++cr_tries;

If I understood correctly this is a global thing for the for(;;) right?

Shouldn't we make then like a:

- for(;;)
+ for(cr_tries = 0; cr_tries < 10; cr_tries++)

	{
	}

+ DRM_ERROR("Failed clock recovery 10 times, giving up!\n");
+ return false;
}

Thanks,
Rodrigo.

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp_link_training.c +0 -0
 	}
 }
 
Signature · 6 lines
1.9.1

_______________________________________________
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

#3 lore raw
Quoted 10 lines · Rodrigo Vivi
Quoted 4 lines · Nathan Ciobanu

Limit the link training clock recovery loop to 10 failed attempts at
LANEx_CR_DONE per DP 1.4 spec.

Where exactly in the spec?

Quoted 3 lines

Some USB-C MST hubs cause us to get
stuck in this loop on hot-plugging indefinitely as

Also include the information (the vswing toggling part) about why it is stuck in the loop.

Quoted 56 lines
Quoted 2 lines

drm_dp_clock_recovery_ok() never returns true and none of the other conditions occur.

Although it seems really bad situation that we need to avoid...

Quoted 39 lines

---
 drivers/gpu/drm/i915/intel_dp_link_training.c | 8 +++++++-

 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp_link_training.c +1 -1
index 4da6e33c7fa1..66c1a70343ba 100644
@@ -129,7 +129,7 @@ static bool
 intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)
  intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp)
  {
  	uint8_t voltage;
-	int voltage_tries, max_vswing_tries;
+	int voltage_tries, max_vswing_tries, cr_tries;
  	uint8_t link_config[2];
  	uint8_t link_bw, rate_select;

drivers/gpu/drm/i915/intel_dp_link_training.c +0 -0
@@ -172,6 +172,7 @@ static bool
 intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)


  voltage_tries = 1;
  max_vswing_tries = 0;

drivers/gpu/drm/i915/intel_dp_link_training.c +1 -0
+	cr_tries = 0;

  for (;;) {
  uint8_t link_status[DP_LINK_STATUS_SIZE];

drivers/gpu/drm/i915/intel_dp_link_training.c +0 -0
@@ -215,6 +216,11 @@ static bool
 intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)
  		if (intel_dp_link_max_vswing_reached(intel_dp))
  			++max_vswing_tries;

drivers/gpu/drm/i915/intel_dp_link_training.c +2 -0
+		if (cr_tries == 9) {
+			DRM_ERROR("Failed clock recovery 10 times,

giving up!\n");

drivers/gpu/drm/i915/intel_dp_link_training.c static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp) · line 223

Quoted 3 lines
drivers/gpu/drm/i915/intel_dp_link_training.c +3 -0
+			return false;
+		}
+		++cr_tries;

If I understood correctly this is a global thing for the for(;;) right?

Shouldn't we make then like a:

- for(;;)
+ for(cr_tries = 0; cr_tries < 10; cr_tries++)

	{
	}
Quoted 11 lines

+ DRM_ERROR("Failed clock recovery 10 times, giving up!\n");
+ return false;
}

Thanks,
Rodrigo.

Quoted 4 lines

  }
 }

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

#4 lore raw
Quoted 7 lines · Dhinakaran Pandiyan
Quoted 6 lines · Rodrigo Vivi
Quoted 4 lines · Nathan Ciobanu

Limit the link training clock recovery loop to 10 failed attempts at
LANEx_CR_DONE per DP 1.4 spec.

Where exactly in the spec?

I see that this is specified in 3.5.1.2.2 Clock Recovery Sequence section in DP 1.4 spec. Might be a good idea to mention this expliitly in the commit message.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Some USB-C MST hubs cause us to get
stuck in this loop on hot-plugging indefinitely as

This is likely to occur in case of USB Type C cases where only fewer lanes might be connected whereas the max lane count returned is still 4. If this is the case, explicitly mentioning this is also a good idea.

Doesnt this get recovered at all after the fallback when it will eventually try with the lower lane count?

Quoted 59 lines

Also include the information (the vswing toggling part) about why it is stuck in the loop.

Quoted 55 lines
Quoted 2 lines

drm_dp_clock_recovery_ok() never returns true and none of the other conditions occur.

Although it seems really bad situation that we need to avoid...

Quoted 39 lines

---
 drivers/gpu/drm/i915/intel_dp_link_training.c | 8 +++++++-

 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp_link_training.c +1 -1
index 4da6e33c7fa1..66c1a70343ba 100644
@@ -129,7 +129,7 @@ static bool
 intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)
  intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp)
  {
  	uint8_t voltage;
-	int voltage_tries, max_vswing_tries;
+	int voltage_tries, max_vswing_tries, cr_tries;
  	uint8_t link_config[2];
  	uint8_t link_bw, rate_select;

drivers/gpu/drm/i915/intel_dp_link_training.c +0 -0
@@ -172,6 +172,7 @@ static bool
 intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)


  voltage_tries = 1;
  max_vswing_tries = 0;

drivers/gpu/drm/i915/intel_dp_link_training.c +1 -0
+	cr_tries = 0;

  for (;;) {
  uint8_t link_status[DP_LINK_STATUS_SIZE];

drivers/gpu/drm/i915/intel_dp_link_training.c +0 -0
@@ -215,6 +216,11 @@ static bool
 intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)
  		if (intel_dp_link_max_vswing_reached(intel_dp))
  			++max_vswing_tries;

drivers/gpu/drm/i915/intel_dp_link_training.c +2 -0
+		if (cr_tries == 9) {
+			DRM_ERROR("Failed clock recovery 10 times,

giving up!\n");

drivers/gpu/drm/i915/intel_dp_link_training.c static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp) · line 223

Quoted 3 lines
drivers/gpu/drm/i915/intel_dp_link_training.c +3 -0
+			return false;
+		}
+		++cr_tries;

If I understood correctly this is a global thing for the for(;;) right?

Shouldn't we make then like a:

- for(;;)
+ for(cr_tries = 0; cr_tries < 10; cr_tries++)

	{
	}

I think incrementing it at the end of the loop makes sense because we are checking for the 10 total read requests for lane_cr_done and adjust_request_lane.
But if the max voltage swing is reached before that it should exit earlier.

Manasi

Quoted 9 lines
Quoted 9 lines

+ DRM_ERROR("Failed clock recovery 10 times, giving up!\n");
+ return false;
}

Thanks,
Rodrigo.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

  }
 }

_______________________________________________
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

#5 lore raw
Quoted 11 lines · Manasi Navare
Quoted 7 lines · Dhinakaran Pandiyan
Quoted 6 lines · Rodrigo Vivi
Quoted 4 lines · Nathan Ciobanu

Limit the link training clock recovery loop to 10 failed attempts at
LANEx_CR_DONE per DP 1.4 spec.

Where exactly in the spec?

I see that this is specified in 3.5.1.2.2 Clock Recovery Sequence section in DP 1.4 spec. Might be a good idea to mention this expliitly in the commit message.

Right, I'll do that.

Quoted 9 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Some USB-C MST hubs cause us to get
stuck in this loop on hot-plugging indefinitely as

This is likely to occur in case of USB Type C cases where only fewer lanes might be connected whereas the max lane count returned is still 4. If this is the case, explicitly mentioning this is also a good idea.

I'm pretty sure this device uses 4 lanes. I am getting voltage swing/pre-emphasis values and status on all 4.

Quoted 3 lines

Doesnt this get recovered at all after the fallback when it will eventually try with the lower lane count?

Yes it does recover after the 10 attempts.

Quoted 61 lines
Quoted 60 lines

Also include the information (the vswing toggling part) about why it is stuck in the loop.

Quoted 55 lines
Quoted 2 lines

drm_dp_clock_recovery_ok() never returns true and none of the other conditions occur.

Although it seems really bad situation that we need to avoid...

Quoted 39 lines

---
 drivers/gpu/drm/i915/intel_dp_link_training.c | 8 +++++++-

 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp_link_training.c +1 -1
index 4da6e33c7fa1..66c1a70343ba 100644
@@ -129,7 +129,7 @@ static bool
 intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)
  intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp)
  {
  	uint8_t voltage;
-	int voltage_tries, max_vswing_tries;
+	int voltage_tries, max_vswing_tries, cr_tries;
  	uint8_t link_config[2];
  	uint8_t link_bw, rate_select;

drivers/gpu/drm/i915/intel_dp_link_training.c +0 -0
@@ -172,6 +172,7 @@ static bool
 intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)


  voltage_tries = 1;
  max_vswing_tries = 0;

drivers/gpu/drm/i915/intel_dp_link_training.c +1 -0
+	cr_tries = 0;

  for (;;) {
  uint8_t link_status[DP_LINK_STATUS_SIZE];

drivers/gpu/drm/i915/intel_dp_link_training.c +0 -0
@@ -215,6 +216,11 @@ static bool
 intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)
  		if (intel_dp_link_max_vswing_reached(intel_dp))
  			++max_vswing_tries;

drivers/gpu/drm/i915/intel_dp_link_training.c +2 -0
+		if (cr_tries == 9) {
+			DRM_ERROR("Failed clock recovery 10 times,

giving up!\n");

drivers/gpu/drm/i915/intel_dp_link_training.c static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp) · line 223

Quoted 3 lines
drivers/gpu/drm/i915/intel_dp_link_training.c +3 -0
+			return false;
+		}
+		++cr_tries;

If I understood correctly this is a global thing for the for(;;) right?

Shouldn't we make then like a:

- for(;;)
+ for(cr_tries = 0; cr_tries < 10; cr_tries++)

	{
	}
Quoted 24 lines

I think incrementing it at the end of the loop makes sense because we are checking for the 10 total read requests for lane_cr_done and adjust_request_lane.
But if the max voltage swing is reached before that it should exit earlier.

Manasi

Quoted 16 lines
Quoted 12 lines

+ DRM_ERROR("Failed clock recovery 10 times, giving up!\n");
+ return false;
}

Thanks,
Rodrigo.

Quoted 4 lines

  }
 }

_______________________________________________
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

#6 lore raw
In reply to Rodrigo Vivi
Quoted 5 lines · Rodrigo Vivi
Quoted 2 lines · Nathan Ciobanu

Limit the link training clock recovery loop to 10 failed attempts at LANEx_CR_DONE per DP 1.4 spec.

Where exactly in the spec?

I'll add the section number to the commit message.

Quoted 49 lines
Quoted 5 lines

Some USB-C MST hubs cause us to get
stuck in this loop on hot-plugging indefinitely as drm_dp_clock_recovery_ok() never returns true and none of the other conditions occur.

Although it seems really bad situation that we need to avoid...

Quoted 28 lines
---
 drivers/gpu/drm/i915/intel_dp_link_training.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp_link_training.c +2 -1
index 4da6e33c7fa1..66c1a70343ba 100644
@@ -129,7 +129,7 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)
 intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp)
 {
 	uint8_t voltage;
-	int voltage_tries, max_vswing_tries;
+	int voltage_tries, max_vswing_tries, cr_tries;
 	uint8_t link_config[2];
 	uint8_t link_bw, rate_select;
 
@@ -172,6 +172,7 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)
 
 	voltage_tries = 1;
 	max_vswing_tries = 0;
+	cr_tries = 0;
 	for (;;) {
 		uint8_t link_status[DP_LINK_STATUS_SIZE];
 

drivers/gpu/drm/i915/intel_dp_link_training.c static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp) · line 223

Quoted 8 lines
drivers/gpu/drm/i915/intel_dp_link_training.c +5 -0
@@ -215,6 +216,11 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)
 		if (intel_dp_link_max_vswing_reached(intel_dp))
 			++max_vswing_tries;
 
+		if (cr_tries == 9) {
+			DRM_ERROR("Failed clock recovery 10 times, giving up!\n");
+			return false;
+		}
+		++cr_tries;

If I understood correctly this is a global thing for the for(;;) right?

Shouldn't we make then like a:

Quoted 8 lines

- for(;;)
+ for(cr_tries = 0; cr_tries < 10; cr_tries++)

	{
	}

+ DRM_ERROR("Failed clock recovery 10 times, giving up!\n");
+ return false;
}

That was my thought initially as well but I was worried that it will not be immediately obvious why I'm returning false after the loop - although the error message tells you why. I'll change this.

-Nathan

Quoted 15 lines

Thanks,
Rodrigo.

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp_link_training.c +0 -0
 	}
 }
 
Signature · 6 lines
1.9.1

_______________________________________________
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