diff mbox

[rdma-rc] iw_cxgb4: only clear the ARMED bit if a notification is needed

Message ID 20171201213130.1ED79E0C84@smtp.ogc.us (mailing list archive)
State Accepted
Headers show

Commit Message

Steve Wise Nov. 30, 2017, 5:41 p.m. UTC
In __flush_qp(), the CQ ARMED bit was being cleared regardless of
whether any notification is actually needed.  This resulted in the iser
termination logic getting stuck in ib_drain_sq() because the CQ was not
marked ARMED and thus the drain CQE notification wasn't triggered.

This new bug was exposed when this commit was merged:

commit cbb40fadd31c ("iw_cxgb4: only call the cq comp_handler when the
cq is armed")

Signed-off-by: Steve Wise <swise@opengridcomputing.com>
---
 drivers/infiniband/hw/cxgb4/qp.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Jason Gunthorpe Dec. 7, 2017, 9:16 p.m. UTC | #1
On Thu, Nov 30, 2017 at 09:41:56AM -0800, Steve Wise wrote:
> In __flush_qp(), the CQ ARMED bit was being cleared regardless of
> whether any notification is actually needed.  This resulted in the iser
> termination logic getting stuck in ib_drain_sq() because the CQ was not
> marked ARMED and thus the drain CQE notification wasn't triggered.
> 
> This new bug was exposed when this commit was merged:
> 
> commit cbb40fadd31c ("iw_cxgb4: only call the cq comp_handler when the
> cq is armed")
> 
> Signed-off-by: Steve Wise <swise@opengridcomputing.com>
>  drivers/infiniband/hw/cxgb4/qp.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Applied to -rc, thanks

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Steve Wise Dec. 11, 2017, 4:12 p.m. UTC | #2
> 
> Applied to -rc, thanks
> 
> Jason

Thanks!  I also have this one for -rc:

https://www.spinics.net/lists/linux-rdma/msg57860.html

Steve.



---
This email has been checked for viruses by AVG.
http://www.avg.com

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c
index 5ee7fe4..355e288 100644
--- a/drivers/infiniband/hw/cxgb4/qp.c
+++ b/drivers/infiniband/hw/cxgb4/qp.c
@@ -1285,21 +1285,21 @@  static void __flush_qp(struct c4iw_qp *qhp, struct c4iw_cq *rchp,
 	spin_unlock_irqrestore(&rchp->lock, flag);
 
 	if (schp == rchp) {
-		if (t4_clear_cq_armed(&rchp->cq) &&
-		    (rq_flushed || sq_flushed)) {
+		if ((rq_flushed || sq_flushed) &&
+		    t4_clear_cq_armed(&rchp->cq)) {
 			spin_lock_irqsave(&rchp->comp_handler_lock, flag);
 			(*rchp->ibcq.comp_handler)(&rchp->ibcq,
 						   rchp->ibcq.cq_context);
 			spin_unlock_irqrestore(&rchp->comp_handler_lock, flag);
 		}
 	} else {
-		if (t4_clear_cq_armed(&rchp->cq) && rq_flushed) {
+		if (rq_flushed && t4_clear_cq_armed(&rchp->cq)) {
 			spin_lock_irqsave(&rchp->comp_handler_lock, flag);
 			(*rchp->ibcq.comp_handler)(&rchp->ibcq,
 						   rchp->ibcq.cq_context);
 			spin_unlock_irqrestore(&rchp->comp_handler_lock, flag);
 		}
-		if (t4_clear_cq_armed(&schp->cq) && sq_flushed) {
+		if (sq_flushed && t4_clear_cq_armed(&schp->cq)) {
 			spin_lock_irqsave(&schp->comp_handler_lock, flag);
 			(*schp->ibcq.comp_handler)(&schp->ibcq,
 						   schp->ibcq.cq_context);