Skip to contentSkip to conversation

drm: Add retries for lspcon status check

PATCH In review Shashank Sharma 3 participants 4 messages Aug 21, 2017 – Aug 22, 2017

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

PATCH v2 1/2 drm: Add retries for lspcon status check

It's an observation during some CI tests that few LSPCON chips respond slow while system is under load, and need some delay while reading current mode status using i2c-over-aux channel.

This patch:
- Adds few retries and delays before declaring a read failure from LSPCON hardware.
- Changes the debug level of the print from ERROR->DEBUG whereas another patch in I915 will add an ERROR message from the caller when we have timed out all our limits.

V2: addressed review comments from Imre, and added r-b
- use int instead of u8 for counter
- use for loop instead of do...while();

Cc Ville Syrjala <[email protected]>
Cc Imre Deak <[email protected]>
---
 drivers/gpu/drm/drm_dp_dual_mode_helper.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_dp_dual_mode_helper.c +11 -3
index 80e62f6..fc8c7ac 100644
@@ -409,6 +409,7 @@ int drm_lspcon_get_mode(struct i2c_adapter *adapter,
 			enum drm_lspcon_mode *mode)
 {
 	u8 data;
+	int retry;
 	int ret = 0;
 
 	if (!mode) {
@@ -417,10 +418,17 @@ int drm_lspcon_get_mode(struct i2c_adapter *adapter,
 	}
 
 	/* Read Status: i2c over aux */
-	ret = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_LSPCON_CURRENT_MODE,
-				    &data, sizeof(data));
+	for (retry = 5; ; retry--) {
+		ret = drm_dp_dual_mode_read(adapter,
+					    DP_DUAL_MODE_LSPCON_CURRENT_MODE,
+					    &data, sizeof(data));
+		if (!ret || !retry)
+			break;
+		usleep_range(500, 1000);
+	}
+
 	if (ret < 0) {
-		DRM_ERROR("LSPCON read(0x80, 0x41) failed\n");
+		DRM_DEBUG_KMS("LSPCON read(0x80, 0x41) failed\n");
 		return -EFAULT;
 	}
 
Signature · 6 lines
2.7.4

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

PATCH v2 2/2 drm/i915: Don't give up waiting on INVALID_MODE

Our current logic to read LSPCON's current mode, stops retries and breaks wait-loop, if it gets LSPCON_MODE_INVALID as return from the core function. This doesn't allow us to try reading the mode again.

This patch removes this condition and allows retries reading the currnt mode until timeout.

This also fixes/prevents some of the noise in form of debug messages while running IGT CI test cases.

V2: rebase, added r-b

Cc Imre Deak <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/i915/intel_lspcon.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_lspcon.c +2 -3
index 8413a4c..e64a336 100644
@@ -118,14 +118,13 @@ static enum drm_lspcon_mode lspcon_wait_mode(struct intel_lspcon *lspcon,
 	enum drm_lspcon_mode current_mode;
 
 	current_mode = lspcon_get_current_mode(lspcon);
-	if (current_mode == mode || current_mode == DRM_LSPCON_MODE_INVALID)
+	if (current_mode == mode)
 		goto out;
 
 	DRM_DEBUG_KMS("Waiting for LSPCON mode %s to settle\n",
 		      lspcon_mode_name(mode));
 
-	wait_for((current_mode = lspcon_get_current_mode(lspcon)) == mode ||
-		 current_mode == DRM_LSPCON_MODE_INVALID, 100);
+	wait_for((current_mode = lspcon_get_current_mode(lspcon)) == mode, 100);
 	if (current_mode != mode)
 		DRM_DEBUG_KMS("LSPCON mode hasn't settled\n");
 
Signature · 6 lines
2.7.4

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

✓ Fi.CI.BAT: success for series starting with [v2,1/2] drm: Add retries for lspcon status check

In reply to Shashank Sharma
== Series Details ==

== Series Details ==

Series: series starting with [v2,1/2] drm: Add retries for lspcon status check
URL : https://patchwork.freedesktop.org/series/29088/
State : success

== Summary ==

Series 29088v1 series starting with [v2,1/2] drm: Add retries for lspcon status check
https://patchwork.freedesktop.org/api/1.0/series/29088/revisions/1/mbox/

Test gem_exec_suspend:

        Subgroup basic-s4-devices:
                dmesg-warn -> PASS       (fi-kbl-7260u) fdo#102294
Test kms_cursor_legacy:
        Subgroup basic-busy-flip-before-cursor-atomic:
                pass       -> FAIL       (fi-snb-2600) fdo#100215
Test kms_flip:
        Subgroup basic-flip-vs-modeset:
                skip       -> PASS       (fi-skl-x1585l) fdo#101781

fdo#102294 https://bugs.freedesktop.org/show_bug.cgi?id=102294
fdo#100215 https://bugs.freedesktop.org/show_bug.cgi?id=100215
fdo#101781 https://bugs.freedesktop.org/show_bug.cgi?id=101781

fi-bdw-5557u     total:279  pass:268  dwarn:0   dfail:0   fail:0   skip:11  time:457s
fi-bdw-gvtdvm    total:279  pass:265  dwarn:0   dfail:0   fail:0   skip:14  time:437s
fi-blb-e6850     total:279  pass:224  dwarn:1   dfail:0   fail:0   skip:54  time:362s
fi-bsw-n3050     total:279  pass:243  dwarn:0   dfail:0   fail:0   skip:36  time:553s
fi-bwr-2160      total:279  pass:184  dwarn:0   dfail:0   fail:0   skip:95  time:252s
fi-bxt-j4205     total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:522s
fi-byt-j1900     total:279  pass:254  dwarn:1   dfail:0   fail:0   skip:24  time:523s
fi-byt-n2820     total:279  pass:251  dwarn:0   dfail:0   fail:0   skip:28  time:511s
fi-elk-e7500     total:279  pass:230  dwarn:0   dfail:0   fail:0   skip:49  time:438s
fi-glk-2a        total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:609s
fi-hsw-4770      total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:442s
fi-hsw-4770r     total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:422s
fi-ilk-650       total:279  pass:229  dwarn:0   dfail:0   fail:0   skip:50  time:430s
fi-ivb-3520m     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:498s
fi-ivb-3770      total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:480s
fi-kbl-7260u     total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:492s
fi-kbl-7500u     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:481s
fi-kbl-7560u     total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:598s
fi-kbl-r         total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:590s
fi-pnv-d510      total:279  pass:223  dwarn:1   dfail:0   fail:0   skip:55  time:528s
fi-skl-6260u     total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:468s
fi-skl-6700k     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:475s
fi-skl-6770hq    total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:485s
fi-skl-gvtdvm    total:279  pass:266  dwarn:0   dfail:0   fail:0   skip:13  time:453s
fi-skl-x1585l    total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:507s
fi-snb-2520m     total:279  pass:251  dwarn:0   dfail:0   fail:0   skip:28  time:546s
fi-snb-2600      total:279  pass:249  dwarn:0   dfail:0   fail:1   skip:29  time:406s

dbfb2f62576e1c3550d10398b097589959356db3 drm-tip: 2017y-08m-21d-08h-13m-34s UTC integration manifest 77599a7653b5 drm/i915: Don't give up waiting on INVALID_MODE
cb4706065b6c drm: Add retries for lspcon status check

== Logs ==

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

#3 lore raw
In reply to Shashank Sharma
Quoted 38 lines · Shashank Sharma

It's an observation during some CI tests that few LSPCON chips respond slow while system is under load, and need some delay while reading current mode status using i2c-over-aux channel.

This patch:
- Adds few retries and delays before declaring a read failure from LSPCON hardware.
- Changes the debug level of the print from ERROR->DEBUG whereas another patch in I915 will add an ERROR message from the caller when we have timed out all our limits.

V2: addressed review comments from Imre, and added r-b
- use int instead of u8 for counter
- use for loop instead of do...while();

Cc Ville Syrjala <[email protected]>
Cc Imre Deak <[email protected]>
---
 drivers/gpu/drm/drm_dp_dual_mode_helper.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_dp_dual_mode_helper.c +1 -0
index 80e62f6..fc8c7ac 100644
@@ -409,6 +409,7 @@ int drm_lspcon_get_mode(struct i2c_adapter *adapter,
 			enum drm_lspcon_mode *mode)
 {
 	u8 data;
+	int retry;
 	int ret = 0;
 
 	if (!mode) {

drivers/gpu/drm/drm_dp_dual_mode_helper.c int drm_lspcon_get_mode(struct i2c_adapter *adapter, · line 421

Quoted 6 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +1 -2
@@ -417,10 +418,17 @@ int drm_lspcon_get_mode(struct i2c_adapter *adapter,
 	}
 
 	/* Read Status: i2c over aux */
-	ret = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_LSPCON_CURRENT_MODE,
-				    &data, sizeof(data));
+	for (retry = 5; ; retry--) {

Ok, confused myself with my original suggestion to include above the condition for retry too. That could add an extraneous delay if all the transfers fail as you explained on IRC.

I think this is still a bit clearer than the do {} while() loop so let's go with this version.

Quoted 17 lines
drivers/gpu/drm/drm_dp_dual_mode_helper.c +9 -1
+		ret = drm_dp_dual_mode_read(adapter,
+					    DP_DUAL_MODE_LSPCON_CURRENT_MODE,
+					    &data, sizeof(data));
+		if (!ret || !retry)
+			break;
+		usleep_range(500, 1000);
+	}
+
 	if (ret < 0) {
-		DRM_ERROR("LSPCON read(0x80, 0x41) failed\n");
+		DRM_DEBUG_KMS("LSPCON read(0x80, 0x41) failed\n");
 		return -EFAULT;
 	}
 
Signature · 1 line
2.7.4

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