All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bob Pearson <rpearsonhpe@gmail.com>
To: jgg@nvidia.com, zyjzyj2000@gmail.com, linux-rdma@vger.kernel.org
Cc: Bob Pearson <rpearsonhpe@gmail.com>
Subject: [PATCH for-next v2 1/9] RDMA/rxe: Add rxe_is_fenced() subroutine
Date: Thu, 30 Jun 2022 14:04:18 -0500	[thread overview]
Message-ID: <20220630190425.2251-2-rpearsonhpe@gmail.com> (raw)
In-Reply-To: <20220630190425.2251-1-rpearsonhpe@gmail.com>

The code thc that decides whether to defer execution of a wqe in
rxe_requester.c is isolated into a subroutine rxe_is_fenced()
and removed from the call to req_next_wqe(). The condition whether
a wqe should be fenced is changed to comply with the IBA. Currently
an operation is fenced if the fence bit is set in the wqe flags and
the last wqe has not completed. For normal operations the IBA
actually only requires that the last read or atomic operation is
complete. 

Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
---
v2 replaces "RDMA/rxe: Fix incorrect fencing"

 drivers/infiniband/sw/rxe/rxe_req.c | 37 ++++++++++++++++++++++++-----
 1 file changed, 31 insertions(+), 6 deletions(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c
index 9d98237389cf..e8a1664a40eb 100644
--- a/drivers/infiniband/sw/rxe/rxe_req.c
+++ b/drivers/infiniband/sw/rxe/rxe_req.c
@@ -161,16 +161,36 @@ static struct rxe_send_wqe *req_next_wqe(struct rxe_qp *qp)
 		     (wqe->state != wqe_state_processing)))
 		return NULL;
 
-	if (unlikely((wqe->wr.send_flags & IB_SEND_FENCE) &&
-						     (index != cons))) {
-		qp->req.wait_fence = 1;
-		return NULL;
-	}
-
 	wqe->mask = wr_opcode_mask(wqe->wr.opcode, qp);
 	return wqe;
 }
 
+/**
+ * rxe_wqe_is_fenced - check if next wqe is fenced
+ * @qp: the queue pair
+ * @wqe: the next wqe
+ *
+ * Returns: 1 if wqe needs to wait
+ *	    0 if wqe is ready to go
+ */
+static int rxe_wqe_is_fenced(struct rxe_qp *qp, struct rxe_send_wqe *wqe)
+{
+	/* Local invalidate fence (LIF) see IBA 10.6.5.1
+	 * Requires ALL previous operations on the send queue
+	 * are complete. Make mandatory for the rxe driver.
+	 */
+	if (wqe->wr.opcode == IB_WR_LOCAL_INV)
+		return qp->req.wqe_index != queue_get_consumer(qp->sq.queue,
+						QUEUE_TYPE_FROM_CLIENT);
+
+	/* Fence see IBA 10.8.3.3
+	 * Requires that all previous read and atomic operations
+	 * are complete.
+	 */
+	return (wqe->wr.send_flags & IB_SEND_FENCE) &&
+		atomic_read(&qp->req.rd_atomic) != qp->attr.max_rd_atomic;
+}
+
 static int next_opcode_rc(struct rxe_qp *qp, u32 opcode, int fits)
 {
 	switch (opcode) {
@@ -632,6 +652,11 @@ int rxe_requester(void *arg)
 	if (unlikely(!wqe))
 		goto exit;
 
+	if (rxe_wqe_is_fenced(qp, wqe)) {
+		qp->req.wait_fence = 1;
+		goto exit;
+	}
+
 	if (wqe->mask & WR_LOCAL_OP_MASK) {
 		ret = rxe_do_local_ops(qp, wqe);
 		if (unlikely(ret))
-- 
2.34.1


  reply	other threads:[~2022-06-30 19:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-30 19:04 [PATCH for-next v2 0/9] RDMA/rxe: Various fixes Bob Pearson
2022-06-30 19:04 ` Bob Pearson [this message]
2022-07-18  2:13   ` [PATCH for-next v2 1/9] RDMA/rxe: Add rxe_is_fenced() subroutine lizhijian
2022-06-30 19:04 ` [PATCH for-next v2 2/9] RDMA/rxe: Convert pr_warn/err to pr_debug in pyverbs Bob Pearson
2022-06-30 19:04 ` [PATCH for-next v2 3/9] RDMA/rxe: Remove unnecessary include statement Bob Pearson
2022-06-30 19:04 ` [PATCH for-next v2 4/9] RDMA/rxe: Replace " Bob Pearson
2022-06-30 19:04 ` [PATCH for-next v2 5/9] RDMA/rxe: Fix rnr retry behavior Bob Pearson
2022-06-30 19:04 ` [PATCH for-next v2 6/9] RDMA/rxe: Fix deadlock in rxe_do_local_ops() Bob Pearson
2022-06-30 19:04 ` [PATCH for-next v2 7/9] RDMA/rxe: Make the tasklet exits the same Bob Pearson
2022-06-30 19:04 ` [PATCH for-next v2 8/9] RDMA/rxe: Limit the number of calls to each tasklet Bob Pearson
2022-06-30 19:04 ` [PATCH for-next v2 9/9] RDMA/rxe: Replace __rxe_do_task by rxe_run_task Bob Pearson
2022-07-01  1:24   ` lizhijian
2022-07-01  0:20 ` [PATCH for-next v2 0/9] RDMA/rxe: Various fixes Jason Gunthorpe
2022-07-22 21:14 ` Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220630190425.2251-2-rpearsonhpe@gmail.com \
    --to=rpearsonhpe@gmail.com \
    --cc=jgg@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=zyjzyj2000@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.