Skip to contentSkip to conversation

RDMA/bnxt_re: Bug fixes

PATCH Applied Selvin Xavier 2 participants 4 messages Sep 20, 2023 – Sep 21, 2023

Subsystems (2)
lore
Share & tools
lore

Selvin Xavier

author maintainer
#0 lore raw

cover RDMA/bnxt_re: Bug fixes

Couple of important bug fixes for bnxt_re driver.
Please review and apply

Thanks,
Selvin Xavier

Selvin Xavier (2):
RDMA/bnxt_re: Fix the handling of control path response data RDMA/bnxt_re: Decrement resource stats correctly

 drivers/infiniband/hw/bnxt_re/ib_verbs.c   |  4 ++++
 drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 11 +++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)
Signature · 1 line
2.5.5
author maintainer
#1 lore raw

PATCH 1/2 RDMA/bnxt_re: Fix the handling of control path response data

Flag that indicate control path command completion should be cleared only after copying the command response data. As soon as the is_in_used flag is clear, the waiting thread can proceed with wrong response data. This wrong data is causing multiple issues like wrong lkey used in data traffic and wrong AH Id etc.

Use a memory barrier to ensure that the response data is copied and visible to the process waiting on a different cpu core before clearing the is_in_used flag.

Clear the is_in_used after copying the command response.

Fixes bcfee4ce3e01 ("RDMA/bnxt_re: remove redundant cmdq_bitmap")
---
 drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +9 -2
index c8c4017..e47b4ca 100644
@@ -665,7 +665,6 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw,
 		blocked = cookie & RCFW_CMD_IS_BLOCKING;
 		cookie &= RCFW_MAX_COOKIE_VALUE;
 		crsqe = &rcfw->crsqe_tbl[cookie];
-		crsqe->is_in_used = false;
 
 		if (WARN_ONCE(test_bit(FIRMWARE_STALL_DETECTED,
 				       &rcfw->cmdq.flags),
@@ -681,8 +680,14 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw,
 			atomic_dec(&rcfw->timeout_send);
 
 		if (crsqe->is_waiter_alive) {
-			if (crsqe->resp)
+			if (crsqe->resp) {
 				memcpy(crsqe->resp, qp_event, sizeof(*qp_event));
+				/* Insert write memory barrier to ensure that
+				 * response data is copied before clearing the
+				 * flags
+				 */
+				smp_wmb();
+			}
 			if (!blocked)
 				wait_cmds++;
 		}
@@ -694,6 +699,8 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw,
 		if (!is_waiter_alive)
 			crsqe->resp = NULL;
 
+		crsqe->is_in_used = false;
+
 		hwq->cons += req_size;
 
 		/* This is a case to handle below scenario -
Signature · 1 line
2.5.5
author maintainer
#2 lore raw

PATCH 2/2 RDMA/bnxt_re: Decrement resource stats correctly

In reply to Selvin Xavier

rc_qp_count and ud_qp_count is not decremented during qp destroy. Fix this.

Fixes cb95709e0dca ("bnxt_re: Update the hw counters for resource stats")
---
 drivers/infiniband/hw/bnxt_re/ib_verbs.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +4 -0
index 0848c2c..faa88d1 100644
@@ -910,6 +910,10 @@ int bnxt_re_destroy_qp(struct ib_qp *ib_qp, struct ib_udata *udata)
 	list_del(&qp->list);
 	mutex_unlock(&rdev->qp_lock);
 	atomic_dec(&rdev->stats.res.qp_count);
+	if (qp->qplib_qp.type == CMDQ_CREATE_QP_TYPE_RC)
+		atomic_dec(&rdev->stats.res.rc_qp_count);
+	else if (qp->qplib_qp.type == CMDQ_CREATE_QP_TYPE_UD)
+		atomic_dec(&rdev->stats.res.ud_qp_count);
 
 	ib_umem_release(qp->rumem);
 	ib_umem_release(qp->sumem);
Signature · 1 line
2.5.5
#3 lore raw
In reply to Selvin Xavier
Quoted 11 lines · Selvin Xavier

Couple of important bug fixes for bnxt_re driver.
Please review and apply

Thanks,
Selvin Xavier

Selvin Xavier (2):
RDMA/bnxt_re: Fix the handling of control path response data RDMA/bnxt_re: Decrement resource stats correctly

[...]

Applied, thanks!

[1/2] RDMA/bnxt_re: Fix the handling of control path response data

      https://git.kernel.org/rdma/rdma/c/9fc5f9a92fe689
[2/2] RDMA/bnxt_re: Decrement resource stats correctly
      https://git.kernel.org/rdma/rdma/c/a83c6927897522

Best regards,

Signature · 1 line
Leon Romanovsky <[email protected]>