All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bob Pearson <rpearsonhpe@gmail.com>
To: jgg@nvidia.com, zyjzyj2000@gmail.com,
	matsuda-daisuke@fujitsu.com, jhack@hpe.com,
	linux-rdma@vger.kernel.org
Cc: Bob Pearson <rpearsonhpe@gmail.com>
Subject: [PATCH for-next 6/9] RDMA/rxe: Replace some __rxe_do_task by rxe_sched_task
Date: Wed, 22 Feb 2023 17:32:35 -0600	[thread overview]
Message-ID: <20230222233237.48940-7-rpearsonhpe@gmail.com> (raw)
In-Reply-To: <20230222233237.48940-1-rpearsonhpe@gmail.com>

In rxe_qp.c there are several calls to __rxe_do_task if the
qp is not RC for the completion tasklet. This is not really
correct since elsewhere in the driver rxe_run_task and
rxe_sched_task are used for the completion tasklet which
prevents reentering the completion tasklet code while
__rxe_do_task does not. It can only be safely used when the
task machinery is stopped as in rxe_qp_reset and
rxe_qp_do_cleanup.

In the latter two cases there are if statements checking
to see of the qp has a send queue which is not required.

This patch replaces calls to __rxe_do_task by rxe_sched_task
except in the two mentioned cases and removes the conditional
code in those.

Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
---
 drivers/infiniband/sw/rxe/rxe_qp.c | 37 ++++++++----------------------
 1 file changed, 10 insertions(+), 27 deletions(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c
index c954dd9394ba..544a5aa59ff7 100644
--- a/drivers/infiniband/sw/rxe/rxe_qp.c
+++ b/drivers/infiniband/sw/rxe/rxe_qp.c
@@ -473,13 +473,8 @@ static void rxe_qp_reset(struct rxe_qp *qp)
 {
 	/* stop tasks from running */
 	rxe_disable_task(&qp->resp.task);
-
-	/* stop request/comp */
-	if (qp->sq.queue) {
-		if (qp_type(qp) == IB_QPT_RC)
-			rxe_disable_task(&qp->comp.task);
-		rxe_disable_task(&qp->req.task);
-	}
+	rxe_disable_task(&qp->comp.task);
+	rxe_disable_task(&qp->req.task);
 
 	/* move qp to the reset state */
 	qp->req.state = QP_STATE_RESET;
@@ -490,12 +485,11 @@ static void rxe_qp_reset(struct rxe_qp *qp)
 	 * etc.
 	 */
 	__rxe_do_task(&qp->resp.task);
+	__rxe_do_task(&qp->comp.task);
+	__rxe_do_task(&qp->req.task);
 
-	if (qp->sq.queue) {
-		__rxe_do_task(&qp->comp.task);
-		__rxe_do_task(&qp->req.task);
+	if (qp->sq.queue)
 		rxe_queue_reset(qp->sq.queue);
-	}
 
 	/* cleanup attributes */
 	atomic_set(&qp->ssn, 0);
@@ -533,10 +527,7 @@ static void rxe_qp_drain(struct rxe_qp *qp)
 	if (qp->sq.queue) {
 		if (qp->req.state != QP_STATE_DRAINED) {
 			qp->req.state = QP_STATE_DRAIN;
-			if (qp_type(qp) == IB_QPT_RC)
-				rxe_sched_task(&qp->comp.task);
-			else
-				__rxe_do_task(&qp->comp.task);
+			rxe_sched_task(&qp->comp.task);
 			rxe_sched_task(&qp->req.task);
 		}
 	}
@@ -552,11 +543,7 @@ void rxe_qp_error(struct rxe_qp *qp)
 
 	/* drain work and packet queues */
 	rxe_sched_task(&qp->resp.task);
-
-	if (qp_type(qp) == IB_QPT_RC)
-		rxe_sched_task(&qp->comp.task);
-	else
-		__rxe_do_task(&qp->comp.task);
+	rxe_sched_task(&qp->comp.task);
 	rxe_sched_task(&qp->req.task);
 }
 
@@ -784,13 +771,9 @@ static void rxe_qp_do_cleanup(struct work_struct *work)
 	rxe_cleanup_task(&qp->comp.task);
 
 	/* flush out any receive wr's or pending requests */
-	if (qp->req.task.func)
-		__rxe_do_task(&qp->req.task);
-
-	if (qp->sq.queue) {
-		__rxe_do_task(&qp->comp.task);
-		__rxe_do_task(&qp->req.task);
-	}
+	__rxe_do_task(&qp->req.task);
+	__rxe_do_task(&qp->comp.task);
+	__rxe_do_task(&qp->req.task);
 
 	if (qp->sq.queue)
 		rxe_queue_cleanup(qp->sq.queue);
-- 
2.37.2


  parent reply	other threads:[~2023-02-22 23:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-22 23:32 [PATCH for-next 0/9] RDMA/rxe: Correct qp reference counting Bob Pearson
2023-02-22 23:32 ` [PATCH for-next 1/9] RDMA/rxe: Extend debug log messages Bob Pearson
2023-02-22 23:32 ` [PATCH for-next 2/9] RDMA/rxe: Add error messages Bob Pearson
2023-02-22 23:32 ` [PATCH for-next 3/9] RDMA/rxe: Convert tasklet args to queue pairs Bob Pearson
2023-02-22 23:32 ` [PATCH for-next 4/9] RDMA/rxe: Remove extra rxe_get(qp) in rxe_rcv_mcast_pkt Bob Pearson
2023-02-22 23:32 ` [PATCH for-next 5/9] RDMA/rxe: Add a warning if refcnt zero in rxe_put Bob Pearson
2023-02-22 23:32 ` Bob Pearson [this message]
2023-02-22 23:32 ` [PATCH for-next 7/9] RDMA/rxe: Check for unsupported wr opcodes Bob Pearson
2023-02-22 23:32 ` [PATCH for-next 8/9] RDMA/rxe: Remove qp reference counting in tasks Bob Pearson
2023-02-22 23:32 ` [PATCH for-next 9/9] RDMA/rxe: Rewrite rxe_task.c Bob Pearson

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=20230222233237.48940-7-rpearsonhpe@gmail.com \
    --to=rpearsonhpe@gmail.com \
    --cc=jgg@nvidia.com \
    --cc=jhack@hpe.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=matsuda-daisuke@fujitsu.com \
    --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.