Skip to contentSkip to conversation

drm/dp_mst: Fix return code on sideband message failure

PATCH Superseded Kuogee Hsieh 3 participants 3 messages Jun 29, 2021

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/dp_mst: Fix return code on sideband message failure

From: Rajkumar Subbiah <[email protected]>

The commit 2f015ec6eab69301fdcf54d397810d72362d7223 added some debug code for sideband message tracing. But it seems to have unintentionally changed the behavior on sideband message failure. It catches and returns failure only if DRM_UT_DP is enabled. Otherwise it ignores the error code and returns success. So on an MST unplug, the caller is unaware that the clear payload message failed and ends up waiting for 4 seconds for the response.

This change fixes the issue by returning the proper error code.

Change-Id I2887b7ca21355fe84a7968f7619d5e8199cbb0c6
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +6 -4
index 1590144..8d97430 100644
@@ -2887,11 +2887,13 @@ static int process_single_tx_qlock(struct drm_dp_mst_topology_mgr *mgr,
 	idx += tosend + 1;
 
 	ret = drm_dp_send_sideband_msg(mgr, up, chunk, idx);
-	if (unlikely(ret) && drm_debug_enabled(DRM_UT_DP)) {
-		struct drm_printer p = drm_debug_printer(DBG_PREFIX);
+	if (unlikely(ret)) {
+		if (drm_debug_enabled(DRM_UT_DP)) {
+			struct drm_printer p = drm_debug_printer(DBG_PREFIX);
 
-		drm_printf(&p, "sideband msg failed to send\n");
-		drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
+			drm_printf(&p, "sideband msg failed to send\n");
+			drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
+		}
 		return ret;
 	}
 
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
Reviewed-by on v1 1/1
#1 lore raw

+Lyude, author of fixed commit. Please add relevant folks in the future.

Quoting Kuogee Hsieh (2021-06-29 13:08:56)

Quoted 3 lines

From: Rajkumar Subbiah <[email protected]>

The commit 2f015ec6eab69301fdcf54d397810d72362d7223 added some debug

Please write

Commit 2f015ec6eab6 ("drm/dp_mst: Add sideband down request tracing + selftests") added some debug

Quoted 8 lines

code for sideband message tracing. But it seems to have unintentionally changed the behavior on sideband message failure. It catches and returns failure only if DRM_UT_DP is enabled. Otherwise it ignores the error code and returns success. So on an MST unplug, the caller is unaware that the clear payload message failed and ends up waiting for 4 seconds for the response.

This change fixes the issue by returning the proper error code.

$ git grep "This patch" -- Documentation/process
Quoted 2 lines

Change-Id: I2887b7ca21355fe84a7968f7619d5e8199cbb0c6

Please replace with

Fixes 2f015ec6eab6 ("drm/dp_mst: Add sideband down request tracing +

selftests")

Quoted 1 line

Should be a Signed-off-by from Kuogee Hsieh here.

Quoted 16 lines
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +2 -2
index 1590144..8d97430 100644
@@ -2887,11 +2887,13 @@ static int process_single_tx_qlock(struct drm_dp_mst_topology_mgr *mgr,
        idx += tosend + 1;
 
        ret = drm_dp_send_sideband_msg(mgr, up, chunk, idx);
-       if (unlikely(ret) && drm_debug_enabled(DRM_UT_DP)) {
-               struct drm_printer p = drm_debug_printer(DBG_PREFIX);
+       if (unlikely(ret)) {
+               if (drm_debug_enabled(DRM_UT_DP)) {

drivers/gpu/drm/drm_dp_mst_topology.c static int process_single_tx_qlock(struct drm_dp_mst_topology_mgr *mgr, · line 2899

Quoted 10 lines
drivers/gpu/drm/drm_dp_mst_topology.c +4 -2
+                       struct drm_printer p = drm_debug_printer(DBG_PREFIX);
 
-               drm_printf(&p, "sideband msg failed to send\n");
-               drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
+                       drm_printf(&p, "sideband msg failed to send\n");
+                       drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
+               }
                return ret;
        }
 

With the above fixed up

#2 lore raw

JFYI this is on my radar and I'll take a look asap

Quoted 69 lines · Stephen Boyd

+Lyude, author of fixed commit. Please add relevant folks in the future.

Quoting Kuogee Hsieh (2021-06-29 13:08:56)

Quoted 3 lines

From: Rajkumar Subbiah <[email protected]>

The commit 2f015ec6eab69301fdcf54d397810d72362d7223 added some debug

Please write

Commit 2f015ec6eab6 ("drm/dp_mst: Add sideband down request tracing + selftests") added some debug

Quoted 8 lines

code for sideband message tracing. But it seems to have unintentionally changed the behavior on sideband message failure. It catches and returns failure only if DRM_UT_DP is enabled. Otherwise it ignores the error code and returns success. So on an MST unplug, the caller is unaware that the clear payload message failed and ends up waiting for 4 seconds for the response.

This change fixes the issue by returning the proper error code.

$ git grep "This patch" -- Documentation/process
Quoted 2 lines

Change-Id: I2887b7ca21355fe84a7968f7619d5e8199cbb0c6

Please replace with

Fixes 2f015ec6eab6 ("drm/dp_mst: Add sideband down request tracing +

selftests")

Quoted 1 line

Should be a Signed-off-by from Kuogee Hsieh here.

Quoted 27 lines

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 10 ++++++----

 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +6 -4
index 1590144..8d97430 100644
@@ -2887,11 +2887,13 @@ static int process_single_tx_qlock(struct
 drm_dp_mst_topology_mgr *mgr,
         idx += tosend + 1;
 
         ret = drm_dp_send_sideband_msg(mgr, up, chunk, idx);
-       if (unlikely(ret) && drm_debug_enabled(DRM_UT_DP)) {
-               struct drm_printer p = drm_debug_printer(DBG_PREFIX);
+       if (unlikely(ret)) {
+               if (drm_debug_enabled(DRM_UT_DP)) {
+                       struct drm_printer p =
 drm_debug_printer(DBG_PREFIX);
 
-               drm_printf(&p, "sideband msg failed to send\n");
-               drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
+                       drm_printf(&p, "sideband msg failed to send\n");
+                       drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
+               }
                 return ret;
Quoted 2 lines

        }

With the above fixed up

Signature · 3 lines
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat