Skip to contentSkip to conversation

drm/mst: Add support for simultaneous down replies

PATCH In review Sean Paul 3 participants 14 messages Feb 13, 2020 – Mar 6, 2020

Subsystems (2)
lore
Share & tools
lore

Sean Paul

author
#0 lore raw

cover drm/mst: Add support for simultaneous down replies

From: Sean Paul <[email protected]>

Hey all,
Earlier this week on my 5.5 kernel (I can't seem to get a 5.6 kernel to behave on any of my devices), I ran into the multi-reply problem that Wayne fixed in January. Without realizing there was already a fix upstream, I went about solving it in different way. It wasn't until rebasing the patches on 5.6 for the list that I realized there was already a solution.

At any rate, I think this way of handling things might be a bit more performant. I'm not super happy with the cleanliness of the code, I think this series should make things easier to read, but I don't think I achieved that. So suggestions are welcome on how to break this apart.

Thanks,

Sean

Sean Paul (3):
drm/mst: Separate sideband packet header parsing from message building drm/mst: Support simultaneous down replies
drm/dp_mst: Remove single tx msg restriction.

 drivers/gpu/drm/drm_dp_mst_topology.c | 196 ++++++++++++++------------
 include/drm/drm_dp_mst_helper.h       |  65 ++++-----
 2 files changed, 137 insertions(+), 124 deletions(-)
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#1 lore raw

PATCH 1/3 drm/mst: Separate sideband packet header parsing from message building

From: Sean Paul <[email protected]>

In preparation of per-branch device down message handling, separate header parsing from message building. This will allow us to peek at figure out which branch device the message is from before starting to parse the message contents.

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 102 ++++++++++++++------------
 1 file changed, 57 insertions(+), 45 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +57 -45
index a811247cecfef..e8bb39bb17a0f 100644
@@ -687,51 +687,45 @@ static void drm_dp_encode_sideband_reply(struct drm_dp_sideband_msg_reply_body *
 	raw->cur_len = idx;
 }
 
-/* this adds a chunk of msg to the builder to get the final msg */
-static bool drm_dp_sideband_msg_build(struct drm_dp_sideband_msg_rx *msg,
-				      u8 *replybuf, u8 replybuflen, bool hdr)
+static int drm_dp_sideband_msg_set_header(struct drm_dp_sideband_msg_rx *msg,
+					  struct drm_dp_sideband_msg_hdr *hdr,
+					  u8 hdrlen)
 {
-	int ret;
-	u8 crc4;
+	/*
+	 * ignore out-of-order messages or messages that are part of a
+	 * failed transaction
+	 */
+	if (!hdr->somt && !msg->have_somt)
+		return false;
 
-	if (hdr) {
-		u8 hdrlen;
-		struct drm_dp_sideband_msg_hdr recv_hdr;
-		ret = drm_dp_decode_sideband_msg_hdr(&recv_hdr, replybuf, replybuflen, &hdrlen);
-		if (ret == false) {
-			print_hex_dump(KERN_DEBUG, "failed hdr", DUMP_PREFIX_NONE, 16, 1, replybuf, replybuflen, false);
-			return false;
-		}
+	/* get length contained in this portion */
+	msg->curchunk_idx = 0;
+	msg->curchunk_len = hdr->msg_len;
+	msg->curchunk_hdrlen = hdrlen;
 
-		/*
-		 * ignore out-of-order messages or messages that are part of a
-		 * failed transaction
-		 */
-		if (!recv_hdr.somt && !msg->have_somt)
-			return false;
+	/* we have already gotten an somt - don't bother parsing */
+	if (hdr->somt && msg->have_somt)
+		return false;
 
-		/* get length contained in this portion */
-		msg->curchunk_len = recv_hdr.msg_len;
-		msg->curchunk_hdrlen = hdrlen;
+	if (hdr->somt) {
+		memcpy(&msg->initial_hdr, hdr,
+		       sizeof(struct drm_dp_sideband_msg_hdr));
+		msg->have_somt = true;
+	}
+	if (hdr->eomt)
+		msg->have_eomt = true;
 
-		/* we have already gotten an somt - don't bother parsing */
-		if (recv_hdr.somt && msg->have_somt)
-			return false;
+	return true;
+}
 
-		if (recv_hdr.somt) {
-			memcpy(&msg->initial_hdr, &recv_hdr, sizeof(struct drm_dp_sideband_msg_hdr));
-			msg->have_somt = true;
-		}
-		if (recv_hdr.eomt)
-			msg->have_eomt = true;
+/* this adds a chunk of msg to the builder to get the final msg */
+static bool drm_dp_sideband_msg_build(struct drm_dp_sideband_msg_rx *msg,
+				      u8 *replybuf, u8 replybuflen)
+{
+	u8 crc4;
 
-		/* copy the bytes for the remainder of this header chunk */
-		msg->curchunk_idx = min(msg->curchunk_len, (u8)(replybuflen - hdrlen));
-		memcpy(&msg->chunk[0], replybuf + hdrlen, msg->curchunk_idx);
-	} else {
-		memcpy(&msg->chunk[msg->curchunk_idx], replybuf, replybuflen);
-		msg->curchunk_idx += replybuflen;
-	}
+	memcpy(&msg->chunk[msg->curchunk_idx], replybuf, replybuflen);
+	msg->curchunk_idx += replybuflen;
 
 	if (msg->curchunk_idx >= msg->curchunk_len) {
 		/* do CRC */
@@ -3702,25 +3696,43 @@ static bool drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up)
 	u8 replyblock[32];
 	int replylen, curreply;
 	int ret;
+	u8 hdrlen;
+	struct drm_dp_sideband_msg_hdr hdr;
 	struct drm_dp_sideband_msg_rx *msg;
-	int basereg = up ? DP_SIDEBAND_MSG_UP_REQ_BASE : DP_SIDEBAND_MSG_DOWN_REP_BASE;
+	int basereg = up ? DP_SIDEBAND_MSG_UP_REQ_BASE :
+			   DP_SIDEBAND_MSG_DOWN_REP_BASE;
+
 	msg = up ? &mgr->up_req_recv : &mgr->down_rep_recv;
 
 	len = min(mgr->max_dpcd_transaction_bytes, 16);
-	ret = drm_dp_dpcd_read(mgr->aux, basereg,
-			       replyblock, len);
+	ret = drm_dp_dpcd_read(mgr->aux, basereg, replyblock, len);
 	if (ret != len) {
 		DRM_DEBUG_KMS("failed to read DPCD down rep %d %d\n", len, ret);
 		return false;
 	}
-	ret = drm_dp_sideband_msg_build(msg, replyblock, len, true);
+
+	ret = drm_dp_decode_sideband_msg_hdr(&hdr, replyblock, len, &hdrlen);
+	if (ret == false) {
+		print_hex_dump(KERN_DEBUG, "failed hdr", DUMP_PREFIX_NONE, 16,
+			       1, replyblock, len, false);
+		DRM_DEBUG_KMS("ERROR: failed header\n");
+		return false;
+	}
+
+	if (!drm_dp_sideband_msg_set_header(msg, &hdr, hdrlen)) {
+		DRM_DEBUG_KMS("sideband msg set header failed %d\n",
+			      replyblock[0]);
+		return false;
+	}
+
+	replylen = min(msg->curchunk_len, (u8)(len - hdrlen));
+	ret = drm_dp_sideband_msg_build(msg, replyblock + hdrlen, replylen);
 	if (!ret) {
 		DRM_DEBUG_KMS("sideband msg build failed %d\n", replyblock[0]);
 		return false;
 	}
-	replylen = msg->curchunk_len + msg->curchunk_hdrlen;
 
-	replylen -= len;
+	replylen = msg->curchunk_len + msg->curchunk_hdrlen - len;
 	curreply = len;
 	while (replylen > 0) {
 		len = min3(replylen, mgr->max_dpcd_transaction_bytes, 16);
@@ -3732,7 +3744,7 @@ static bool drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up)
 			return false;
 		}
 
-		ret = drm_dp_sideband_msg_build(msg, replyblock, len, false);
+		ret = drm_dp_sideband_msg_build(msg, replyblock, len);
 		if (!ret) {
 			DRM_DEBUG_KMS("failed to build sideband msg\n");
 			return false;
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#2 lore raw

PATCH 2/3 drm/mst: Support simultaneous down replies

In reply to Sean Paul

From: Sean Paul <[email protected]>

Currently we have one down reply message servicing the mst manager, so we need to serialize all tx msgs to ensure we only have one message in flight at a time. For obvious reasons this is suboptimal (but less suboptimal than the free-for-all we had before serialization).

This patch removes the single down_rep_recv message from manager and adds 2 replies in the branch structure. The 2 replies mirrors the tx_slots which we use to rate-limit outgoing messages and correspond to seqno in the packet headers.

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 80 ++++++++++++++++-----------
 include/drm/drm_dp_mst_helper.h       | 59 ++++++++++----------
 2 files changed, 78 insertions(+), 61 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +48 -32
index e8bb39bb17a0f..7e6a82efdfc02 100644
@@ -3690,7 +3690,8 @@ int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr,
 }
 EXPORT_SYMBOL(drm_dp_mst_topology_mgr_resume);
 
-static bool drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up)
+static bool drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up,
+				  struct drm_dp_mst_branch **mstb, int *seqno)
 {
 	int len;
 	u8 replyblock[32];
@@ -3702,7 +3703,8 @@ static bool drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up)
 	int basereg = up ? DP_SIDEBAND_MSG_UP_REQ_BASE :
 			   DP_SIDEBAND_MSG_DOWN_REP_BASE;
 
-	msg = up ? &mgr->up_req_recv : &mgr->down_rep_recv;
+	*mstb = NULL;
+	*seqno = -1;
 
 	len = min(mgr->max_dpcd_transaction_bytes, 16);
 	ret = drm_dp_dpcd_read(mgr->aux, basereg, replyblock, len);
@@ -3719,6 +3721,21 @@ static bool drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up)
 		return false;
 	}
 
+	*seqno = hdr.seqno;
+
+	if (up) {
+		msg = &mgr->up_req_recv;
+	} else {
+		/* Caller is responsible for giving back this reference */
+		*mstb = drm_dp_get_mst_branch_device(mgr, hdr.lct, hdr.rad);
+		if (!*mstb) {
+			DRM_DEBUG_KMS("Got MST reply from unknown device %d\n",
+				      hdr.lct);
+			return false;
+		}
+		msg = &(*mstb)->down_rep_recv[hdr.seqno];
+	}
+
 	if (!drm_dp_sideband_msg_set_header(msg, &hdr, hdrlen)) {
 		DRM_DEBUG_KMS("sideband msg set header failed %d\n",
 			      replyblock[0]);
@@ -3759,53 +3776,52 @@ static bool drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up)
 static int drm_dp_mst_handle_down_rep(struct drm_dp_mst_topology_mgr *mgr)
 {
 	struct drm_dp_sideband_msg_tx *txmsg;
-	struct drm_dp_mst_branch *mstb;
-	struct drm_dp_sideband_msg_hdr *hdr = &mgr->down_rep_recv.initial_hdr;
-	int slot = -1;
+	struct drm_dp_mst_branch *mstb = NULL;
+	struct drm_dp_sideband_msg_rx *msg = NULL;
+	int seqno = -1;
 
-	if (!drm_dp_get_one_sb_msg(mgr, false))
-		goto clear_down_rep_recv;
+	if (!drm_dp_get_one_sb_msg(mgr, false, &mstb, &seqno))
+		goto out_clear_reply;
 
-	if (!mgr->down_rep_recv.have_eomt)
-		return 0;
+	msg = &mstb->down_rep_recv[seqno];
 
-	mstb = drm_dp_get_mst_branch_device(mgr, hdr->lct, hdr->rad);
-	if (!mstb) {
-		DRM_DEBUG_KMS("Got MST reply from unknown device %d\n",
-			      hdr->lct);
-		goto clear_down_rep_recv;
-	}
+	/* Multi-packet message transmission, don't clear the reply */
+	if (!msg->have_eomt)
+		goto out;
 
 	/* find the message */
-	slot = hdr->seqno;
 	mutex_lock(&mgr->qlock);
-	txmsg = mstb->tx_slots[slot];
+	txmsg = mstb->tx_slots[seqno];
 	/* remove from slots */
 	mutex_unlock(&mgr->qlock);
 
 	if (!txmsg) {
+		struct drm_dp_sideband_msg_hdr *hdr;
+		hdr = &msg->initial_hdr;
 		DRM_DEBUG_KMS("Got MST reply with no msg %p %d %d %02x %02x\n",
 			      mstb, hdr->seqno, hdr->lct, hdr->rad[0],
-			      mgr->down_rep_recv.msg[0]);
-		goto no_msg;
+			      msg->msg[0]);
+		goto out_clear_reply;
 	}
 
-	drm_dp_sideband_parse_reply(&mgr->down_rep_recv, &txmsg->reply);
+	drm_dp_sideband_parse_reply(msg, &txmsg->reply);
 
-	if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
+	if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK) {
 		DRM_DEBUG_KMS("Got NAK reply: req 0x%02x (%s), reason 0x%02x (%s), nak data 0x%02x\n",
 			      txmsg->reply.req_type,
 			      drm_dp_mst_req_type_str(txmsg->reply.req_type),
 			      txmsg->reply.u.nak.reason,
 			      drm_dp_mst_nak_reason_str(txmsg->reply.u.nak.reason),
 			      txmsg->reply.u.nak.nak_data);
+		goto out_clear_reply;
+	}
 
-	memset(&mgr->down_rep_recv, 0, sizeof(struct drm_dp_sideband_msg_rx));
+	memset(msg, 0, sizeof(struct drm_dp_sideband_msg_rx));
 	drm_dp_mst_topology_put_mstb(mstb);
 
 	mutex_lock(&mgr->qlock);
 	txmsg->state = DRM_DP_SIDEBAND_TX_RX;
-	mstb->tx_slots[slot] = NULL;
+	mstb->tx_slots[seqno] = NULL;
 	mgr->is_waiting_for_dwn_reply = false;
 	mutex_unlock(&mgr->qlock);
 
@@ -3813,13 +3829,15 @@ static int drm_dp_mst_handle_down_rep(struct drm_dp_mst_topology_mgr *mgr)
 
 	return 0;
 
-no_msg:
-	drm_dp_mst_topology_put_mstb(mstb);
-clear_down_rep_recv:
+out_clear_reply:
 	mutex_lock(&mgr->qlock);
 	mgr->is_waiting_for_dwn_reply = false;
 	mutex_unlock(&mgr->qlock);
-	memset(&mgr->down_rep_recv, 0, sizeof(struct drm_dp_sideband_msg_rx));
+	if (msg)
+		memset(msg, 0, sizeof(struct drm_dp_sideband_msg_rx));
+out:
+	if (mstb)
+		drm_dp_mst_topology_put_mstb(mstb);
 
 	return 0;
 }
@@ -3895,11 +3913,10 @@ static void drm_dp_mst_up_req_work(struct work_struct *work)
 
 static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr)
 {
-	struct drm_dp_sideband_msg_hdr *hdr = &mgr->up_req_recv.initial_hdr;
 	struct drm_dp_pending_up_req *up_req;
-	bool seqno;
+	int seqno;
 
-	if (!drm_dp_get_one_sb_msg(mgr, true))
+	if (!drm_dp_get_one_sb_msg(mgr, true, NULL, &seqno))
 		goto out;
 
 	if (!mgr->up_req_recv.have_eomt)
@@ -3912,7 +3929,6 @@ static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr)
 	}
 	INIT_LIST_HEAD(&up_req->next);
 
-	seqno = hdr->seqno;
 	drm_dp_sideband_parse_req(&mgr->up_req_recv, &up_req->msg);
 
 	if (up_req->msg.req_type != DP_CONNECTION_STATUS_NOTIFY &&
@@ -3946,7 +3962,7 @@ static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr)
 			      res_stat->available_pbn);
 	}
 
-	up_req->hdr = *hdr;
+	up_req->hdr = mgr->up_req_recv.initial_hdr;
 	mutex_lock(&mgr->up_req_lock);
 	list_add_tail(&up_req->next, &mgr->up_req_list);
 	mutex_unlock(&mgr->up_req_lock);
include/drm/drm_dp_mst_helper.h +30 -29

88 lines not on this page · raw message

Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#3 lore raw

PATCH 3/3 drm/dp_mst: Remove single tx msg restriction.

In reply to Sean Paul

From: Sean Paul <[email protected]>

Now that we can support multiple simultaneous replies, remove the restrictions placed on sending new tx msgs.

This patch essentially just reverts commit
5a64967a2f3b ("drm/dp_mst: Have DP_Tx send one msg at a time")
now that the problem is solved in a different way.

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 14 ++------------
 include/drm/drm_dp_mst_helper.h       |  6 ------
 2 files changed, 2 insertions(+), 18 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +2 -12
index 7e6a82efdfc02..cbf0bb0ddeb84 100644
@@ -1203,8 +1203,6 @@ static int drm_dp_mst_wait_tx_reply(struct drm_dp_mst_branch *mstb,
 		    txmsg->state == DRM_DP_SIDEBAND_TX_SENT) {
 			mstb->tx_slots[txmsg->seqno] = NULL;
 		}
-		mgr->is_waiting_for_dwn_reply = false;
-
 	}
 out:
 	if (unlikely(ret == -EIO) && drm_debug_enabled(DRM_UT_DP)) {
@@ -1214,7 +1212,6 @@ static int drm_dp_mst_wait_tx_reply(struct drm_dp_mst_branch *mstb,
 	}
 	mutex_unlock(&mgr->qlock);
 
-	drm_dp_mst_kick_tx(mgr);
 	return ret;
 }
 
@@ -2797,11 +2794,9 @@ static void process_single_down_tx_qlock(struct drm_dp_mst_topology_mgr *mgr)
 	ret = process_single_tx_qlock(mgr, txmsg, false);
 	if (ret == 1) {
 		/* txmsg is sent it should be in the slots now */
-		mgr->is_waiting_for_dwn_reply = true;
 		list_del(&txmsg->next);
 	} else if (ret) {
 		DRM_DEBUG_KMS("failed to send msg in q %d\n", ret);
-		mgr->is_waiting_for_dwn_reply = false;
 		list_del(&txmsg->next);
 		if (txmsg->seqno != -1)
 			txmsg->dst->tx_slots[txmsg->seqno] = NULL;
@@ -2841,8 +2836,7 @@ static void drm_dp_queue_down_tx(struct drm_dp_mst_topology_mgr *mgr,
 		drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
 	}
 
-	if (list_is_singular(&mgr->tx_msg_downq) &&
-	    !mgr->is_waiting_for_dwn_reply)
+	if (list_is_singular(&mgr->tx_msg_downq))
 		process_single_down_tx_qlock(mgr);
 	mutex_unlock(&mgr->qlock);
 }
@@ -3822,7 +3816,6 @@ static int drm_dp_mst_handle_down_rep(struct drm_dp_mst_topology_mgr *mgr)
 	mutex_lock(&mgr->qlock);
 	txmsg->state = DRM_DP_SIDEBAND_TX_RX;
 	mstb->tx_slots[seqno] = NULL;
-	mgr->is_waiting_for_dwn_reply = false;
 	mutex_unlock(&mgr->qlock);
 
 	wake_up_all(&mgr->tx_waitq);
@@ -3830,9 +3823,6 @@ static int drm_dp_mst_handle_down_rep(struct drm_dp_mst_topology_mgr *mgr)
 	return 0;
 
 out_clear_reply:
-	mutex_lock(&mgr->qlock);
-	mgr->is_waiting_for_dwn_reply = false;
-	mutex_unlock(&mgr->qlock);
 	if (msg)
 		memset(msg, 0, sizeof(struct drm_dp_sideband_msg_rx));
 out:
@@ -4670,7 +4660,7 @@ static void drm_dp_tx_work(struct work_struct *work)
 	struct drm_dp_mst_topology_mgr *mgr = container_of(work, struct drm_dp_mst_topology_mgr, tx_work);
 
 	mutex_lock(&mgr->qlock);
-	if (!list_empty(&mgr->tx_msg_downq) && !mgr->is_waiting_for_dwn_reply)
+	if (!list_empty(&mgr->tx_msg_downq))
 		process_single_down_tx_qlock(mgr);
 	mutex_unlock(&mgr->qlock);
 }
include/drm/drm_dp_mst_helper.h +0 -6
index 7d0341f94ce1b..fcc30e64c8e7e 100644
@@ -619,12 +619,6 @@ struct drm_dp_mst_topology_mgr {
 	 * &drm_dp_sideband_msg_tx.state once they are queued
 	 */
 	struct mutex qlock;
-
-	/**
-	 * @is_waiting_for_dwn_reply: indicate whether is waiting for down reply
-	 */
-	bool is_waiting_for_dwn_reply;
-
 	/**
 	 * @tx_msg_downq: List of pending down replies.
 	 */
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS

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

RE: [PATCH 3/3] drm/dp_mst: Remove single tx msg restriction.

[AMD Public Use]

Hi Paul,

Thanks for the mail!

I tried to solve this problem by having restriction on sending one msg at a time due to hub/dock compatibility problems. From my experience, some branch devices don't handle well on interleaved replies (Dock from HP I think)
As the result of that, correct me if I'm wrong, I remember most gpu vendors just send one down request at a time now in windows environment. I would suggest the original solution :)

Thanks!

Quoted 126 lines

-----Original Message-----
From: Sean Paul <[email protected]>
Sent: Friday, February 14, 2020 5:15 AM
To: [email protected]
Cc: [email protected]; Lin, Wayne <[email protected]>; Sean Paul <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; David Airlie <[email protected]>
Subject: [PATCH 3/3] drm/dp_mst: Remove single tx msg restriction.

From: Sean Paul <[email protected]>

Now that we can support multiple simultaneous replies, remove the restrictions placed on sending new tx msgs.

This patch essentially just reverts commit
5a64967a2f3b ("drm/dp_mst: Have DP_Tx send one msg at a time") now
that the problem is solved in a different way.

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 14 ++------------
 include/drm/drm_dp_mst_helper.h       |  6 ------
 2 files changed, 2 insertions(+), 18 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
index 7e6a82efdfc02..cbf0bb0ddeb84 100644
@@ -1203,8 +1203,6 @@ static int drm_dp_mst_wait_tx_reply(struct
 drm_dp_mst_branch *mstb,
 		    txmsg->state == DRM_DP_SIDEBAND_TX_SENT) {
 			mstb->tx_slots[txmsg->seqno] = NULL;
 		}
-		mgr->is_waiting_for_dwn_reply = false;
-
 	}
 out:

if (unlikely(ret == -EIO) && drm_debug_enabled(DRM_UT_DP)) { @@
-1214,7 +1212,6 @@ static int drm_dp_mst_wait_tx_reply(struct drm_dp_mst_branch *mstb,

drivers/gpu/drm/drm_dp_mst_topology.c +0 -3
 	}
 	mutex_unlock(&mgr->qlock);
 
-	drm_dp_mst_kick_tx(mgr);
 	return ret;
 }
@@ -2797,11 +2794,9 @@ static void process_single_down_tx_qlock(struct
 drm_dp_mst_topology_mgr *mgr)
 	ret = process_single_tx_qlock(mgr, txmsg, false);
 	if (ret == 1) {
 		/* txmsg is sent it should be in the slots now */
-		mgr->is_waiting_for_dwn_reply = true;
 		list_del(&txmsg->next);
 	} else if (ret) {
 		DRM_DEBUG_KMS("failed to send msg in q %d\n", ret);
-		mgr->is_waiting_for_dwn_reply = false;
 		list_del(&txmsg->next);
 		if (txmsg->seqno != -1)

txmsg->dst->tx_slots[txmsg->seqno] = NULL; @@ -2841,8
+2836,7 @@ static void drm_dp_queue_down_tx(struct drm_dp_mst_topology_mgr *mgr,

drivers/gpu/drm/drm_dp_mst_topology.c +1 -3
 		drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
 	}
 
-	if (list_is_singular(&mgr->tx_msg_downq) &&
-	    !mgr->is_waiting_for_dwn_reply)
+	if (list_is_singular(&mgr->tx_msg_downq))
 		process_single_down_tx_qlock(mgr);
 	mutex_unlock(&mgr->qlock);
 }
@@ -3822,7 +3816,6 @@ static int drm_dp_mst_handle_down_rep(struct
 drm_dp_mst_topology_mgr *mgr)
 	mutex_lock(&mgr->qlock);
 	txmsg->state = DRM_DP_SIDEBAND_TX_RX;
 	mstb->tx_slots[seqno] = NULL;
-	mgr->is_waiting_for_dwn_reply = false;
 	mutex_unlock(&mgr->qlock);
 
drivers/gpu/drm/drm_dp_mst_topology.c +0 -3
 	wake_up_all(&mgr->tx_waitq);
@@ -3830,9 +3823,6 @@ static int drm_dp_mst_handle_down_rep(struct
 drm_dp_mst_topology_mgr *mgr)
 	return 0;
 
 out_clear_reply:
-	mutex_lock(&mgr->qlock);
-	mgr->is_waiting_for_dwn_reply = false;
-	mutex_unlock(&mgr->qlock);
 	if (msg)
 		memset(msg, 0, sizeof(struct drm_dp_sideband_msg_rx));

out:

drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -4670,7 +4660,7 @@ static void drm_dp_tx_work(struct work_struct
 *work)
 	struct drm_dp_mst_topology_mgr *mgr = container_of(work, struct
 drm_dp_mst_topology_mgr, tx_work);
 
 	mutex_lock(&mgr->qlock);
-	if (!list_empty(&mgr->tx_msg_downq)
 && !mgr->is_waiting_for_dwn_reply)
+	if (!list_empty(&mgr->tx_msg_downq))
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
 		process_single_down_tx_qlock(mgr);
 	mutex_unlock(&mgr->qlock);
 }
(quoted diff) +0 -0

b/include/drm/drm_dp_mst_helper.h index 7d0341f94ce1b..fcc30e64c8e7e 100644

include/drm/drm_dp_mst_helper.h +0 -3
@@ -619,12 +619,6 @@ struct drm_dp_mst_topology_mgr {
 	 * &drm_dp_sideband_msg_tx.state once they are queued
 	 */
 	struct mutex qlock;
-
-	/**
-	 * @is_waiting_for_dwn_reply: indicate whether is waiting for down

reply

include/drm/drm_dp_mst_helper.h +0 -4
-	 */
-	bool is_waiting_for_dwn_reply;
-
 	/**
 	 * @tx_msg_downq: List of pending down replies.
 	 */
--
Quoted 1 line

Sean Paul, Software Engineer, Google / Chromium OS

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

author
#5 lore raw

Re: [PATCH 3/3] drm/dp_mst: Remove single tx msg restriction.

Quoted 9 lines · Wayne

[AMD Public Use]

Hi Paul,

Thanks for the mail!

I tried to solve this problem by having restriction on sending one msg at a time due to hub/dock compatibility problems. From my experience, some branch devices don't handle well on interleaved replies (Dock from HP I think)

Hi Wayne,
Hmm, that's interesting, do you have a part number of the failing dock so I can test it?

Quoted 2 lines

As the result of that, correct me if I'm wrong, I remember most gpu vendors just send one down request at a time now in windows environment. I would suggest the original solution :)

I can't really say what happens on the Windows side of the world, but I suppose that makes sense if this is a widespread issue with docks. I do worry about the performance hit.

If indeed this is a problem, could we ratelimit per branch device instead of globally? Even that would be better than serializing everything.

Sean

Quoted 123 lines

Thanks!

Quoted 121 lines

-----Original Message-----
From: Sean Paul <[email protected]>
Sent: Friday, February 14, 2020 5:15 AM
To: [email protected]
Cc: [email protected]; Lin, Wayne <[email protected]>; Sean Paul <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; David Airlie <[email protected]>
Subject: [PATCH 3/3] drm/dp_mst: Remove single tx msg restriction.

From: Sean Paul <[email protected]>

Now that we can support multiple simultaneous replies, remove the restrictions placed on sending new tx msgs.

This patch essentially just reverts commit
5a64967a2f3b ("drm/dp_mst: Have DP_Tx send one msg at a time") now
that the problem is solved in a different way.

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 14 ++------------
 include/drm/drm_dp_mst_helper.h       |  6 ------
 2 files changed, 2 insertions(+), 18 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
index 7e6a82efdfc02..cbf0bb0ddeb84 100644
@@ -1203,8 +1203,6 @@ static int drm_dp_mst_wait_tx_reply(struct
 drm_dp_mst_branch *mstb,
                  txmsg->state == DRM_DP_SIDEBAND_TX_SENT) {
                      mstb->tx_slots[txmsg->seqno] = NULL;
              }
-             mgr->is_waiting_for_dwn_reply = false;
-
      }
 out:
      if (unlikely(ret == -EIO) && drm_debug_enabled(DRM_UT_DP)) { @@
-1214,7 +1212,6 @@ static int drm_dp_mst_wait_tx_reply(struct
drm_dp_mst_branch *mstb,
      }
      mutex_unlock(&mgr->qlock);
drivers/gpu/drm/drm_dp_mst_topology.c +0 -3
-     drm_dp_mst_kick_tx(mgr);
      return ret;
 }
@@ -2797,11 +2794,9 @@ static void process_single_down_tx_qlock(struct
 drm_dp_mst_topology_mgr *mgr)
      ret = process_single_tx_qlock(mgr, txmsg, false);
      if (ret == 1) {
              /* txmsg is sent it should be in the slots now */
-             mgr->is_waiting_for_dwn_reply = true;
              list_del(&txmsg->next);
      } else if (ret) {
              DRM_DEBUG_KMS("failed to send msg in q %d\n", ret);
-             mgr->is_waiting_for_dwn_reply = false;
              list_del(&txmsg->next);
              if (txmsg->seqno != -1)
                      txmsg->dst->tx_slots[txmsg->seqno] = NULL; @@ -2841,8
+2836,7 @@ static void drm_dp_queue_down_tx(struct
drm_dp_mst_topology_mgr *mgr,
              drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
      }
drivers/gpu/drm/drm_dp_mst_topology.c +1 -3
-     if (list_is_singular(&mgr->tx_msg_downq) &&
-         !mgr->is_waiting_for_dwn_reply)
+     if (list_is_singular(&mgr->tx_msg_downq))
              process_single_down_tx_qlock(mgr);
      mutex_unlock(&mgr->qlock);
 }
@@ -3822,7 +3816,6 @@ static int drm_dp_mst_handle_down_rep(struct
 drm_dp_mst_topology_mgr *mgr)
      mutex_lock(&mgr->qlock);
      txmsg->state = DRM_DP_SIDEBAND_TX_RX;
      mstb->tx_slots[seqno] = NULL;
-     mgr->is_waiting_for_dwn_reply = false;
      mutex_unlock(&mgr->qlock);
 
      wake_up_all(&mgr->tx_waitq);
drivers/gpu/drm/drm_dp_mst_topology.c +0 -3
@@ -3830,9 +3823,6 @@ static int drm_dp_mst_handle_down_rep(struct
 drm_dp_mst_topology_mgr *mgr)
      return 0;
 
 out_clear_reply:
-     mutex_lock(&mgr->qlock);
-     mgr->is_waiting_for_dwn_reply = false;
-     mutex_unlock(&mgr->qlock);
      if (msg)
              memset(msg, 0, sizeof(struct drm_dp_sideband_msg_rx));

out:

drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -4670,7 +4660,7 @@ static void drm_dp_tx_work(struct work_struct
 *work)
      struct drm_dp_mst_topology_mgr *mgr = container_of(work, struct
 drm_dp_mst_topology_mgr, tx_work);
 
      mutex_lock(&mgr->qlock);
-     if (!list_empty(&mgr->tx_msg_downq)
 && !mgr->is_waiting_for_dwn_reply)
+     if (!list_empty(&mgr->tx_msg_downq))
              process_single_down_tx_qlock(mgr);
      mutex_unlock(&mgr->qlock);

}

(quoted diff) +0 -0

b/include/drm/drm_dp_mst_helper.h index 7d0341f94ce1b..fcc30e64c8e7e 100644

include/drm/drm_dp_mst_helper.h +0 -3
@@ -619,12 +619,6 @@ struct drm_dp_mst_topology_mgr {
       * &drm_dp_sideband_msg_tx.state once they are queued
       */
      struct mutex qlock;
-
-     /**
-      * @is_waiting_for_dwn_reply: indicate whether is waiting for down

reply

include/drm/drm_dp_mst_helper.h +0 -2
-      */
-     bool is_waiting_for_dwn_reply;
Quoted 8 lines
Quoted 6 lines

-

      /**
       * @tx_msg_downq: List of pending down replies.
       */

--
Sean Paul, Software Engineer, Google / Chromium OS

--
Wayne Lin

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

#6 lore raw

RE: [PATCH 3/3] drm/dp_mst: Remove single tx msg restriction.

[AMD Public Use]

Quoted 18 lines

-----Original Message-----
From: Sean Paul <[email protected]>
Sent: Saturday, February 15, 2020 12:09 AM
To: Lin, Wayne <[email protected]>
Cc: [email protected]; [email protected]; Sean Paul <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; David Airlie <[email protected]>
Subject: Re: [PATCH 3/3] drm/dp_mst: Remove single tx msg restriction.

Quoted 7 lines · Wayne

[AMD Public Use]

Hi Paul,

Thanks for the mail!

Quoted 9 lines
Quoted 1 line

I tried to solve this problem by having restriction on sending one msg at a

time due to hub/dock compatibility problems.

Quoted 2 lines

From my experience, some branch devices don't handle well on interleaved replies (Dock from HP I think)

Hi Wayne,
Hmm, that's interesting, do you have a part number of the failing dock so I can test it?

Hi Paul,

Sorry but it's been quite a while. I can't exactly tell the part number. If I remember correctly, when the specific branch device receives interleaved replies, it just doesn't reply to any requests.

Quoted 11 lines
Quoted 1 line

As the result of that, correct me if I'm wrong, I remember most gpu vendors

just send one down request at a time now in windows environment.

Quoted 1 line

I would suggest the original solution :)

I can't really say what happens on the Windows side of the world, but I suppose that makes sense if this is a widespread issue with docks. I do worry about the performance hit.

If indeed this is a problem, could we ratelimit per branch device instead of globally? Even that would be better than serializing everything.

Since the problem was because some branch devices can't simultaneously handle two replies, I'm afraid that we might still encounter the same problem?

Thanks!

Quoted 119 lines

Sean

Quoted 19 lines

Thanks!

Quoted 17 lines

-----Original Message-----
From: Sean Paul <[email protected]>
Sent: Friday, February 14, 2020 5:15 AM
To: [email protected]
Cc: [email protected]; Lin, Wayne <[email protected]>; Sean Paul <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; David Airlie <[email protected]>
Subject: [PATCH 3/3] drm/dp_mst: Remove single tx msg restriction.

From: Sean Paul <[email protected]>

Now that we can support multiple simultaneous replies, remove the restrictions placed on sending new tx msgs.

This patch essentially just reverts commit
5a64967a2f3b ("drm/dp_mst: Have DP_Tx send one msg at a time")

now

Quoted 34 lines
Quoted 34 lines

that the problem is solved in a different way.

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 14 ++------------
 include/drm/drm_dp_mst_helper.h       |  6 ------
 2 files changed, 2 insertions(+), 18 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
index 7e6a82efdfc02..cbf0bb0ddeb84 100644
@@ -1203,8 +1203,6 @@ static int drm_dp_mst_wait_tx_reply(struct
 drm_dp_mst_branch *mstb,
                  txmsg->state == DRM_DP_SIDEBAND_TX_SENT) {
                      mstb->tx_slots[txmsg->seqno] = NULL;
              }
-             mgr->is_waiting_for_dwn_reply = false;
-
      }
 out:
      if (unlikely(ret == -EIO) && drm_debug_enabled(DRM_UT_DP)) {
@@
-1214,7 +1212,6 @@ static int drm_dp_mst_wait_tx_reply(struct
drm_dp_mst_branch *mstb,
      }
      mutex_unlock(&mgr->qlock);
-     drm_dp_mst_kick_tx(mgr);
      return ret;

}

Quoted 14 lines
Quoted 6 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -2797,11 +2794,9 @@ static void

process_single_down_tx_qlock(struct
drm_dp_mst_topology_mgr *mgr)

      ret = process_single_tx_qlock(mgr, txmsg, false);
      if (ret == 1) {
              /* txmsg is sent it should be in the slots now */

drivers/gpu/drm/drm_dp_mst_topology.c static void process_single_down_tx_qlock(struct drm_dp_mst_topology_mgr *mgr) · line 2802

Quoted 8 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
-             mgr->is_waiting_for_dwn_reply = true;
              list_del(&txmsg->next);
      } else if (ret) {
              DRM_DEBUG_KMS("failed to send msg in q %d\n", ret);
-             mgr->is_waiting_for_dwn_reply = false;
              list_del(&txmsg->next);
              if (txmsg->seqno != -1)
                      txmsg->dst->tx_slots[txmsg->seqno] = NULL;

@@

Quoted 25 lines
Quoted 25 lines

-2841,8
+2836,7 @@ static void drm_dp_queue_down_tx(struct drm_dp_mst_topology_mgr *mgr,

              drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
      }
drivers/gpu/drm/drm_dp_mst_topology.c +1 -3
-     if (list_is_singular(&mgr->tx_msg_downq) &&
-         !mgr->is_waiting_for_dwn_reply)
+     if (list_is_singular(&mgr->tx_msg_downq))
              process_single_down_tx_qlock(mgr);
      mutex_unlock(&mgr->qlock);
 }
@@ -3822,7 +3816,6 @@ static int drm_dp_mst_handle_down_rep(struct
 drm_dp_mst_topology_mgr *mgr)
      mutex_lock(&mgr->qlock);
      txmsg->state = DRM_DP_SIDEBAND_TX_RX;
      mstb->tx_slots[seqno] = NULL;
-     mgr->is_waiting_for_dwn_reply = false;
      mutex_unlock(&mgr->qlock);
 
      wake_up_all(&mgr->tx_waitq);
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -3830,9 +3823,6 @@ static int drm_dp_mst_handle_down_rep(struct
 drm_dp_mst_topology_mgr *mgr)
      return 0;
 
Quoted 6 lines

drivers/gpu/drm/drm_dp_mst_topology.c static int drm_dp_mst_handle_down_rep(struct drm_dp_mst_topology_mgr *mgr)

Quoted 6 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -3
 out_clear_reply:
-     mutex_lock(&mgr->qlock);
-     mgr->is_waiting_for_dwn_reply = false;
-     mutex_unlock(&mgr->qlock);
      if (msg)
              memset(msg, 0, sizeof(struct

drm_dp_sideband_msg_rx));

Quoted 6 lines
Quoted 6 lines

out:

drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -4670,7 +4660,7 @@ static void drm_dp_tx_work(struct work_struct
 *work)
      struct drm_dp_mst_topology_mgr *mgr = container_of(work,
 struct drm_dp_mst_topology_mgr, tx_work);
 
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
      mutex_lock(&mgr->qlock);
-     if (!list_empty(&mgr->tx_msg_downq)
 && !mgr->is_waiting_for_dwn_reply)
+     if (!list_empty(&mgr->tx_msg_downq))
              process_single_down_tx_qlock(mgr);
      mutex_unlock(&mgr->qlock);

}

(quoted diff) +0 -0

b/include/drm/drm_dp_mst_helper.h index

7d0341f94ce1b..fcc30e64c8e7e

Quoted 22 lines
Quoted 10 lines

include/drm/drm_dp_mst_helper.h struct drm_dp_mst_topology_mgr { · line 624

Quoted 10 lines

100644

include/drm/drm_dp_mst_helper.h +0 -3
@@ -619,12 +619,6 @@ struct drm_dp_mst_topology_mgr {
       * &drm_dp_sideband_msg_tx.state once they are queued
       */
      struct mutex qlock;
-
-     /**
-      * @is_waiting_for_dwn_reply: indicate whether is waiting for

down

Quoted 11 lines
Quoted 9 lines

reply

include/drm/drm_dp_mst_helper.h +0 -4
-      */
-     bool is_waiting_for_dwn_reply;
-
      /**
       * @tx_msg_downq: List of pending down replies.
       */
--

Sean Paul, Software Engineer, Google / Chromium OS

--
Wayne Lin

--
Best regards,
Wayne Lin
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#7 lore raw

Re: [PATCH 3/3] drm/dp_mst: Remove single tx msg restriction.

Quoted 45 lines · Wayne

[AMD Public Use]

Quoted 18 lines

-----Original Message-----
From: Sean Paul <[email protected]>
Sent: Saturday, February 15, 2020 12:09 AM
To: Lin, Wayne <[email protected]>
Cc: [email protected]; [email protected]; Sean Paul <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; David Airlie <[email protected]>
Subject: Re: [PATCH 3/3] drm/dp_mst: Remove single tx msg restriction.

Quoted 7 lines · Wayne

[AMD Public Use]

Hi Paul,

Thanks for the mail!

Quoted 9 lines
Quoted 1 line

I tried to solve this problem by having restriction on sending one msg at a

time due to hub/dock compatibility problems.

Quoted 2 lines

From my experience, some branch devices don't handle well on interleaved replies (Dock from HP I think)

Hi Wayne,
Hmm, that's interesting, do you have a part number of the failing dock so I can test it?

Hi Paul,

Sorry but it's been quite a while. I can't exactly tell the part number. If I remember correctly, when the specific branch device receives interleaved replies, it just doesn't reply to any requests.

Quoted 8 lines
Quoted 1 line

As the result of that, correct me if I'm wrong, I remember most gpu vendors

just send one down request at a time now in windows environment.

Quoted 1 line

I would suggest the original solution :)

I can't really say what happens on the Windows side of the world, but I suppose that makes sense if this is a widespread issue with docks. I do worry about the performance hit.

Quoted 6 lines
Quoted 3 lines

If indeed this is a problem, could we ratelimit per branch device instead of globally? Even that would be better than serializing everything.

Since the problem was because some branch devices can't simultaneously handle two replies, I'm afraid that we might still encounter the same problem?

Hi Wayne,
Thanks for clarifying. I'm a bit hesitant to scrap this idea without solid evidence that this is a common problem. Do you have any hubs around AMD that you could try my patchset with? Perhaps we could get some hard data? I'm happy to test things on my end, but I probably shouldn't just start buying a bunch of random HP docks in hopes one of them exhibits the issue :)

To add anecdote to anecdote, everything on my desk seems to work with interleaved replies.

Since HDCP spec requires the host to verify each channel's encryption every <2s, we're going to be increasing the amount of sideband traffic a fair amount, so I would like to ensure we're doing everything possible to maximize our sideband bandwidth.

Sean

Quoted 145 lines

Thanks!

Quoted 119 lines

Sean

Quoted 19 lines

Thanks!

Quoted 17 lines

-----Original Message-----
From: Sean Paul <[email protected]>
Sent: Friday, February 14, 2020 5:15 AM
To: [email protected]
Cc: [email protected]; Lin, Wayne <[email protected]>; Sean Paul <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; David Airlie <[email protected]>
Subject: [PATCH 3/3] drm/dp_mst: Remove single tx msg restriction.

From: Sean Paul <[email protected]>

Now that we can support multiple simultaneous replies, remove the restrictions placed on sending new tx msgs.

This patch essentially just reverts commit
5a64967a2f3b ("drm/dp_mst: Have DP_Tx send one msg at a time")

now

Quoted 34 lines
Quoted 34 lines

that the problem is solved in a different way.

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 14 ++------------
 include/drm/drm_dp_mst_helper.h       |  6 ------
 2 files changed, 2 insertions(+), 18 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
index 7e6a82efdfc02..cbf0bb0ddeb84 100644
@@ -1203,8 +1203,6 @@ static int drm_dp_mst_wait_tx_reply(struct
 drm_dp_mst_branch *mstb,
                  txmsg->state == DRM_DP_SIDEBAND_TX_SENT) {
                      mstb->tx_slots[txmsg->seqno] = NULL;
              }
-             mgr->is_waiting_for_dwn_reply = false;
-
      }
 out:
      if (unlikely(ret == -EIO) && drm_debug_enabled(DRM_UT_DP)) {
@@
-1214,7 +1212,6 @@ static int drm_dp_mst_wait_tx_reply(struct
drm_dp_mst_branch *mstb,
      }
      mutex_unlock(&mgr->qlock);
-     drm_dp_mst_kick_tx(mgr);
      return ret;

}

Quoted 14 lines
Quoted 6 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -2797,11 +2794,9 @@ static void

process_single_down_tx_qlock(struct
drm_dp_mst_topology_mgr *mgr)

      ret = process_single_tx_qlock(mgr, txmsg, false);
      if (ret == 1) {
              /* txmsg is sent it should be in the slots now */

drivers/gpu/drm/drm_dp_mst_topology.c static void process_single_down_tx_qlock(struct drm_dp_mst_topology_mgr *mgr) · line 2802

Quoted 8 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
-             mgr->is_waiting_for_dwn_reply = true;
              list_del(&txmsg->next);
      } else if (ret) {
              DRM_DEBUG_KMS("failed to send msg in q %d\n", ret);
-             mgr->is_waiting_for_dwn_reply = false;
              list_del(&txmsg->next);
              if (txmsg->seqno != -1)
                      txmsg->dst->tx_slots[txmsg->seqno] = NULL;

@@

Quoted 25 lines
Quoted 25 lines

-2841,8
+2836,7 @@ static void drm_dp_queue_down_tx(struct drm_dp_mst_topology_mgr *mgr,

              drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
      }
drivers/gpu/drm/drm_dp_mst_topology.c +1 -3
-     if (list_is_singular(&mgr->tx_msg_downq) &&
-         !mgr->is_waiting_for_dwn_reply)
+     if (list_is_singular(&mgr->tx_msg_downq))
              process_single_down_tx_qlock(mgr);
      mutex_unlock(&mgr->qlock);
 }
@@ -3822,7 +3816,6 @@ static int drm_dp_mst_handle_down_rep(struct
 drm_dp_mst_topology_mgr *mgr)
      mutex_lock(&mgr->qlock);
      txmsg->state = DRM_DP_SIDEBAND_TX_RX;
      mstb->tx_slots[seqno] = NULL;
-     mgr->is_waiting_for_dwn_reply = false;
      mutex_unlock(&mgr->qlock);
 
      wake_up_all(&mgr->tx_waitq);
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -3830,9 +3823,6 @@ static int drm_dp_mst_handle_down_rep(struct
 drm_dp_mst_topology_mgr *mgr)
      return 0;
 
Quoted 6 lines

drivers/gpu/drm/drm_dp_mst_topology.c static int drm_dp_mst_handle_down_rep(struct drm_dp_mst_topology_mgr *mgr)

Quoted 6 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -3
 out_clear_reply:
-     mutex_lock(&mgr->qlock);
-     mgr->is_waiting_for_dwn_reply = false;
-     mutex_unlock(&mgr->qlock);
      if (msg)
              memset(msg, 0, sizeof(struct

drm_dp_sideband_msg_rx));

Quoted 6 lines
Quoted 6 lines

out:

drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -4670,7 +4660,7 @@ static void drm_dp_tx_work(struct work_struct
 *work)
      struct drm_dp_mst_topology_mgr *mgr = container_of(work,
 struct drm_dp_mst_topology_mgr, tx_work);
 
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
      mutex_lock(&mgr->qlock);
-     if (!list_empty(&mgr->tx_msg_downq)
 && !mgr->is_waiting_for_dwn_reply)
+     if (!list_empty(&mgr->tx_msg_downq))
              process_single_down_tx_qlock(mgr);
      mutex_unlock(&mgr->qlock);

}

(quoted diff) +0 -0

b/include/drm/drm_dp_mst_helper.h index

7d0341f94ce1b..fcc30e64c8e7e

Quoted 22 lines
Quoted 10 lines

include/drm/drm_dp_mst_helper.h struct drm_dp_mst_topology_mgr { · line 624

Quoted 10 lines

100644

include/drm/drm_dp_mst_helper.h +0 -3
@@ -619,12 +619,6 @@ struct drm_dp_mst_topology_mgr {
       * &drm_dp_sideband_msg_tx.state once they are queued
       */
      struct mutex qlock;
-
-     /**
-      * @is_waiting_for_dwn_reply: indicate whether is waiting for

down

Quoted 11 lines
Quoted 9 lines

reply

include/drm/drm_dp_mst_helper.h +0 -4
-      */
-     bool is_waiting_for_dwn_reply;
-
      /**
       * @tx_msg_downq: List of pending down replies.
       */
--

Sean Paul, Software Engineer, Google / Chromium OS

--
Wayne Lin

--
Best regards,
Wayne Lin

Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#8 lore raw

Re: [PATCH 3/3] drm/dp_mst: Remove single tx msg restriction.

Quoted 49 lines · Sean Paul
Quoted 48 lines · Wayne

[AMD Public Use]

Quoted 18 lines

-----Original Message-----
From: Sean Paul <[email protected]>
Sent: Saturday, February 15, 2020 12:09 AM
To: Lin, Wayne <[email protected]>
Cc: [email protected]; [email protected]; Sean Paul <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; David Airlie <[email protected]>
Subject: Re: [PATCH 3/3] drm/dp_mst: Remove single tx msg restriction.

Quoted 7 lines · Wayne

[AMD Public Use]

Hi Paul,

Thanks for the mail!

Quoted 9 lines
Quoted 1 line

I tried to solve this problem by having restriction on sending one msg at a

time due to hub/dock compatibility problems.

Quoted 2 lines

From my experience, some branch devices don't handle well on interleaved replies (Dock from HP I think)

Hi Wayne,
Hmm, that's interesting, do you have a part number of the failing dock so I can test it?

Hi Paul,

Sorry but it's been quite a while. I can't exactly tell the part number. If I remember correctly, when the specific branch device receives interleaved replies, it just doesn't reply to any requests.

Quoted 11 lines
Quoted 1 line

As the result of that, correct me if I'm wrong, I remember most gpu vendors

just send one down request at a time now in windows environment.

Quoted 1 line

I would suggest the original solution :)

I can't really say what happens on the Windows side of the world, but I suppose that makes sense if this is a widespread issue with docks. I do worry about the performance hit.

If indeed this is a problem, could we ratelimit per branch device instead of globally? Even that would be better than serializing everything.

Quoted 8 lines
Quoted 3 lines

Since the problem was because some branch devices can't simultaneously handle two replies, I'm afraid that we might still encounter the same problem?

Hi Wayne,
Thanks for clarifying. I'm a bit hesitant to scrap this idea without solid evidence that this is a common problem. Do you have any hubs around AMD that you could try my patchset with?

Oh, if you can test the set, you'll also need this patch as well :-)

drivers/gpu/drm/drm_dp_mst_topology.c +3 -1
@@ -3814,7 +3814,9 @@ static bool drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up,
        int basereg = up ? DP_SIDEBAND_MSG_UP_REQ_BASE :
                           DP_SIDEBAND_MSG_DOWN_REP_BASE;
 
-       *mstb = NULL;
+       if (mstb)
+               *mstb = NULL;
+
        *seqno = -1;
 
        len = min(mgr->max_dpcd_transaction_bytes, 16);
Quoted 162 lines

Perhaps we could get some hard data? I'm happy
to test things on my end, but I probably shouldn't just start buying a bunch of random HP docks in hopes one of them exhibits the issue :)

To add anecdote to anecdote, everything on my desk seems to work with interleaved replies.

Since HDCP spec requires the host to verify each channel's encryption every <2s, we're going to be increasing the amount of sideband traffic a fair amount, so I would like to ensure we're doing everything possible to maximize our sideband bandwidth.

Sean

Quoted 145 lines

Thanks!

Quoted 119 lines

Sean

Quoted 19 lines

Thanks!

Quoted 17 lines

-----Original Message-----
From: Sean Paul <[email protected]>
Sent: Friday, February 14, 2020 5:15 AM
To: [email protected]
Cc: [email protected]; Lin, Wayne <[email protected]>; Sean Paul <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; David Airlie <[email protected]>
Subject: [PATCH 3/3] drm/dp_mst: Remove single tx msg restriction.

From: Sean Paul <[email protected]>

Now that we can support multiple simultaneous replies, remove the restrictions placed on sending new tx msgs.

This patch essentially just reverts commit
5a64967a2f3b ("drm/dp_mst: Have DP_Tx send one msg at a time")

now

Quoted 34 lines
Quoted 34 lines

that the problem is solved in a different way.

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 14 ++------------
 include/drm/drm_dp_mst_helper.h       |  6 ------
 2 files changed, 2 insertions(+), 18 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
index 7e6a82efdfc02..cbf0bb0ddeb84 100644
@@ -1203,8 +1203,6 @@ static int drm_dp_mst_wait_tx_reply(struct
 drm_dp_mst_branch *mstb,
                  txmsg->state == DRM_DP_SIDEBAND_TX_SENT) {
                      mstb->tx_slots[txmsg->seqno] = NULL;
              }
-             mgr->is_waiting_for_dwn_reply = false;
-
      }
 out:
      if (unlikely(ret == -EIO) && drm_debug_enabled(DRM_UT_DP)) {
@@
-1214,7 +1212,6 @@ static int drm_dp_mst_wait_tx_reply(struct
drm_dp_mst_branch *mstb,
      }
      mutex_unlock(&mgr->qlock);
-     drm_dp_mst_kick_tx(mgr);
      return ret;

}

Quoted 14 lines
Quoted 6 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -2797,11 +2794,9 @@ static void

process_single_down_tx_qlock(struct
drm_dp_mst_topology_mgr *mgr)

      ret = process_single_tx_qlock(mgr, txmsg, false);
      if (ret == 1) {
              /* txmsg is sent it should be in the slots now */

drivers/gpu/drm/drm_dp_mst_topology.c

Quoted 8 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
-             mgr->is_waiting_for_dwn_reply = true;
              list_del(&txmsg->next);
      } else if (ret) {
              DRM_DEBUG_KMS("failed to send msg in q %d\n", ret);
-             mgr->is_waiting_for_dwn_reply = false;
              list_del(&txmsg->next);
              if (txmsg->seqno != -1)
                      txmsg->dst->tx_slots[txmsg->seqno] = NULL;

@@

Quoted 25 lines
Quoted 25 lines

-2841,8
+2836,7 @@ static void drm_dp_queue_down_tx(struct drm_dp_mst_topology_mgr *mgr,

              drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
      }
drivers/gpu/drm/drm_dp_mst_topology.c +1 -3
-     if (list_is_singular(&mgr->tx_msg_downq) &&
-         !mgr->is_waiting_for_dwn_reply)
+     if (list_is_singular(&mgr->tx_msg_downq))
              process_single_down_tx_qlock(mgr);
      mutex_unlock(&mgr->qlock);
 }
@@ -3822,7 +3816,6 @@ static int drm_dp_mst_handle_down_rep(struct
 drm_dp_mst_topology_mgr *mgr)
      mutex_lock(&mgr->qlock);
      txmsg->state = DRM_DP_SIDEBAND_TX_RX;
      mstb->tx_slots[seqno] = NULL;
-     mgr->is_waiting_for_dwn_reply = false;
      mutex_unlock(&mgr->qlock);
 
      wake_up_all(&mgr->tx_waitq);
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -3830,9 +3823,6 @@ static int drm_dp_mst_handle_down_rep(struct
 drm_dp_mst_topology_mgr *mgr)
      return 0;
 
Quoted 6 lines

drivers/gpu/drm/drm_dp_mst_topology.c static int drm_dp_mst_handle_down_rep(struct · line 3828

Quoted 6 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -3
 out_clear_reply:
-     mutex_lock(&mgr->qlock);
-     mgr->is_waiting_for_dwn_reply = false;
-     mutex_unlock(&mgr->qlock);
      if (msg)
              memset(msg, 0, sizeof(struct

drm_dp_sideband_msg_rx));

Quoted 6 lines
Quoted 6 lines

out:

drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -4670,7 +4660,7 @@ static void drm_dp_tx_work(struct work_struct
 *work)
      struct drm_dp_mst_topology_mgr *mgr = container_of(work,
 struct drm_dp_mst_topology_mgr, tx_work);
 
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
      mutex_lock(&mgr->qlock);
-     if (!list_empty(&mgr->tx_msg_downq)
 && !mgr->is_waiting_for_dwn_reply)
+     if (!list_empty(&mgr->tx_msg_downq))
              process_single_down_tx_qlock(mgr);
      mutex_unlock(&mgr->qlock);

}

(quoted diff) +0 -0

b/include/drm/drm_dp_mst_helper.h index

7d0341f94ce1b..fcc30e64c8e7e

Quoted 22 lines
Quoted 10 lines

include/drm/drm_dp_mst_helper.h struct drm_dp_mst_topology_mgr { · line 624

Quoted 10 lines

100644

include/drm/drm_dp_mst_helper.h +0 -3
@@ -619,12 +619,6 @@ struct drm_dp_mst_topology_mgr {
       * &drm_dp_sideband_msg_tx.state once they are queued
       */
      struct mutex qlock;
-
-     /**
-      * @is_waiting_for_dwn_reply: indicate whether is waiting for

down

Quoted 11 lines
Quoted 9 lines

reply

include/drm/drm_dp_mst_helper.h +0 -4
-      */
-     bool is_waiting_for_dwn_reply;
-
      /**
       * @tx_msg_downq: List of pending down replies.
       */
--

Sean Paul, Software Engineer, Google / Chromium OS

--
Wayne Lin

--
Best regards,
Wayne Lin

Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#9 lore raw

RE: [PATCH 3/3] drm/dp_mst: Remove single tx msg restriction.

[AMD Public Use]

Quoted 60 lines

-----Original Message-----
From: Sean Paul <[email protected]>
Sent: Wednesday, February 19, 2020 1:15 AM
To: Lin, Wayne <[email protected]>
Cc: Sean Paul <[email protected]>; [email protected]; [email protected]; Sean Paul <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; David Airlie <[email protected]>
Subject: Re: [PATCH 3/3] drm/dp_mst: Remove single tx msg restriction.

Quoted 16 lines · Sean Paul
Quoted 15 lines · Wayne

[AMD Public Use]

Quoted 11 lines

-----Original Message-----
From: Sean Paul <[email protected]>
Sent: Saturday, February 15, 2020 12:09 AM
To: Lin, Wayne <[email protected]>
Cc: [email protected]; [email protected]; Sean Paul <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; David Airlie <[email protected]>
Subject: Re: [PATCH 3/3] drm/dp_mst: Remove single tx msg restriction.

On Fri, Feb 14, 2020 at 12:58 AM Lin, Wayne <[email protected]>

Quoted 32 lines · wrote:
Quoted 32 lines
Quoted 9 lines
Quoted 9 lines

[AMD Public Use]

Hi Paul,

Thanks for the mail!

I tried to solve this problem by having restriction on sending one msg at a

Quoted 8 lines

time due to hub/dock compatibility problems.

Quoted 2 lines

From my experience, some branch devices don't handle well on interleaved replies (Dock from HP I think)

Hi Wayne,
Hmm, that's interesting, do you have a part number of the failing dock so I can test it?

Hi Paul,

Sorry but it's been quite a while. I can't exactly tell the part number. If I remember correctly, when the specific branch device receives interleaved replies, it just doesn't reply to any requests.

Quoted 9 lines
Quoted 2 lines

As the result of that, correct me if I'm wrong, I remember most gpu vendors

just send one down request at a time now in windows environment.

Quoted 1 line

I would suggest the original solution :)

I can't really say what happens on the Windows side of the world, but I suppose that makes sense if this is a widespread issue with docks. I do worry about the performance hit.

Quoted 12 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

If indeed this is a problem, could we ratelimit per branch device instead of globally? Even that would be better than serializing everything.

Since the problem was because some branch devices can't simultaneously handle two replies, I'm afraid that we might still encounter

the same problem?

Quoted 6 lines
Quoted 1 line

Hi Wayne,
Thanks for clarifying. I'm a bit hesitant to scrap this idea without solid evidence that this is a common problem. Do you have any hubs around AMD that you could try my patchset with?

Hi Paul,
Sure! I will see what I have at hand and try your patch set. It might take me some time but I will update this as soon as possible. :)

Thanks!

Quoted 186 lines

Oh, if you can test the set, you'll also need this patch as well :-)

drivers/gpu/drm/drm_dp_mst_topology.c +3 -1
@@ -3814,7 +3814,9 @@ static bool drm_dp_get_one_sb_msg(struct
 drm_dp_mst_topology_mgr *mgr, bool up,
        int basereg = up ? DP_SIDEBAND_MSG_UP_REQ_BASE :
                           DP_SIDEBAND_MSG_DOWN_REP_BASE;
 
-       *mstb = NULL;
+       if (mstb)
+               *mstb = NULL;
+
        *seqno = -1;
 
        len = min(mgr->max_dpcd_transaction_bytes, 16);
Quoted 47 lines

Perhaps we could get some hard data? I'm happy to test things on my end, but I probably shouldn't just start buying a bunch of random HP docks in hopes one of them exhibits the issue :)

To add anecdote to anecdote, everything on my desk seems to work with interleaved replies.

Since HDCP spec requires the host to verify each channel's encryption every <2s, we're going to be increasing the amount of sideband traffic a fair amount, so I would like to ensure we're doing everything possible to maximize our sideband bandwidth.

Sean

Quoted 33 lines

Thanks!

Quoted 32 lines

Sean

Quoted 20 lines

Thanks!

Quoted 18 lines

-----Original Message-----
From: Sean Paul <[email protected]>
Sent: Friday, February 14, 2020 5:15 AM
To: [email protected]
Cc: [email protected]; Lin, Wayne <[email protected]>; Sean Paul <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; David Airlie <[email protected]>
Subject: [PATCH 3/3] drm/dp_mst: Remove single tx msg restriction.

From: Sean Paul <[email protected]>

Now that we can support multiple simultaneous replies, remove the restrictions placed on sending new tx msgs.

This patch essentially just reverts commit
5a64967a2f3b ("drm/dp_mst: Have DP_Tx send one msg at a
time")

now

Quoted 9 lines
Quoted 9 lines

that the problem is solved in a different way.

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 14 ++------------
 include/drm/drm_dp_mst_helper.h       |  6 ------
 2 files changed, 2 insertions(+), 18 deletions(-)
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/drm_dp_mst_topology.c static int · line 1204

Quoted 8 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
index 7e6a82efdfc02..cbf0bb0ddeb84 100644
@@ -1203,8 +1203,6 @@ static int
 drm_dp_mst_wait_tx_reply(struct drm_dp_mst_branch *mstb,
                  txmsg->state ==

DRM_DP_SIDEBAND_TX_SENT) {

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
                      mstb->tx_slots[txmsg->seqno] = NULL;
              }
-             mgr->is_waiting_for_dwn_reply = false;
-
      }
 out:
      if (unlikely(ret == -EIO) &&
drm_debug_enabled(DRM_UT_DP)) { @@
-1214,7 +1212,6 @@ static int drm_dp_mst_wait_tx_reply(struct
drm_dp_mst_branch *mstb,
      }
      mutex_unlock(&mgr->qlock);
-     drm_dp_mst_kick_tx(mgr);
      return ret;

}

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -2797,11 +2794,9 @@ static void

process_single_down_tx_qlock(struct
drm_dp_mst_topology_mgr *mgr)

      ret = process_single_tx_qlock(mgr, txmsg, false);
      if (ret == 1) {
              /* txmsg is sent it should be in the slots now */
-             mgr->is_waiting_for_dwn_reply = true;
              list_del(&txmsg->next);
      } else if (ret) {
              DRM_DEBUG_KMS("failed to send msg in q %d\n",

ret);

Quoted 36 lines
Quoted 36 lines
Quoted 36 lines
Quoted 5 lines
Quoted 5 lines
-             mgr->is_waiting_for_dwn_reply = false;
              list_del(&txmsg->next);
              if (txmsg->seqno != -1)
                      txmsg->dst->tx_slots[txmsg->seqno] =

NULL;

@@

Quoted 30 lines
Quoted 30 lines

-2841,8
+2836,7 @@ static void drm_dp_queue_down_tx(struct drm_dp_mst_topology_mgr *mgr,

              drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
      }
drivers/gpu/drm/drm_dp_mst_topology.c +1 -2
-     if (list_is_singular(&mgr->tx_msg_downq) &&
-         !mgr->is_waiting_for_dwn_reply)
+     if (list_is_singular(&mgr->tx_msg_downq))
              process_single_down_tx_qlock(mgr);
      mutex_unlock(&mgr->qlock);  } @@ -3822,7 +3816,6 @@

static int drm_dp_mst_handle_down_rep(struct
drm_dp_mst_topology_mgr *mgr)

      mutex_lock(&mgr->qlock);
      txmsg->state = DRM_DP_SIDEBAND_TX_RX;
      mstb->tx_slots[seqno] = NULL;
-     mgr->is_waiting_for_dwn_reply = false;
      mutex_unlock(&mgr->qlock);

      wake_up_all(&mgr->tx_waitq); @@ -3830,9 +3823,6 @@
static int drm_dp_mst_handle_down_rep(struct
drm_dp_mst_topology_mgr *mgr)
      return 0;

out_clear_reply:

drivers/gpu/drm/drm_dp_mst_topology.c +0 -3
-     mutex_lock(&mgr->qlock);
-     mgr->is_waiting_for_dwn_reply = false;
-     mutex_unlock(&mgr->qlock);
      if (msg)
              memset(msg, 0, sizeof(struct
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drm_dp_sideband_msg_rx));

Quoted 5 lines
Quoted 5 lines

out:

drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -4670,7 +4660,7 @@ static void drm_dp_tx_work(struct

work_struct
*work)
struct drm_dp_mst_topology_mgr *mgr =

container_of(work,

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 10 lines

struct drm_dp_mst_topology_mgr, tx_work);

      mutex_lock(&mgr->qlock);
-     if (!list_empty(&mgr->tx_msg_downq)
&& !mgr->is_waiting_for_dwn_reply)
+     if (!list_empty(&mgr->tx_msg_downq))
              process_single_down_tx_qlock(mgr);
      mutex_unlock(&mgr->qlock);  } diff --git

a/include/drm/drm_dp_mst_helper.h
b/include/drm/drm_dp_mst_helper.h index

7d0341f94ce1b..fcc30e64c8e7e

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

include/drm/drm_dp_mst_helper.h struct drm_dp_mst_topology_mgr { · line 624

Quoted 10 lines

100644

include/drm/drm_dp_mst_helper.h +0 -3
@@ -619,12 +619,6 @@ struct drm_dp_mst_topology_mgr {
       * &drm_dp_sideband_msg_tx.state once they are queued
       */
      struct mutex qlock;
-
-     /**
-      * @is_waiting_for_dwn_reply: indicate whether is waiting

for

Quoted 16 lines
Quoted 15 lines
Quoted 12 lines

down

Quoted 11 lines
Quoted 9 lines

reply

include/drm/drm_dp_mst_helper.h +0 -4
-      */
-     bool is_waiting_for_dwn_reply;
-
      /**
       * @tx_msg_downq: List of pending down replies.
       */
--

Sean Paul, Software Engineer, Google / Chromium OS

--
Wayne Lin

--
Best regards,
Wayne Lin

Quoted 5 lines
Quoted 2 lines

--
Sean Paul, Software Engineer, Google / Chromium OS

--
Sean Paul, Software Engineer, Google / Chromium OS

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

author
#10 lore raw

Re: [PATCH 3/3] drm/dp_mst: Remove single tx msg restriction.

Quoted 73 lines · Wayne

[AMD Public Use]

Quoted 68 lines

-----Original Message-----
From: Sean Paul <[email protected]>
Sent: Wednesday, February 19, 2020 1:15 AM
To: Lin, Wayne <[email protected]>
Cc: Sean Paul <[email protected]>; [email protected]; [email protected]; Sean Paul <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; David Airlie <[email protected]>
Subject: Re: [PATCH 3/3] drm/dp_mst: Remove single tx msg restriction.

Quoted 16 lines · Sean Paul
Quoted 15 lines · Wayne

[AMD Public Use]

Quoted 11 lines

-----Original Message-----
From: Sean Paul <[email protected]>
Sent: Saturday, February 15, 2020 12:09 AM
To: Lin, Wayne <[email protected]>
Cc: [email protected]; [email protected]; Sean Paul <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; David Airlie <[email protected]>
Subject: Re: [PATCH 3/3] drm/dp_mst: Remove single tx msg restriction.

On Fri, Feb 14, 2020 at 12:58 AM Lin, Wayne <[email protected]>

Quoted 32 lines · wrote:
Quoted 32 lines
Quoted 9 lines
Quoted 9 lines

[AMD Public Use]

Hi Paul,

Thanks for the mail!

I tried to solve this problem by having restriction on sending one msg at a

Quoted 8 lines

time due to hub/dock compatibility problems.

Quoted 2 lines

From my experience, some branch devices don't handle well on interleaved replies (Dock from HP I think)

Hi Wayne,
Hmm, that's interesting, do you have a part number of the failing dock so I can test it?

Hi Paul,

Sorry but it's been quite a while. I can't exactly tell the part number. If I remember correctly, when the specific branch device receives interleaved replies, it just doesn't reply to any requests.

Quoted 9 lines
Quoted 2 lines

As the result of that, correct me if I'm wrong, I remember most gpu vendors

just send one down request at a time now in windows environment.

Quoted 1 line

I would suggest the original solution :)

I can't really say what happens on the Windows side of the world, but I suppose that makes sense if this is a widespread issue with docks. I do worry about the performance hit.

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

If indeed this is a problem, could we ratelimit per branch device instead of globally? Even that would be better than serializing everything.

Since the problem was because some branch devices can't simultaneously handle two replies, I'm afraid that we might still encounter

the same problem?

Quoted 2 lines
Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

Hi Wayne,
Thanks for clarifying. I'm a bit hesitant to scrap this idea without solid evidence that this is a common problem. Do you have any hubs around AMD that you could try my patchset with?

Hi Paul,
Sure! I will see what I have at hand and try your patch set. It might take me some time but I will update this as soon as possible. :)

Hi Wayne,
I'm seeing spurious timeouts even with your serialization patch on mainline. Have you had a chance to test this set? At least on my machines it seems to be working better.

Sean

Quoted 187 lines

Thanks!

Quoted 186 lines

Oh, if you can test the set, you'll also need this patch as well :-)

drivers/gpu/drm/drm_dp_mst_topology.c +3 -1
@@ -3814,7 +3814,9 @@ static bool drm_dp_get_one_sb_msg(struct
 drm_dp_mst_topology_mgr *mgr, bool up,
        int basereg = up ? DP_SIDEBAND_MSG_UP_REQ_BASE :
                           DP_SIDEBAND_MSG_DOWN_REP_BASE;
 
-       *mstb = NULL;
+       if (mstb)
+               *mstb = NULL;
+
        *seqno = -1;
 
        len = min(mgr->max_dpcd_transaction_bytes, 16);
Quoted 47 lines

Perhaps we could get some hard data? I'm happy to test things on my end, but I probably shouldn't just start buying a bunch of random HP docks in hopes one of them exhibits the issue :)

To add anecdote to anecdote, everything on my desk seems to work with interleaved replies.

Since HDCP spec requires the host to verify each channel's encryption every <2s, we're going to be increasing the amount of sideband traffic a fair amount, so I would like to ensure we're doing everything possible to maximize our sideband bandwidth.

Sean

Quoted 33 lines

Thanks!

Quoted 32 lines

Sean

Quoted 20 lines

Thanks!

Quoted 18 lines

-----Original Message-----
From: Sean Paul <[email protected]>
Sent: Friday, February 14, 2020 5:15 AM
To: [email protected]
Cc: [email protected]; Lin, Wayne <[email protected]>; Sean Paul <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; David Airlie <[email protected]>
Subject: [PATCH 3/3] drm/dp_mst: Remove single tx msg restriction.

From: Sean Paul <[email protected]>

Now that we can support multiple simultaneous replies, remove the restrictions placed on sending new tx msgs.

This patch essentially just reverts commit
5a64967a2f3b ("drm/dp_mst: Have DP_Tx send one msg at a
time")

now

Quoted 9 lines
Quoted 9 lines

that the problem is solved in a different way.

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 14 ++------------
 include/drm/drm_dp_mst_helper.h       |  6 ------
 2 files changed, 2 insertions(+), 18 deletions(-)
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/drm_dp_mst_topology.c static int · line 1204

Quoted 8 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
index 7e6a82efdfc02..cbf0bb0ddeb84 100644
@@ -1203,8 +1203,6 @@ static int
 drm_dp_mst_wait_tx_reply(struct drm_dp_mst_branch *mstb,
                  txmsg->state ==

DRM_DP_SIDEBAND_TX_SENT) {

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
                      mstb->tx_slots[txmsg->seqno] = NULL;
              }
-             mgr->is_waiting_for_dwn_reply = false;
-
      }
 out:
      if (unlikely(ret == -EIO) &&
drm_debug_enabled(DRM_UT_DP)) { @@
-1214,7 +1212,6 @@ static int drm_dp_mst_wait_tx_reply(struct
drm_dp_mst_branch *mstb,
      }
      mutex_unlock(&mgr->qlock);
-     drm_dp_mst_kick_tx(mgr);
      return ret;

}

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -2797,11 +2794,9 @@ static void

process_single_down_tx_qlock(struct
drm_dp_mst_topology_mgr *mgr)

      ret = process_single_tx_qlock(mgr, txmsg, false);
      if (ret == 1) {
              /* txmsg is sent it should be in the slots now */
-             mgr->is_waiting_for_dwn_reply = true;
              list_del(&txmsg->next);
      } else if (ret) {
              DRM_DEBUG_KMS("failed to send msg in q %d\n",

ret);

Quoted 36 lines
Quoted 36 lines
Quoted 36 lines
Quoted 5 lines
Quoted 5 lines
-             mgr->is_waiting_for_dwn_reply = false;
              list_del(&txmsg->next);
              if (txmsg->seqno != -1)
                      txmsg->dst->tx_slots[txmsg->seqno] =

NULL;

@@

Quoted 30 lines
Quoted 30 lines

-2841,8
+2836,7 @@ static void drm_dp_queue_down_tx(struct drm_dp_mst_topology_mgr *mgr,

              drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
      }
drivers/gpu/drm/drm_dp_mst_topology.c +1 -2
-     if (list_is_singular(&mgr->tx_msg_downq) &&
-         !mgr->is_waiting_for_dwn_reply)
+     if (list_is_singular(&mgr->tx_msg_downq))
              process_single_down_tx_qlock(mgr);
      mutex_unlock(&mgr->qlock);  } @@ -3822,7 +3816,6 @@

static int drm_dp_mst_handle_down_rep(struct
drm_dp_mst_topology_mgr *mgr)

      mutex_lock(&mgr->qlock);
      txmsg->state = DRM_DP_SIDEBAND_TX_RX;
      mstb->tx_slots[seqno] = NULL;
-     mgr->is_waiting_for_dwn_reply = false;
      mutex_unlock(&mgr->qlock);

      wake_up_all(&mgr->tx_waitq); @@ -3830,9 +3823,6 @@
static int drm_dp_mst_handle_down_rep(struct
drm_dp_mst_topology_mgr *mgr)
      return 0;

out_clear_reply:

drivers/gpu/drm/drm_dp_mst_topology.c +0 -3
-     mutex_lock(&mgr->qlock);
-     mgr->is_waiting_for_dwn_reply = false;
-     mutex_unlock(&mgr->qlock);
      if (msg)
              memset(msg, 0, sizeof(struct
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drm_dp_sideband_msg_rx));

Quoted 5 lines
Quoted 5 lines

out:

drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -4670,7 +4660,7 @@ static void drm_dp_tx_work(struct

work_struct
*work)
struct drm_dp_mst_topology_mgr *mgr =

container_of(work,

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 10 lines

struct drm_dp_mst_topology_mgr, tx_work);

      mutex_lock(&mgr->qlock);
-     if (!list_empty(&mgr->tx_msg_downq)
&& !mgr->is_waiting_for_dwn_reply)
+     if (!list_empty(&mgr->tx_msg_downq))
              process_single_down_tx_qlock(mgr);
      mutex_unlock(&mgr->qlock);  } diff --git

a/include/drm/drm_dp_mst_helper.h
b/include/drm/drm_dp_mst_helper.h index

7d0341f94ce1b..fcc30e64c8e7e

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

include/drm/drm_dp_mst_helper.h struct drm_dp_mst_topology_mgr { · line 624

Quoted 10 lines

100644

include/drm/drm_dp_mst_helper.h +0 -3
@@ -619,12 +619,6 @@ struct drm_dp_mst_topology_mgr {
       * &drm_dp_sideband_msg_tx.state once they are queued
       */
      struct mutex qlock;
-
-     /**
-      * @is_waiting_for_dwn_reply: indicate whether is waiting

for

Quoted 16 lines
Quoted 15 lines
Quoted 12 lines

down

Quoted 11 lines
Quoted 9 lines

reply

include/drm/drm_dp_mst_helper.h +0 -4
-      */
-     bool is_waiting_for_dwn_reply;
-
      /**
       * @tx_msg_downq: List of pending down replies.
       */
--

Sean Paul, Software Engineer, Google / Chromium OS

--
Wayne Lin

--
Best regards,
Wayne Lin

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

--
Sean Paul, Software Engineer, Google / Chromium OS

--
Sean Paul, Software Engineer, Google / Chromium OS

--
Wayne Lin

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

Reviewed-by Wayne Lin
#11 lore raw

RE: [PATCH 3/3] drm/dp_mst: Remove single tx msg restriction.

[AMD Public Use]

Quoted 92 lines

-----Original Message-----
From: Sean Paul <[email protected]>
Sent: Friday, March 6, 2020 1:19 AM
To: Lin, Wayne <[email protected]>
Cc: [email protected]; [email protected]; Sean Paul <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; David Airlie <[email protected]>
Subject: Re: [PATCH 3/3] drm/dp_mst: Remove single tx msg restriction.

Quoted 75 lines · Wayne

[AMD Public Use]

Quoted 70 lines

-----Original Message-----
From: Sean Paul <[email protected]>
Sent: Wednesday, February 19, 2020 1:15 AM
To: Lin, Wayne <[email protected]>
Cc: Sean Paul <[email protected]>; [email protected]; [email protected]; Sean Paul <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; David Airlie <[email protected]>
Subject: Re: [PATCH 3/3] drm/dp_mst: Remove single tx msg restriction.

Quoted 17 lines · Sean Paul
Quoted 16 lines · Wayne

[AMD Public Use]

Quoted 12 lines

-----Original Message-----
From: Sean Paul <[email protected]>
Sent: Saturday, February 15, 2020 12:09 AM
To: Lin, Wayne <[email protected]>
Cc: [email protected]; [email protected]; Sean Paul <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; David Airlie <[email protected]>
Subject: Re: [PATCH 3/3] drm/dp_mst: Remove single tx msg restriction.

On Fri, Feb 14, 2020 at 12:58 AM Lin, Wayne
<[email protected]>

Quoted 32 lines · wrote:
Quoted 32 lines
Quoted 9 lines
Quoted 9 lines

[AMD Public Use]

Hi Paul,

Thanks for the mail!

I tried to solve this problem by having restriction on sending one msg at a

Quoted 8 lines

time due to hub/dock compatibility problems.

Quoted 2 lines

From my experience, some branch devices don't handle well on interleaved replies (Dock from HP I think)

Hi Wayne,
Hmm, that's interesting, do you have a part number of the failing dock so I can test it?

Hi Paul,

Sorry but it's been quite a while. I can't exactly tell the part number. If I remember correctly, when the specific branch device receives interleaved replies, it just doesn't reply to any requests.

Quoted 9 lines
Quoted 2 lines

As the result of that, correct me if I'm wrong, I remember most gpu vendors

just send one down request at a time now in windows environment.

Quoted 1 line

I would suggest the original solution :)

I can't really say what happens on the Windows side of the world, but I suppose that makes sense if this is a widespread issue with docks. I do worry about the performance hit.

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

If indeed this is a problem, could we ratelimit per branch
device instead of globally? Even that would be better than serializing everything.

Since the problem was because some branch devices can't simultaneously handle two replies, I'm afraid that we might still encounter

the same problem?

Quoted 2 lines
Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

Hi Wayne,
Thanks for clarifying. I'm a bit hesitant to scrap this idea without solid evidence that this is a common problem. Do you have any hubs around AMD that you could try my patchset with?

Hi Paul,
Sure! I will see what I have at hand and try your patch set. It might take me some time but I will update this as soon as possible. :)

Quoted 5 lines

Hi Wayne,
I'm seeing spurious timeouts even with your serialization patch on mainline. Have you had a chance to test this set? At least on my machines it seems to be working better.

Sean

Hi Paul,

Sorry for late reply.
I was also concerning about the workload at the 1st branch device when all replies come back. But at least these patches work on hubs I have at hand now.

Whole series are reviewed.

Thanks for your time and help!

Quoted 188 lines
Quoted 188 lines

Thanks!

Quoted 187 lines

Oh, if you can test the set, you'll also need this patch as well :-)

drivers/gpu/drm/drm_dp_mst_topology.c +3 -1
@@ -3814,7 +3814,9 @@ static bool drm_dp_get_one_sb_msg(struct 
 drm_dp_mst_topology_mgr *mgr, bool up,
        int basereg = up ? DP_SIDEBAND_MSG_UP_REQ_BASE :
                           DP_SIDEBAND_MSG_DOWN_REP_BASE;
 
-       *mstb = NULL;
+       if (mstb)
+               *mstb = NULL;
+
        *seqno = -1;
 
        len = min(mgr->max_dpcd_transaction_bytes, 16);
Quoted 47 lines

Perhaps we could get some hard data? I'm happy to test things on my end, but I probably shouldn't just start buying a bunch of random HP docks in hopes one of them exhibits the issue :)

To add anecdote to anecdote, everything on my desk seems to work with interleaved replies.

Since HDCP spec requires the host to verify each channel's encryption every <2s, we're going to be increasing the amount of sideband traffic a fair amount, so I would like to ensure we're doing everything possible to maximize our sideband bandwidth.

Sean

Quoted 33 lines

Thanks!

Quoted 32 lines

Sean

Quoted 20 lines

Thanks!

Quoted 18 lines

-----Original Message-----
From: Sean Paul <[email protected]>
Sent: Friday, February 14, 2020 5:15 AM
To: [email protected]
Cc: [email protected]; Lin, Wayne <[email protected]>; Sean Paul <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; David Airlie <[email protected]>
Subject: [PATCH 3/3] drm/dp_mst: Remove single tx msg restriction.

From: Sean Paul <[email protected]>

Now that we can support multiple simultaneous replies, remove the restrictions placed on sending new tx msgs.

This patch essentially just reverts commit
5a64967a2f3b ("drm/dp_mst: Have DP_Tx send one msg at a
time")

now

Quoted 9 lines
Quoted 9 lines

that the problem is solved in a different way.

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 14 ++------------
 include/drm/drm_dp_mst_helper.h       |  6 ------
 2 files changed, 2 insertions(+), 18 deletions(-)
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/drm_dp_mst_topology.c static int · line 1204

Quoted 8 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
index 7e6a82efdfc02..cbf0bb0ddeb84 100644
@@ -1203,8 +1203,6 @@ static int 
 drm_dp_mst_wait_tx_reply(struct drm_dp_mst_branch *mstb,
                  txmsg->state ==

DRM_DP_SIDEBAND_TX_SENT) {

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
                      mstb->tx_slots[txmsg->seqno] = NULL;
              }
-             mgr->is_waiting_for_dwn_reply = false;
-
      }
 out:
      if (unlikely(ret == -EIO) &&
drm_debug_enabled(DRM_UT_DP)) { @@
-1214,7 +1212,6 @@ static int 
drm_dp_mst_wait_tx_reply(struct drm_dp_mst_branch *mstb,
      }
      mutex_unlock(&mgr->qlock);
-     drm_dp_mst_kick_tx(mgr);
      return ret;

}

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -2797,11 +2794,9 @@ static void 

process_single_down_tx_qlock(struct
drm_dp_mst_topology_mgr *mgr)

      ret = process_single_tx_qlock(mgr, txmsg, false);
      if (ret == 1) {
              /* txmsg is sent it should be in the slots now */
-             mgr->is_waiting_for_dwn_reply = true;
              list_del(&txmsg->next);
      } else if (ret) {
              DRM_DEBUG_KMS("failed to send msg in q 

%d\n",

ret);

Quoted 36 lines
Quoted 36 lines
Quoted 36 lines
Quoted 5 lines
Quoted 5 lines
-             mgr->is_waiting_for_dwn_reply = false;
              list_del(&txmsg->next);
              if (txmsg->seqno != -1)
                      txmsg->dst->tx_slots[txmsg->seqno] = 

NULL;

@@

Quoted 30 lines
Quoted 30 lines

-2841,8
+2836,7 @@ static void drm_dp_queue_down_tx(struct drm_dp_mst_topology_mgr *mgr,

              drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
      }
drivers/gpu/drm/drm_dp_mst_topology.c +1 -2
-     if (list_is_singular(&mgr->tx_msg_downq) &&
-         !mgr->is_waiting_for_dwn_reply)
+     if (list_is_singular(&mgr->tx_msg_downq))
              process_single_down_tx_qlock(mgr);
      mutex_unlock(&mgr->qlock);  } @@ -3822,7 +3816,6 @@ 

static int drm_dp_mst_handle_down_rep(struct
drm_dp_mst_topology_mgr *mgr)

      mutex_lock(&mgr->qlock);
      txmsg->state = DRM_DP_SIDEBAND_TX_RX;
      mstb->tx_slots[seqno] = NULL;
-     mgr->is_waiting_for_dwn_reply = false;
      mutex_unlock(&mgr->qlock);

      wake_up_all(&mgr->tx_waitq); @@ -3830,9 +3823,6 @@ 
static int drm_dp_mst_handle_down_rep(struct 
drm_dp_mst_topology_mgr *mgr)
      return 0;

out_clear_reply:

drivers/gpu/drm/drm_dp_mst_topology.c +0 -3
-     mutex_lock(&mgr->qlock);
-     mgr->is_waiting_for_dwn_reply = false;
-     mutex_unlock(&mgr->qlock);
      if (msg)
              memset(msg, 0, sizeof(struct
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drm_dp_sideband_msg_rx));

Quoted 5 lines
Quoted 5 lines

out:

drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -4670,7 +4660,7 @@ static void drm_dp_tx_work(struct 

work_struct
*work)
struct drm_dp_mst_topology_mgr *mgr =

container_of(work,

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 10 lines

struct drm_dp_mst_topology_mgr, tx_work);

      mutex_lock(&mgr->qlock);
-     if (!list_empty(&mgr->tx_msg_downq)
&& !mgr->is_waiting_for_dwn_reply)
+     if (!list_empty(&mgr->tx_msg_downq))
              process_single_down_tx_qlock(mgr);
      mutex_unlock(&mgr->qlock);  } diff --git 

a/include/drm/drm_dp_mst_helper.h
b/include/drm/drm_dp_mst_helper.h index

7d0341f94ce1b..fcc30e64c8e7e

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

include/drm/drm_dp_mst_helper.h struct drm_dp_mst_topology_mgr { · line 624

Quoted 10 lines

100644

include/drm/drm_dp_mst_helper.h +0 -3
@@ -619,12 +619,6 @@ struct drm_dp_mst_topology_mgr {
       * &drm_dp_sideband_msg_tx.state once they are queued
       */
      struct mutex qlock;
-
-     /**
-      * @is_waiting_for_dwn_reply: indicate whether is waiting

for

Quoted 16 lines
Quoted 15 lines
Quoted 12 lines

down

Quoted 11 lines
Quoted 9 lines

reply

include/drm/drm_dp_mst_helper.h +0 -4
-      */
-     bool is_waiting_for_dwn_reply;
-
      /**
       * @tx_msg_downq: List of pending down replies.
       */
--

Sean Paul, Software Engineer, Google / Chromium OS

--
Wayne Lin

--
Best regards,
Wayne Lin

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

--
Sean Paul, Software Engineer, Google / Chromium OS

--
Sean Paul, Software Engineer, Google / Chromium OS

--
Wayne Lin

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

Reviewed-by on the v1 series
#12 lore raw
In reply to Sean Paul
Quoted 10 lines · Sean Paul

From: Sean Paul <[email protected]>

Hey all,
Earlier this week on my 5.5 kernel (I can't seem to get a 5.6 kernel to behave on any of my devices), I ran into the multi-reply problem that Wayne fixed in January. Without realizing there was already a fix upstream, I went about solving it in different way. It wasn't until rebasing the patches on 5.6 for the list that I realized there was already a solution.

Quoted 4 lines

At any rate, I think this way of handling things might be a bit more performant. I'm not super happy with the cleanliness of the code, I think this series should make things easier to read, but I don't think I achieved that. So suggestions are welcome on how to break this apart.

Honestly it looks a bit cleaner to me. Sideband message parsing in MST is pretty complex, so I'd think the code's probably always going to be messy to some extent.

My only suggestion with cleaning things up - maybe we should stop calling it building a sideband reply, and call it re-assembling one? Seems a little less confusing, since we're really just taking the rx chunks and reassembling them into a full sideband message. I know at least I constantly find myself forgetting those functions are for rx and not tx.

So, I will give my r-b for the whole series, but...

...I think we should definitely look more into what Wayne's talking about before pushing this, and see if it's widespread enough of an issue to be a concern. It does kind of suck how slow MST probing can be, so I'd wonder if we could try your idea of rate limiting. My one concern there is I'm not actually sure if there's anything in the DP MST protocol that indicates how many messages a hub can handle at the same time - it's always supposed to just be two iirc.

Quoted 13 lines

Thanks,

Sean

Sean Paul (3):
drm/mst: Separate sideband packet header parsing from message building drm/mst: Support simultaneous down replies
drm/dp_mst: Remove single tx msg restriction.

 drivers/gpu/drm/drm_dp_mst_topology.c | 196 ++++++++++++++------------
 include/drm/drm_dp_mst_helper.h       |  65 ++++-----
 2 files changed, 137 insertions(+), 124 deletions(-)
Signature · 8 lines
Cheers,
	Lyude Paul (she/her)
	Associate Software Engineer at Red Hat

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#13 lore raw
Quoted 20 lines · Lyude Paul
Quoted 10 lines · Sean Paul

From: Sean Paul <[email protected]>

Hey all,
Earlier this week on my 5.5 kernel (I can't seem to get a 5.6 kernel to behave on any of my devices), I ran into the multi-reply problem that Wayne fixed in January. Without realizing there was already a fix upstream, I went about solving it in different way. It wasn't until rebasing the patches on 5.6 for the list that I realized there was already a solution.

Quoted 4 lines

At any rate, I think this way of handling things might be a bit more performant. I'm not super happy with the cleanliness of the code, I think this series should make things easier to read, but I don't think I achieved that. So suggestions are welcome on how to break this apart.

Honestly it looks a bit cleaner to me. Sideband message parsing in MST is pretty complex, so I'd think the code's probably always going to be messy to some extent.

Quoted 5 lines

My only suggestion with cleaning things up - maybe we should stop calling it building a sideband reply, and call it re-assembling one? Seems a little less confusing, since we're really just taking the rx chunks and reassembling them into a full sideband message. I know at least I constantly find myself forgetting those functions are for rx and not tx.

Good point, something like drm_dp_sideband_append_payload() might be more descriptive and less confusing. I'm happy to change this if we decide to go through with this set.

Quoted 5 lines

So, I will give my r-b for the whole series, but...

Quoted 7 lines

...I think we should definitely look more into what Wayne's talking about before pushing this, and see if it's widespread enough of an issue to be a concern. It does kind of suck how slow MST probing can be, so I'd wonder if we could try your idea of rate limiting. My one concern there is I'm not actually sure if there's anything in the DP MST protocol that indicates how many messages a hub can handle at the same time - it's always supposed to just be two iirc.

I don't see an upper bound on pending downstream replies either. AFAICT from reading the spec, each endpoint must support 2 concurrent message requests. A forwarding device is responsible for reading the replies when it detects DOWN_REP_MSG_RDY. So each forwarding device has the ability (and should) rate- limit their own forwards.

I guess some forwarding devices might only read one reply when they get the IRQ and not circle back for the rest? We could probably come up with a heuristic for handling this, but it'd be a bit nasty and is probably not worth it (I'd guess the vast majority of MST usecases are depth==1).

Sean

Quoted 19 lines
Quoted 14 lines

Thanks,

Sean

Sean Paul (3):
drm/mst: Separate sideband packet header parsing from message building drm/mst: Support simultaneous down replies
drm/dp_mst: Remove single tx msg restriction.

 drivers/gpu/drm/drm_dp_mst_topology.c | 196 ++++++++++++++------------
 include/drm/drm_dp_mst_helper.h       |  65 ++++-----
 2 files changed, 137 insertions(+), 124 deletions(-)
Signature · 3 lines
Cheers,
	Lyude Paul (she/her)
	Associate Software Engineer at Red Hat
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel