Skip to contentSkip to conversation

RDMA/rxe: Ratelimit error messages of read_reply()

PATCH In review Daisuke Matsuda 7 participants 13 messages Aug 25, 2022 – Aug 30, 2022

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

PATCH 1/1 RDMA/rxe: Ratelimit error messages of read_reply()

When responder cannot copy data from a user MR, error messages overflow. This is because an incoming RDMA Read request can results in multiple Read responses. If the target MR is somehow unavailable, then the error message is generated for every Read response.

For the same reason, the error message for packet transmission should also be ratelimited.

---
 drivers/infiniband/sw/rxe/rxe_resp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/sw/rxe/rxe_resp.c +2 -2
index b36ec5c4d5e0..f9e9679b5e32 100644
@@ -812,7 +812,7 @@ static enum resp_states read_reply(struct rxe_qp *qp,
 	err = rxe_mr_copy(mr, res->read.va, payload_addr(&ack_pkt),
 			  payload, RXE_FROM_MR_OBJ);
 	if (err)
-		pr_err("Failed copying memory\n");
+		pr_err_ratelimited("Failed copying memory\n");
 	if (mr)
 		rxe_put(mr);
 
@@ -824,7 +824,7 @@ static enum resp_states read_reply(struct rxe_qp *qp,
 
 	err = rxe_xmit_packet(qp, &ack_pkt, skb);
 	if (err) {
-		pr_err("Failed sending RDMA reply.\n");
+		pr_err_ratelimited("Failed sending RDMA reply.\n");
 		return RESPST_ERR_RNR;
 	}
 
Signature · 1 line
2.31.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 27 lines · Daisuke Matsuda

When responder cannot copy data from a user MR, error messages overflow. This is because an incoming RDMA Read request can results in multiple Read responses. If the target MR is somehow unavailable, then the error message is generated for every Read response.

For the same reason, the error message for packet transmission should also be ratelimited.

---
 drivers/infiniband/sw/rxe/rxe_resp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/sw/rxe/rxe_resp.c +1 -1
index b36ec5c4d5e0..f9e9679b5e32 100644
@@ -812,7 +812,7 @@ static enum resp_states read_reply(struct rxe_qp *qp,
 	err = rxe_mr_copy(mr, res->read.va, payload_addr(&ack_pkt),
 			  payload, RXE_FROM_MR_OBJ);
 	if (err)
-		pr_err("Failed copying memory\n");
+		pr_err_ratelimited("Failed copying memory\n");
 	if (mr)
 		rxe_put(mr);
 

drivers/infiniband/sw/rxe/rxe_resp.c static enum resp_states read_reply(struct rxe_qp *qp, · line 830

Quoted 8 lines
drivers/infiniband/sw/rxe/rxe_resp.c +1 -1
@@ -824,7 +824,7 @@ static enum resp_states read_reply(struct rxe_qp *qp,
 
 	err = rxe_xmit_packet(qp, &ack_pkt, skb);
 	if (err) {
-		pr_err("Failed sending RDMA reply.\n");
+		pr_err_ratelimited("Failed sending RDMA reply.\n");
 		return RESPST_ERR_RNR;
 	}
 
maintainer
#2 lore raw
In reply to Daisuke Matsuda
Quoted 5 lines · Daisuke Matsuda

When responder cannot copy data from a user MR, error messages overflow. This is because an incoming RDMA Read request can results in multiple Read responses. If the target MR is somehow unavailable, then the error message is generated for every Read response.

Quoted 7 lines

For the same reason, the error message for packet transmission should also be ratelimited.

---
 drivers/infiniband/sw/rxe/rxe_resp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

These lines should be deleted, network packts should never trigger printing.

Jason

#3 lore raw
Quoted 15 lines · Jason Gunthorpe
Quoted 2 lines · Daisuke Matsuda

When responder cannot copy data from a user MR, error messages overflow. This is because an incoming RDMA Read request can results in multiple

Read

Quoted 10 lines

responses. If the target MR is somehow unavailable, then the error message is generated for every Read response.

For the same reason, the error message for packet transmission should also be ratelimited.

---
 drivers/infiniband/sw/rxe/rxe_resp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 4 lines

These lines should be deleted, network packts should never trigger printing.

Jason

Okay. I will post another patch to do that.

I wonder if we should also delete some messages in rxe_rcv() and its callees. It seems some of them can be triggered by packets from an arbitrary client even when there is no established connection between the requesting and responding nodes.
As far as I know, the message below can cause a message overflow.
=====
static int hdr_check(struct rxe_pkt_info *pkt)
{
~~~~~

        if (qpn != IB_MULTICAST_QPN) {
                index = (qpn == 1) ? port->qp_gsi_index : qpn;

                qp = rxe_pool_get_index(&rxe->qp_pool, index);
                if (unlikely(!qp)) {
                        pr_warn_ratelimited("no qp matches qpn 0x%x\n", qpn);
                        goto err1;
                }

=====

Daisuke Matsuda

#4 lore raw

PATCH 1/1 RDMA/rxe: Delete error messages triggered by incoming Read requests

In reply to Jason Gunthorpe

An incoming Read request causes multiple Read responses. If a user MR to copy data from is unavailable or responder cannot send a reply, then the error messages can be printed for each response attempt, resulting in message overflow.

---
 drivers/infiniband/sw/rxe/rxe_resp.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/infiniband/sw/rxe/rxe_resp.c +1 -5
index b36ec5c4d5e0..4b3e8aec2fb8 100644
@@ -811,8 +811,6 @@ static enum resp_states read_reply(struct rxe_qp *qp,
 
 	err = rxe_mr_copy(mr, res->read.va, payload_addr(&ack_pkt),
 			  payload, RXE_FROM_MR_OBJ);
-	if (err)
-		pr_err("Failed copying memory\n");
 	if (mr)
 		rxe_put(mr);
 
@@ -823,10 +821,8 @@ static enum resp_states read_reply(struct rxe_qp *qp,
 	}
 
 	err = rxe_xmit_packet(qp, &ack_pkt, skb);
-	if (err) {
-		pr_err("Failed sending RDMA reply.\n");
+	if (err)
 		return RESPST_ERR_RNR;
-	}
 
 	res->read.va += payload;
 	res->read.resid -= payload;
Signature · 1 line
2.31.1
#5 lore raw

Re: [PATCH] RDMA/rxe: Delete error messages triggered by incoming Read requests

Quoted 15 lines · Daisuke Matsuda

An incoming Read request causes multiple Read responses. If a user MR to copy data from is unavailable or responder cannot send a reply, then the error messages can be printed for each response attempt, resulting in message overflow.

---
 drivers/infiniband/sw/rxe/rxe_resp.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/infiniband/sw/rxe/rxe_resp.c +0 -0
index b36ec5c4d5e0..4b3e8aec2fb8 100644

drivers/infiniband/sw/rxe/rxe_resp.c static enum resp_states read_reply(struct rxe_qp *qp, · line 815

Quoted 5 lines
drivers/infiniband/sw/rxe/rxe_resp.c +0 -2
@@ -811,8 +811,6 @@ static enum resp_states read_reply(struct rxe_qp *qp,
 
 	err = rxe_mr_copy(mr, res->read.va, payload_addr(&ack_pkt),
 			  payload, RXE_FROM_MR_OBJ);
-	if (err)
-		pr_err("Failed copying memory\n");

The err is set but not used. Below is better:

- err = rxe_mr_copy(mr, res->read.va, payload_addr(&ack_pkt),
- payload, RXE_FROM_MR_OBJ);
+ rxe_mr_copy(mr, res->read.va, payload_addr(&ack_pkt),
+ payload, RXE_FROM_MR_OBJ);

Thanks,
Cheng Xu

Quoted 15 lines
drivers/infiniband/sw/rxe/rxe_resp.c +1 -3
 	if (mr)
 		rxe_put(mr);
 
@@ -823,10 +821,8 @@ static enum resp_states read_reply(struct rxe_qp *qp,
 	}
 
 	err = rxe_xmit_packet(qp, &ack_pkt, skb);
-	if (err) {
-		pr_err("Failed sending RDMA reply.\n");
+	if (err)
 		return RESPST_ERR_RNR;
-	}
 
 	res->read.va += payload;
 	res->read.resid -= payload;
maintainer
#6 lore raw

Re: [PATCH] RDMA/rxe: Delete error messages triggered by incoming Read requests

In reply to Daisuke Matsuda
Quoted 16 lines · Daisuke Matsuda

An incoming Read request causes multiple Read responses. If a user MR to copy data from is unavailable or responder cannot send a reply, then the error messages can be printed for each response attempt, resulting in message overflow.

---
 drivers/infiniband/sw/rxe/rxe_resp.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/infiniband/sw/rxe/rxe_resp.c +0 -0
index b36ec5c4d5e0..4b3e8aec2fb8 100644

drivers/infiniband/sw/rxe/rxe_resp.c static enum resp_states read_reply(struct rxe_qp *qp, · line 815

Quoted 5 lines
drivers/infiniband/sw/rxe/rxe_resp.c +0 -2
@@ -811,8 +811,6 @@ static enum resp_states read_reply(struct rxe_qp *qp,
 
        err = rxe_mr_copy(mr, res->read.va, payload_addr(&ack_pkt),
                          payload, RXE_FROM_MR_OBJ);
-       if (err)
-               pr_err("Failed copying memory\n");

pr_err_once is better?

drivers/infiniband/sw/rxe/rxe_resp.c static enum resp_states read_reply(struct rxe_qp *qp, · line 827

Quoted 9 lines
drivers/infiniband/sw/rxe/rxe_resp.c +0 -2
        if (mr)
                rxe_put(mr);
 
@@ -823,10 +821,8 @@ static enum resp_states read_reply(struct rxe_qp *qp,
        }
 
        err = rxe_xmit_packet(qp, &ack_pkt, skb);
-       if (err) {
-               pr_err("Failed sending RDMA reply.\n");

The same with the above

Zhu Yanjun

Quoted 9 lines
drivers/infiniband/sw/rxe/rxe_resp.c +1 -2
+       if (err)
                return RESPST_ERR_RNR;
-       }
 
        res->read.va += payload;
        res->read.resid -= payload;
--

2.31.1

#7 lore raw

Re: [PATCH] RDMA/rxe: Delete error messages triggered by incoming Read requests

Quoted 19 lines · Zhu Yanjun
Quoted 17 lines · Daisuke Matsuda

An incoming Read request causes multiple Read responses. If a user MR to copy data from is unavailable or responder cannot send a reply, then the error messages can be printed for each response attempt, resulting in message overflow.

---
 drivers/infiniband/sw/rxe/rxe_resp.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/infiniband/sw/rxe/rxe_resp.c +0 -0
index b36ec5c4d5e0..4b3e8aec2fb8 100644
@@ -811,8 +811,6 @@ static enum resp_states read_reply(struct rxe_qp *qp,
 
Quoted 6 lines

drivers/infiniband/sw/rxe/rxe_resp.c static enum resp_states read_reply(struct rxe_qp *qp, · line 815

Quoted 4 lines
drivers/infiniband/sw/rxe/rxe_resp.c +0 -2
        err = rxe_mr_copy(mr, res->read.va, payload_addr(&ack_pkt),
                          payload, RXE_FROM_MR_OBJ);
-       if (err)
-               pr_err("Failed copying memory\n");

pr_err_once is better?

Like Jason said, there shouldn't any prints in network triggered flows.

Thanks

maintainer
#8 lore raw

Re: [PATCH] RDMA/rxe: Delete error messages triggered by incoming Read requests

Quoted 21 lines · Leon Romanovsky
Quoted 19 lines · Zhu Yanjun
Quoted 17 lines · Daisuke Matsuda

An incoming Read request causes multiple Read responses. If a user MR to copy data from is unavailable or responder cannot send a reply, then the error messages can be printed for each response attempt, resulting in message overflow.

---
 drivers/infiniband/sw/rxe/rxe_resp.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/infiniband/sw/rxe/rxe_resp.c +0 -0
index b36ec5c4d5e0..4b3e8aec2fb8 100644
@@ -811,8 +811,6 @@ static enum resp_states read_reply(struct rxe_qp *qp,
 
Quoted 9 lines
Quoted 6 lines

drivers/infiniband/sw/rxe/rxe_resp.c static enum resp_states read_reply(struct rxe_qp *qp, · line 815

Quoted 4 lines
drivers/infiniband/sw/rxe/rxe_resp.c +0 -2
        err = rxe_mr_copy(mr, res->read.va, payload_addr(&ack_pkt),
                          payload, RXE_FROM_MR_OBJ);
-       if (err)
-               pr_err("Failed copying memory\n");

pr_err_once is better?

Like Jason said, there shouldn't any prints in network triggered flows.

Ok, thanks.

Zhu Yanjun

Quoted 1 line

Thanks

#9 lore raw

Re: [PATCH] RDMA/rxe: Delete error messages triggered by incoming Read requests

In reply to Daisuke Matsuda
Quoted 15 lines · Daisuke Matsuda

An incoming Read request causes multiple Read responses. If a user MR to copy data from is unavailable or responder cannot send a reply, then the error messages can be printed for each response attempt, resulting in message overflow.

---
  drivers/infiniband/sw/rxe/rxe_resp.c | 6 +-----
  1 file changed, 1 insertion(+), 5 deletions(-)
drivers/infiniband/sw/rxe/rxe_resp.c +0 -0
index b36ec5c4d5e0..4b3e8aec2fb8 100644

drivers/infiniband/sw/rxe/rxe_resp.c static enum resp_states read_reply(struct rxe_qp *qp, · line 815

Quoted 5 lines
drivers/infiniband/sw/rxe/rxe_resp.c +0 -2
@@ -811,8 +811,6 @@ static enum resp_states read_reply(struct rxe_qp *qp,
 
  	err = rxe_mr_copy(mr, res->read.va, payload_addr(&ack_pkt),
  			  payload, RXE_FROM_MR_OBJ);
-	if (err)
-		pr_err("Failed copying memory\n");

Not relate to this patch.
I'm wondering why this err is ignored, rxe_mr_copy() does the real execution or rxe_mr_copy() would never fail ? IMO, when err happens, responder shall notify the request anyhow.

Thanks
Zhijian

Quoted 15 lines
drivers/infiniband/sw/rxe/rxe_resp.c +1 -3
  	if (mr)
  		rxe_put(mr);
 
@@ -823,10 +821,8 @@ static enum resp_states read_reply(struct rxe_qp *qp,
  	}
 
  	err = rxe_xmit_packet(qp, &ack_pkt, skb);
-	if (err) {
-		pr_err("Failed sending RDMA reply.\n");
+	if (err)
  		return RESPST_ERR_RNR;
-	}
 
  	res->read.va += payload;
  	res->read.resid -= payload;
#10 lore raw

RE: [PATCH] RDMA/rxe: Delete error messages triggered by incoming Read requests

Quoted 17 lines · Li Zhijian
Quoted 16 lines · Daisuke Matsuda

An incoming Read request causes multiple Read responses. If a user MR to copy data from is unavailable or responder cannot send a reply, then the error messages can be printed for each response attempt, resulting in message overflow.

---
  drivers/infiniband/sw/rxe/rxe_resp.c | 6 +-----
  1 file changed, 1 insertion(+), 5 deletions(-)
drivers/infiniband/sw/rxe/rxe_resp.c +0 -0
index b36ec5c4d5e0..4b3e8aec2fb8 100644
@@ -811,8 +811,6 @@ static enum resp_states read_reply(struct rxe_qp *qp,
 
Quoted 7 lines

drivers/infiniband/sw/rxe/rxe_resp.c static enum resp_states read_reply(struct rxe_qp *qp, · line 815

Quoted 4 lines
drivers/infiniband/sw/rxe/rxe_resp.c +0 -2
  	err = rxe_mr_copy(mr, res->read.va, payload_addr(&ack_pkt),
  			  payload, RXE_FROM_MR_OBJ);
-	if (err)
-		pr_err("Failed copying memory\n");

Not relate to this patch.
I'm wondering why this err is ignored, rxe_mr_copy() does the real execution or rxe_mr_copy() would never fail ? IMO, when err happens, responder shall notify the request anyhow.

Practically, I have never seen rxe_mr_copy() failed before, but I agree the implementation may be incorrect as you mentioned.

As far as I tested, responder replied with the requested amount of payloads even when rxe_mr_copy() is modified to fail. In this case, requester may mistakenly believe that they get data correctly.

For more details, see IB Specification Vol 1-Revision-1.5 Ch.9.7.5.1.3 (page.334).

Daisuke Matsuda

Quoted 19 lines

Thanks
Zhijian

Quoted 15 lines
drivers/infiniband/sw/rxe/rxe_resp.c +1 -3
  	if (mr)
  		rxe_put(mr);
 
@@ -823,10 +821,8 @@ static enum resp_states read_reply(struct rxe_qp *qp,
  	}
 
  	err = rxe_xmit_packet(qp, &ack_pkt, skb);
-	if (err) {
-		pr_err("Failed sending RDMA reply.\n");
+	if (err)
  		return RESPST_ERR_RNR;
-	}
 
  	res->read.va += payload;
  	res->read.resid -= payload;
#11 lore raw

Re: [PATCH] RDMA/rxe: Delete error messages triggered by incoming Read requests

Quoted 25 lines · Daisuke/松田 大輔
Quoted 17 lines · Li Zhijian
Quoted 16 lines · Daisuke Matsuda

An incoming Read request causes multiple Read responses. If a user MR to copy data from is unavailable or responder cannot send a reply, then the error messages can be printed for each response attempt, resulting in message overflow.

---
   drivers/infiniband/sw/rxe/rxe_resp.c | 6 +-----
   1 file changed, 1 insertion(+), 5 deletions(-)
drivers/infiniband/sw/rxe/rxe_resp.c +0 -0
index b36ec5c4d5e0..4b3e8aec2fb8 100644
@@ -811,8 +811,6 @@ static enum resp_states read_reply(struct rxe_qp *qp,
 
Quoted 7 lines

drivers/infiniband/sw/rxe/rxe_resp.c static enum resp_states read_reply(struct rxe_qp *qp, · line 815

Quoted 4 lines
drivers/infiniband/sw/rxe/rxe_resp.c +0 -2
   	err = rxe_mr_copy(mr, res->read.va, payload_addr(&ack_pkt),
   			  payload, RXE_FROM_MR_OBJ);
-	if (err)
-		pr_err("Failed copying memory\n");

Not relate to this patch.
I'm wondering why this err is ignored, rxe_mr_copy() does the real execution or rxe_mr_copy() would never fail ? IMO, when err happens, responder shall notify the request anyhow.

Quoted 8 lines

Practically, I have never seen rxe_mr_copy() failed before, but I agree the implementation may be incorrect as you mentioned.

As far as I tested, responder replied with the requested amount of payloads even when rxe_mr_copy() is modified to fail. In this case, requester may mistakenly believe that they get data correctly.

For more details, see IB Specification Vol 1-Revision-1.5 Ch.9.7.5.1.3 (page.334).

it seems it's suitable to reply NAK code "REMOTE ACCESS ERROR" to the requester side by returning RESPST_ERR_RKEY_VIOLATION here.

see "9.7.5.2.4 REMOTE ACCESS ERROR" and "9.7.4.1.5 RESPONDER R_KEY VALIDATION"

Quoted 21 lines

Daisuke Matsuda

Quoted 18 lines

Thanks
Zhijian

Quoted 15 lines
drivers/infiniband/sw/rxe/rxe_resp.c +1 -3
   	if (mr)
   		rxe_put(mr);
 
@@ -823,10 +821,8 @@ static enum resp_states read_reply(struct rxe_qp *qp,
   	}
 
   	err = rxe_xmit_packet(qp, &ack_pkt, skb);
-	if (err) {
-		pr_err("Failed sending RDMA reply.\n");
+	if (err)
   		return RESPST_ERR_RNR;
-	}
 
   	res->read.va += payload;
   	res->read.resid -= payload;
#12 lore raw

Re: [PATCH] RDMA/rxe: Delete error messages triggered by incoming Read requests

Quoted 15 lines · Li Zhijian
Quoted 12 lines · Daisuke/松田 大輔
Quoted 11 lines · Li Zhijian
Quoted 10 lines · Daisuke Matsuda

An incoming Read request causes multiple Read responses. If a user MR to copy data from is unavailable or responder cannot send a reply, then the error messages can be printed for each response attempt, resulting in message overflow.

---
   drivers/infiniband/sw/rxe/rxe_resp.c | 6 +-----

   1 file changed, 1 insertion(+), 5 deletions(-)
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/infiniband/sw/rxe/rxe_resp.c static enum resp_states read_reply(struct rxe_qp *qp, · line 813

Quoted 8 lines
drivers/infiniband/sw/rxe/rxe_resp.c +0 -0
index b36ec5c4d5e0..4b3e8aec2fb8 100644
@@ -811,8 +811,6 @@ static enum resp_states read_reply(struct rxe_qp *qp,
 
        err = rxe_mr_copy(mr, res->read.va, payload_addr(&ack_pkt),
                  payload, RXE_FROM_MR_OBJ);

Looks i was missing the the faulting point inside rxe_mr_copy()

mr_check_range() is the only point to return an error inside rxe_mr_copy()
and mr_check_range() would never fail in this moment, since it is always tested by RESPST_CHK_RKEY before calling read_reply()

so it's safe to remove this print, and add some comments ?

Thanks
Zhijian

Quoted 43 lines
Quoted 5 lines
Quoted 5 lines

drivers/infiniband/sw/rxe/rxe_resp.c static enum resp_states read_reply(struct rxe_qp *qp, · line 815

Quoted 2 lines
drivers/infiniband/sw/rxe/rxe_resp.c +0 -2
-    if (err)
-        pr_err("Failed copying memory\n");

Not relate to this patch.
I'm wondering why this err is ignored, rxe_mr_copy() does the real execution or rxe_mr_copy() would never fail ? IMO, when err happens, responder shall notify the request anyhow.

Quoted 8 lines

Practically, I have never seen rxe_mr_copy() failed before, but I agree the implementation may be incorrect as you mentioned.

As far as I tested, responder replied with the requested amount of payloads even when rxe_mr_copy() is modified to fail. In this case, requester may mistakenly believe that they get data correctly.

For more details, see IB Specification Vol 1-Revision-1.5 Ch.9.7.5.1.3 (page.334).

it seems it's suitable to reply NAK code "REMOTE ACCESS ERROR" to the requester side by returning RESPST_ERR_RKEY_VIOLATION here.

see "9.7.5.2.4 REMOTE ACCESS ERROR" and "9.7.4.1.5 RESPONDER R_KEY VALIDATION"

Quoted 21 lines

Daisuke Matsuda

Quoted 18 lines

Thanks
Zhijian

Quoted 15 lines
drivers/infiniband/sw/rxe/rxe_resp.c +1 -3
        if (mr)
            rxe_put(mr);
 
@@ -823,10 +821,8 @@ static enum resp_states read_reply(struct rxe_qp *qp,
        }
 
        err = rxe_xmit_packet(qp, &ack_pkt, skb);
-    if (err) {
-        pr_err("Failed sending RDMA reply.\n");
+    if (err)
            return RESPST_ERR_RNR;
-    }
 
        res->read.va += payload;
        res->read.resid -= payload;