linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for-rc 0/2] Updates for 5.4 rc cycle
@ 2019-10-04 20:40 Dennis Dalessandro
  2019-10-04 20:40 ` [PATCH for-rc 1/2] IB/hfi1: Avoid excessive retry for TID RDMA READ request Dennis Dalessandro
  2019-10-04 20:49 ` [PATCH for-rc 2/2] IB/hfi1: Use a common pad buffer for 9B and 16B packets Dennis Dalessandro
  0 siblings, 2 replies; 6+ messages in thread
From: Dennis Dalessandro @ 2019-10-04 20:40 UTC (permalink / raw)
  To: jgg, dledford; +Cc: linux-rdma

Here are two pretty straight forward fixes. The first from Kaike fixes a TID
RDMA bug and the other is for an issue raised on the list by Dan Carpenter: 

https://marc.info/?l=linux-rdma&m=157001856105835&w=2


---

Kaike Wan (1):
      IB/hfi1: Avoid excessive retry for TID RDMA READ request

Mike Marciniszyn (1):
      IB/hfi1: Use a common pad buffer for 9B and 16B packets


 drivers/infiniband/hw/hfi1/sdma.c     |    5 +++--
 drivers/infiniband/hw/hfi1/tid_rdma.c |    5 -----
 drivers/infiniband/hw/hfi1/verbs.c    |   10 ++++------
 3 files changed, 7 insertions(+), 13 deletions(-)

--
-Denny

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH for-rc 1/2] IB/hfi1: Avoid excessive retry for TID RDMA READ request
  2019-10-04 20:40 [PATCH for-rc 0/2] Updates for 5.4 rc cycle Dennis Dalessandro
@ 2019-10-04 20:40 ` Dennis Dalessandro
  2019-10-17 20:34   ` Doug Ledford
  2019-10-04 20:49 ` [PATCH for-rc 2/2] IB/hfi1: Use a common pad buffer for 9B and 16B packets Dennis Dalessandro
  1 sibling, 1 reply; 6+ messages in thread
From: Dennis Dalessandro @ 2019-10-04 20:40 UTC (permalink / raw)
  To: jgg, dledford; +Cc: linux-rdma, Mike Marciniszyn, stable, Kaike Wan

From: Kaike Wan <kaike.wan@intel.com>

A TID RDMA READ request could be retried under one of the following
conditions:
- The RC retry timer expires;
- A later TID RDMA READ RESP packet is received before the next
  expected one.
For the latter, under normal conditions, the PSN in IB space is used
for comparison. More specifically, the IB PSN in the incoming TID RDMA
READ RESP packet is compared with the last IB PSN of a given TID RDMA
READ request to determine if the request should be retried. This is
similar to the retry logic for noraml RDMA READ request.

However, if a TID RDMA READ RESP packet is lost due to congestion,
header suppresion will be disabled and each incoming packet will raise
an interrupt until the hardware flow is reloaded. Under this condition,
each packet KDETH PSN will be checked by software against r_next_psn
and a retry will be requested if the packet KDETH PSN is later than
r_next_psn. Since each TID RDMA READ segment could have up to 64
packets and each TID RDMA READ request could have many segments, we
could make far more retries under such conditions, and thus leading to
RETRY_EXC_ERR status.

This patch fixes the issue by removing the retry when the incoming
packet KDETH PSN is later than r_next_psn. Instead, it resorts to
RC timer and normal IB PSN comparison for any request retry.

Fixes: 9905bf06e890 ("IB/hfi1: Add functions to receive TID RDMA READ response")
Cc: <stable@vger.kernel.org>
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Kaike Wan <kaike.wan@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
---
 drivers/infiniband/hw/hfi1/tid_rdma.c |    5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/tid_rdma.c b/drivers/infiniband/hw/hfi1/tid_rdma.c
index b4dcc4d..f21fca3 100644
--- a/drivers/infiniband/hw/hfi1/tid_rdma.c
+++ b/drivers/infiniband/hw/hfi1/tid_rdma.c
@@ -2736,11 +2736,6 @@ static bool handle_read_kdeth_eflags(struct hfi1_ctxtdata *rcd,
 				diff = cmp_psn(psn,
 					       flow->flow_state.r_next_psn);
 				if (diff > 0) {
-					if (!(qp->r_flags & RVT_R_RDMAR_SEQ))
-						restart_tid_rdma_read_req(rcd,
-									  qp,
-									  wqe);
-
 					/* Drop the packet.*/
 					goto s_unlock;
 				} else if (diff < 0) {


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH for-rc 2/2] IB/hfi1: Use a common pad buffer for 9B and 16B packets
  2019-10-04 20:40 [PATCH for-rc 0/2] Updates for 5.4 rc cycle Dennis Dalessandro
  2019-10-04 20:40 ` [PATCH for-rc 1/2] IB/hfi1: Avoid excessive retry for TID RDMA READ request Dennis Dalessandro
@ 2019-10-04 20:49 ` Dennis Dalessandro
  2019-10-04 20:51   ` Dennis Dalessandro
  2019-10-17 20:34   ` Doug Ledford
  1 sibling, 2 replies; 6+ messages in thread
From: Dennis Dalessandro @ 2019-10-04 20:49 UTC (permalink / raw)
  To: jgg, dledford; +Cc: linux-rdma, Mike Marciniszyn, Dan Carpenter, Kaike Wan

From: Mike Marciniszyn <mike.marciniszyn@intel.com>

There is no reason for a different pad buffer for the two
packet types.

Expand the current buffer allocation to allow for both
packet types.

Fixes: f8195f3b14a0 ("IB/hfi1: Eliminate allocation while atomic")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Kaike Wan <kaike.wan@intel.com>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
---
 drivers/infiniband/hw/hfi1/sdma.c  |    5 +++--
 drivers/infiniband/hw/hfi1/verbs.c |   10 ++++------
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/sdma.c b/drivers/infiniband/hw/hfi1/sdma.c
index 2ed7bfd..c61b6022 100644
--- a/drivers/infiniband/hw/hfi1/sdma.c
+++ b/drivers/infiniband/hw/hfi1/sdma.c
@@ -65,6 +65,7 @@
 #define SDMA_DESCQ_CNT 2048
 #define SDMA_DESC_INTR 64
 #define INVALID_TAIL 0xffff
+#define SDMA_PAD max_t(size_t, MAX_16B_PADDING, sizeof(u32))
 
 static uint sdma_descq_cnt = SDMA_DESCQ_CNT;
 module_param(sdma_descq_cnt, uint, S_IRUGO);
@@ -1296,7 +1297,7 @@ void sdma_clean(struct hfi1_devdata *dd, size_t num_engines)
 	struct sdma_engine *sde;
 
 	if (dd->sdma_pad_dma) {
-		dma_free_coherent(&dd->pcidev->dev, 4,
+		dma_free_coherent(&dd->pcidev->dev, SDMA_PAD,
 				  (void *)dd->sdma_pad_dma,
 				  dd->sdma_pad_phys);
 		dd->sdma_pad_dma = NULL;
@@ -1491,7 +1492,7 @@ int sdma_init(struct hfi1_devdata *dd, u8 port)
 	}
 
 	/* Allocate memory for pad */
-	dd->sdma_pad_dma = dma_alloc_coherent(&dd->pcidev->dev, sizeof(u32),
+	dd->sdma_pad_dma = dma_alloc_coherent(&dd->pcidev->dev, SDMA_PAD,
 					      &dd->sdma_pad_phys, GFP_KERNEL);
 	if (!dd->sdma_pad_dma) {
 		dd_dev_err(dd, "failed to allocate SendDMA pad memory\n");
diff --git a/drivers/infiniband/hw/hfi1/verbs.c b/drivers/infiniband/hw/hfi1/verbs.c
index 7bff0a1..089e201 100644
--- a/drivers/infiniband/hw/hfi1/verbs.c
+++ b/drivers/infiniband/hw/hfi1/verbs.c
@@ -147,9 +147,6 @@ static int pio_wait(struct rvt_qp *qp,
 /* Length of buffer to create verbs txreq cache name */
 #define TXREQ_NAME_LEN 24
 
-/* 16B trailing buffer */
-static const u8 trail_buf[MAX_16B_PADDING];
-
 static uint wss_threshold = 80;
 module_param(wss_threshold, uint, S_IRUGO);
 MODULE_PARM_DESC(wss_threshold, "Percentage (1-100) of LLC to use as a threshold for a cacheless copy");
@@ -820,8 +817,8 @@ static int build_verbs_tx_desc(
 
 	/* add icrc, lt byte, and padding to flit */
 	if (extra_bytes)
-		ret = sdma_txadd_kvaddr(sde->dd, &tx->txreq,
-					(void *)trail_buf, extra_bytes);
+		ret = sdma_txadd_daddr(sde->dd, &tx->txreq,
+				       sde->dd->sdma_pad_phys, extra_bytes);
 
 bail_txadd:
 	return ret;
@@ -1089,7 +1086,8 @@ int hfi1_verbs_send_pio(struct rvt_qp *qp, struct hfi1_pkt_state *ps,
 		}
 		/* add icrc, lt byte, and padding to flit */
 		if (extra_bytes)
-			seg_pio_copy_mid(pbuf, trail_buf, extra_bytes);
+			seg_pio_copy_mid(pbuf, ppd->dd->sdma_pad_dma,
+					 extra_bytes);
 
 		seg_pio_copy_end(pbuf);
 	}


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH for-rc 2/2] IB/hfi1: Use a common pad buffer for 9B and 16B packets
  2019-10-04 20:49 ` [PATCH for-rc 2/2] IB/hfi1: Use a common pad buffer for 9B and 16B packets Dennis Dalessandro
@ 2019-10-04 20:51   ` Dennis Dalessandro
  2019-10-17 20:34   ` Doug Ledford
  1 sibling, 0 replies; 6+ messages in thread
From: Dennis Dalessandro @ 2019-10-04 20:51 UTC (permalink / raw)
  To: jgg, dledford; +Cc: linux-rdma, Mike Marciniszyn, Dan Carpenter, Kaike Wan

On 10/4/2019 4:49 PM, Dennis Dalessandro wrote:
> From: Mike Marciniszyn <mike.marciniszyn@intel.com>
> 
> There is no reason for a different pad buffer for the two
> packet types.
> 
> Expand the current buffer allocation to allow for both
> packet types.
> 
> Fixes: f8195f3b14a0 ("IB/hfi1: Eliminate allocation while atomic")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Reviewed-by: Kaike Wan <kaike.wan@intel.com>
> Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
> Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>

Should also have had:

Cc: <stable@vger.kernel.org> # 4.14+

-Denny

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH for-rc 1/2] IB/hfi1: Avoid excessive retry for TID RDMA READ request
  2019-10-04 20:40 ` [PATCH for-rc 1/2] IB/hfi1: Avoid excessive retry for TID RDMA READ request Dennis Dalessandro
@ 2019-10-17 20:34   ` Doug Ledford
  0 siblings, 0 replies; 6+ messages in thread
From: Doug Ledford @ 2019-10-17 20:34 UTC (permalink / raw)
  To: Dennis Dalessandro, jgg; +Cc: linux-rdma, Mike Marciniszyn, stable, Kaike Wan

[-- Attachment #1: Type: text/plain, Size: 1955 bytes --]

On Fri, 2019-10-04 at 16:40 -0400, Dennis Dalessandro wrote:
> From: Kaike Wan <kaike.wan@intel.com>
> 
> A TID RDMA READ request could be retried under one of the following
> conditions:
> - The RC retry timer expires;
> - A later TID RDMA READ RESP packet is received before the next
>   expected one.
> For the latter, under normal conditions, the PSN in IB space is used
> for comparison. More specifically, the IB PSN in the incoming TID RDMA
> READ RESP packet is compared with the last IB PSN of a given TID RDMA
> READ request to determine if the request should be retried. This is
> similar to the retry logic for noraml RDMA READ request.
> 
> However, if a TID RDMA READ RESP packet is lost due to congestion,
> header suppresion will be disabled and each incoming packet will raise
> an interrupt until the hardware flow is reloaded. Under this
> condition,
> each packet KDETH PSN will be checked by software against r_next_psn
> and a retry will be requested if the packet KDETH PSN is later than
> r_next_psn. Since each TID RDMA READ segment could have up to 64
> packets and each TID RDMA READ request could have many segments, we
> could make far more retries under such conditions, and thus leading to
> RETRY_EXC_ERR status.
> 
> This patch fixes the issue by removing the retry when the incoming
> packet KDETH PSN is later than r_next_psn. Instead, it resorts to
> RC timer and normal IB PSN comparison for any request retry.
> 
> Fixes: 9905bf06e890 ("IB/hfi1: Add functions to receive TID RDMA READ
> response")
> Cc: <stable@vger.kernel.org>
> Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
> Signed-off-by: Kaike Wan <kaike.wan@intel.com>
> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>

Thanks, applied to for-rc.

-- 
Doug Ledford <dledford@redhat.com>
    GPG KeyID: B826A3330E572FDD
    Fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH for-rc 2/2] IB/hfi1: Use a common pad buffer for 9B and 16B packets
  2019-10-04 20:49 ` [PATCH for-rc 2/2] IB/hfi1: Use a common pad buffer for 9B and 16B packets Dennis Dalessandro
  2019-10-04 20:51   ` Dennis Dalessandro
@ 2019-10-17 20:34   ` Doug Ledford
  1 sibling, 0 replies; 6+ messages in thread
From: Doug Ledford @ 2019-10-17 20:34 UTC (permalink / raw)
  To: Dennis Dalessandro, jgg
  Cc: linux-rdma, Mike Marciniszyn, Dan Carpenter, Kaike Wan

[-- Attachment #1: Type: text/plain, Size: 831 bytes --]

On Fri, 2019-10-04 at 16:49 -0400, Dennis Dalessandro wrote:
> From: Mike Marciniszyn <mike.marciniszyn@intel.com>
> 
> There is no reason for a different pad buffer for the two
> packet types.
> 
> Expand the current buffer allocation to allow for both
> packet types.
> 
> Fixes: f8195f3b14a0 ("IB/hfi1: Eliminate allocation while atomic")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Reviewed-by: Kaike Wan <kaike.wan@intel.com>
> Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
> Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>

Thanks, applied to for-rc.

-- 
Doug Ledford <dledford@redhat.com>
    GPG KeyID: B826A3330E572FDD
    Fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-10-17 20:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-04 20:40 [PATCH for-rc 0/2] Updates for 5.4 rc cycle Dennis Dalessandro
2019-10-04 20:40 ` [PATCH for-rc 1/2] IB/hfi1: Avoid excessive retry for TID RDMA READ request Dennis Dalessandro
2019-10-17 20:34   ` Doug Ledford
2019-10-04 20:49 ` [PATCH for-rc 2/2] IB/hfi1: Use a common pad buffer for 9B and 16B packets Dennis Dalessandro
2019-10-04 20:51   ` Dennis Dalessandro
2019-10-17 20:34   ` Doug Ledford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).