Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Bob Pearson <rpearsonhpe@gmail.com>
Cc: yanjun.zhu@linux.dev, jgg@ziepe.ca, linux-rdma@vger.kernel.org,
	jhack@hpe.com
Subject: Re: [PATCH for-next 07/11] RDMA/rxe: Don't call rxe_requester from rxe_completer
Date: Tue, 2 Apr 2024 15:29:56 +0300	[thread overview]
Message-ID: <20240402122956.GH11187@unreal> (raw)
In-Reply-To: <20240326174325.300849-9-rpearsonhpe@gmail.com>

On Tue, Mar 26, 2024 at 12:43:22PM -0500, Bob Pearson wrote:
> Instead of rescheduling rxe_requester from rxe_completer() just extend
> the duration of rxe_sender() by one pass. Setting run_requester_again
> forces rxe_completer() to return 0 which will cause rxe_sender() to be
> called at least one more time.
> 
> Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
> ---
>  drivers/infiniband/sw/rxe/rxe_comp.c | 19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_comp.c b/drivers/infiniband/sw/rxe/rxe_comp.c
> index ea64a25fe876..c41743fbd5f1 100644
> --- a/drivers/infiniband/sw/rxe/rxe_comp.c
> +++ b/drivers/infiniband/sw/rxe/rxe_comp.c
> @@ -82,6 +82,8 @@ static unsigned long rnrnak_usec[32] = {
>  	[IB_RNR_TIMER_491_52] = 491520,
>  };
>  
> +static int run_requester_again;

Is it safe to write, read and rely on value from this global variable without any locking?

Thanks

> +
>  static inline unsigned long rnrnak_jiffies(u8 timeout)
>  {
>  	return max_t(unsigned long,
> @@ -325,7 +327,7 @@ static inline enum comp_state check_ack(struct rxe_qp *qp,
>  					qp->comp.psn = pkt->psn;
>  					if (qp->req.wait_psn) {
>  						qp->req.wait_psn = 0;
> -						rxe_sched_task(&qp->send_task);
> +						run_requester_again = 1;
>  					}
>  				}
>  				return COMPST_ERROR_RETRY;
> @@ -476,7 +478,7 @@ static void do_complete(struct rxe_qp *qp, struct rxe_send_wqe *wqe)
>  	 */
>  	if (qp->req.wait_fence) {
>  		qp->req.wait_fence = 0;
> -		rxe_sched_task(&qp->send_task);
> +		run_requester_again = 1;
>  	}
>  }
>  
> @@ -515,7 +517,7 @@ static inline enum comp_state complete_ack(struct rxe_qp *qp,
>  		if (qp->req.need_rd_atomic) {
>  			qp->comp.timeout_retry = 0;
>  			qp->req.need_rd_atomic = 0;
> -			rxe_sched_task(&qp->send_task);
> +			run_requester_again = 1;
>  		}
>  	}
>  
> @@ -541,7 +543,7 @@ static inline enum comp_state complete_wqe(struct rxe_qp *qp,
>  
>  		if (qp->req.wait_psn) {
>  			qp->req.wait_psn = 0;
> -			rxe_sched_task(&qp->send_task);
> +			run_requester_again = 1;
>  		}
>  	}
>  
> @@ -654,6 +656,8 @@ int rxe_completer(struct rxe_qp *qp)
>  	int ret;
>  	unsigned long flags;
>  
> +	run_requester_again = 0;
> +
>  	spin_lock_irqsave(&qp->state_lock, flags);
>  	if (!qp->valid || qp_state(qp) == IB_QPS_ERR ||
>  			  qp_state(qp) == IB_QPS_RESET) {
> @@ -737,7 +741,7 @@ int rxe_completer(struct rxe_qp *qp)
>  
>  			if (qp->req.wait_psn) {
>  				qp->req.wait_psn = 0;
> -				rxe_sched_task(&qp->send_task);
> +				run_requester_again = 1;
>  			}
>  
>  			state = COMPST_DONE;
> @@ -792,7 +796,7 @@ int rxe_completer(struct rxe_qp *qp)
>  							RXE_CNT_COMP_RETRY);
>  					qp->req.need_retry = 1;
>  					qp->comp.started_retry = 1;
> -					rxe_sched_task(&qp->send_task);
> +					run_requester_again = 1;
>  				}
>  				goto done;
>  
> @@ -843,8 +847,9 @@ int rxe_completer(struct rxe_qp *qp)
>  	ret = 0;
>  	goto out;
>  exit:
> -	ret = -EAGAIN;
> +	ret = (run_requester_again) ? 0 : -EAGAIN;
>  out:
> +	run_requester_again = 0;
>  	if (pkt)
>  		free_pkt(pkt);
>  	return ret;
> -- 
> 2.43.0
> 

  reply	other threads:[~2024-04-02 12:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-26 17:43 [PATCH for-next 00/11] RDMA/rxe: Various fixes and cleanups Bob Pearson
2024-03-26 17:43 ` [PATCH for-next 01/11] RDMA/rxe: Fix seg fault in rxe_comp_queue_pkt Bob Pearson
2024-04-02 12:31   ` Leon Romanovsky
2024-03-26 17:43 ` [PATCH for-next 02/11] RDMA/rxe: Allow good work requests to be executed Bob Pearson
2024-04-02 12:57   ` Zhu Yanjun
2024-03-26 17:43 ` [PATCH for-next 03/11] RDMA/rxe: Remove redundant scheduling of rxe_completer Bob Pearson
2024-03-26 17:43 ` [PATCH for-next 04/11] RDMA/rxe: Merge request and complete tasks Bob Pearson
2024-03-26 17:43 ` [PATCH for-next 05/11] RDMA/rxe: Remove save/rollback_state in rxe_requester Bob Pearson
2024-03-26 17:43 ` [PATCH for-next 06/11] RDMA/rxe: Don't schedule rxe_completer() in rxe_requester() Bob Pearson
2024-03-26 17:43 ` [PATCH for-next 07/11] RDMA/rxe: Don't call rxe_requester from rxe_completer Bob Pearson
2024-04-02 12:29   ` Leon Romanovsky [this message]
2024-03-26 17:43 ` [PATCH for-next 08/11] RDMA/rxe: Don't call direct between tasks Bob Pearson
2024-03-26 17:43 ` [PATCH for-next 09/11] RDMA/rxe: Fix incorrect rxe_put in error path Bob Pearson
2024-03-26 17:43 ` [PATCH for-next 10/11] RDMA/rxe: Make rxe_loopback match rxe_send behavior Bob Pearson
2024-03-26 17:43 ` [PATCH for-next 11/11] RDMA/rxe: Get rid of pkt resend on err Bob Pearson
2024-03-26 19:01 ` [PATCH for-next 00/11] RDMA/rxe: Various fixes and cleanups Zhu Yanjun

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=20240402122956.GH11187@unreal \
    --to=leon@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=jhack@hpe.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=rpearsonhpe@gmail.com \
    --cc=yanjun.zhu@linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox