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 – Jul 5, 2021

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

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

From: Rajkumar Subbiah <[email protected]>

Commit 2f015ec6eab6 ("drm/dp_mst: Add sideband down request tracing + selftests") 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. Fixes the issue by returning the proper error code.

Changes in V2:
-- Revise commit text as review comment
-- add Fixes text

Fixes 2f015ec6eab6 ("drm/dp_mst: Add sideband down request tracing + selftests")
---
 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
#1 lore raw

JFYI: will try to take a look at this at the start of next week

Quoted 51 lines · Kuogee Hsieh

From: Rajkumar Subbiah <[email protected]>

Commit 2f015ec6eab6 ("drm/dp_mst: Add sideband down request tracing + selftests") 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. Fixes the issue by returning the proper error code.

Changes in V2:
-- Revise commit text as review comment
-- add Fixes text

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

selftests")

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

 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
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 · 3 lines
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat
Reviewed-by on v2 1/1
#2 lore raw
In reply to Kuogee Hsieh
Quoted 36 lines · Kuogee Hsieh

From: Rajkumar Subbiah <[email protected]>

Commit 2f015ec6eab6 ("drm/dp_mst: Add sideband down request tracing + selftests") 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. Fixes the issue by returning the proper error code.

Changes in V2:
-- Revise commit text as review comment
-- add Fixes text

Fixes 2f015ec6eab6 ("drm/dp_mst: Add sideband down request tracing + selftests")
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +1 -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)) {

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

Quoted 10 lines
drivers/gpu/drm/drm_dp_mst_topology.c +5 -2
+		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;
 	}

Seems like a sensible thing to do.

(I'd probably rip out the "unlikely" while at it, as it feels like unnecessary optimization, but *shrug*.)

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center