Message ID | 20240329145513.35381-5-rpearsonhpe@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Jason Gunthorpe |
Headers | show |
Series | RDMA/rxe: Various fixes and cleanups | expand |
在 2024/3/29 15:55, Bob Pearson 写道: > A previous commit incorrectly added an 'if(!err)' before scheduling > the requester task in rxe_post_send_kernel(). But if there were send > wrs successfully added to the send queue before a bad wr they might > never get executed. > > This commit fixes this by scheduling the requester task if any wqes were > successfully posted in rxe_post_send_kernel() in rxe_verbs.c. > > Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com> > Fixes: 5bf944f24129 ("RDMA/rxe: Add error messages") > --- > drivers/infiniband/sw/rxe/rxe_verbs.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c > index 614581989b38..a49784e5156c 100644 > --- a/drivers/infiniband/sw/rxe/rxe_verbs.c > +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c > @@ -888,6 +888,7 @@ static int rxe_post_send_kernel(struct rxe_qp *qp, > { > int err = 0; > unsigned long flags; > + int good = 0; If we use RCT (Reverse Christmas Tree) to sort out the above variable declaration, it is better. Thanks, Zhu Yanjun > > spin_lock_irqsave(&qp->sq.sq_lock, flags); > while (ibwr) { > @@ -895,12 +896,15 @@ static int rxe_post_send_kernel(struct rxe_qp *qp, > if (err) { > *bad_wr = ibwr; > break; > + } else { > + good++; > } > ibwr = ibwr->next; > } > spin_unlock_irqrestore(&qp->sq.sq_lock, flags); > > - if (!err) > + /* kickoff processing of any posted wqes */ > + if (good) > rxe_sched_task(&qp->req.task); > > spin_lock_irqsave(&qp->state_lock, flags);
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c index 614581989b38..a49784e5156c 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.c +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c @@ -888,6 +888,7 @@ static int rxe_post_send_kernel(struct rxe_qp *qp, { int err = 0; unsigned long flags; + int good = 0; spin_lock_irqsave(&qp->sq.sq_lock, flags); while (ibwr) { @@ -895,12 +896,15 @@ static int rxe_post_send_kernel(struct rxe_qp *qp, if (err) { *bad_wr = ibwr; break; + } else { + good++; } ibwr = ibwr->next; } spin_unlock_irqrestore(&qp->sq.sq_lock, flags); - if (!err) + /* kickoff processing of any posted wqes */ + if (good) rxe_sched_task(&qp->req.task); spin_lock_irqsave(&qp->state_lock, flags);
A previous commit incorrectly added an 'if(!err)' before scheduling the requester task in rxe_post_send_kernel(). But if there were send wrs successfully added to the send queue before a bad wr they might never get executed. This commit fixes this by scheduling the requester task if any wqes were successfully posted in rxe_post_send_kernel() in rxe_verbs.c. Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com> Fixes: 5bf944f24129 ("RDMA/rxe: Add error messages") --- drivers/infiniband/sw/rxe/rxe_verbs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)