public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-next 0/2] iw_cxgb4: Misc fixes for iw_cxgb4
@ 2014-12-17  8:41 Hariprasad Shenai
       [not found] ` <1418805663-15333-1-git-send-email-hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Hariprasad Shenai @ 2014-12-17  8:41 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: roland-BHEL68pLQRGGvPXPguhicg,
	swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW, Hariprasad Shenai

Hi,

This patch series serializes CQ event upcalls with CQ destruction and fixes
hanging of threads forever waiting on work request replies.

This patch series is created on top of infiniband tree, and includes patch on
iw_cxgb4 driver.

We have included all the maintainers of respective drivers. Kindly review the
change and let us know in case of any review comments.

Thanks

Hariprasad Shenai (2):
  iw_cxgb4: serialize CQ event upcalls with CQ destruction
  iw_cxgb4: don't hang threads forever waiting on WR replies

 drivers/infiniband/hw/cxgb4/ev.c       |    9 ++++++++-
 drivers/infiniband/hw/cxgb4/iw_cxgb4.h |   30 +++++++++++++++---------------
 2 files changed, 23 insertions(+), 16 deletions(-)

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH for-next 1/2] iw_cxgb4: serialize CQ event upcalls with CQ destruction
       [not found] ` <1418805663-15333-1-git-send-email-hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
@ 2014-12-17  8:41   ` Hariprasad Shenai
  2014-12-17  8:41   ` [PATCH for-next 2/2] iw_cxgb4: don't hang threads forever waiting on WR replies Hariprasad Shenai
  2015-02-09 15:36   ` [PATCH for-next 0/2] iw_cxgb4: Misc fixes for iw_cxgb4 Steve Wise
  2 siblings, 0 replies; 4+ messages in thread
From: Hariprasad Shenai @ 2014-12-17  8:41 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: roland-BHEL68pLQRGGvPXPguhicg,
	swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW, Hariprasad Shenai

A race exists where the application can be destroying the CQ concurrently
with a HW interrupt indicating a completion has been inserted into the CQ.
This can case an event notification upcall to the application after the
CQ has been destroyed.

The solution is to serialize looking up the CQ in the IDR table and
referencing the CQ in c4iw_ev_handler(), with removing the CQID from the
IDR table and blocking until the refcnt reaches 0 in c4iw_destroy_cq().

Signed-off-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
Signed-off-by: Hariprasad Shenai <hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
---
 drivers/infiniband/hw/cxgb4/ev.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb4/ev.c b/drivers/infiniband/hw/cxgb4/ev.c
index c9df054..4498a89 100644
--- a/drivers/infiniband/hw/cxgb4/ev.c
+++ b/drivers/infiniband/hw/cxgb4/ev.c
@@ -225,13 +225,20 @@ int c4iw_ev_handler(struct c4iw_dev *dev, u32 qid)
 	struct c4iw_cq *chp;
 	unsigned long flag;
 
+	spin_lock_irqsave(&dev->lock, flag);
 	chp = get_chp(dev, qid);
 	if (chp) {
+		atomic_inc(&chp->refcnt);
+		spin_unlock_irqrestore(&dev->lock, flag);
 		t4_clear_cq_armed(&chp->cq);
 		spin_lock_irqsave(&chp->comp_handler_lock, flag);
 		(*chp->ibcq.comp_handler)(&chp->ibcq, chp->ibcq.cq_context);
 		spin_unlock_irqrestore(&chp->comp_handler_lock, flag);
-	} else
+		if (atomic_dec_and_test(&chp->refcnt))
+			wake_up(&chp->wait);
+	} else {
 		PDBG("%s unknown cqid 0x%x\n", __func__, qid);
+		spin_unlock_irqrestore(&dev->lock, flag);
+	}
 	return 0;
 }
-- 
1.7.1

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH for-next 2/2] iw_cxgb4: don't hang threads forever waiting on WR replies
       [not found] ` <1418805663-15333-1-git-send-email-hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
  2014-12-17  8:41   ` [PATCH for-next 1/2] iw_cxgb4: serialize CQ event upcalls with CQ destruction Hariprasad Shenai
@ 2014-12-17  8:41   ` Hariprasad Shenai
  2015-02-09 15:36   ` [PATCH for-next 0/2] iw_cxgb4: Misc fixes for iw_cxgb4 Steve Wise
  2 siblings, 0 replies; 4+ messages in thread
From: Hariprasad Shenai @ 2014-12-17  8:41 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: roland-BHEL68pLQRGGvPXPguhicg,
	swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW, Hariprasad Shenai

In c4iw_wait_for_reply(), if a FW6_MSG WR reply is not received after
C4IW_WR_TO seconds, fail the WR operation and mark the device as fatally
dead. Further, if the device is marked fatally dead, then fail the WR
wait immediately.

Also change the timeout to 60 seconds.

Signed-off-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
Signed-off-by: Hariprasad Shenai <hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
---
 drivers/infiniband/hw/cxgb4/iw_cxgb4.h |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
index b5678ac..9214260 100644
--- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
+++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
@@ -196,7 +196,7 @@ static inline int c4iw_num_stags(struct c4iw_rdev *rdev)
 	return (int)(rdev->lldi.vr->stag.size >> 5);
 }
 
-#define C4IW_WR_TO (30*HZ)
+#define C4IW_WR_TO (60*HZ)
 
 struct c4iw_wr_wait {
 	struct completion completion;
@@ -220,22 +220,22 @@ static inline int c4iw_wait_for_reply(struct c4iw_rdev *rdev,
 				 u32 hwtid, u32 qpid,
 				 const char *func)
 {
-	unsigned to = C4IW_WR_TO;
 	int ret;
 
-	do {
-		ret = wait_for_completion_timeout(&wr_waitp->completion, to);
-		if (!ret) {
-			printk(KERN_ERR MOD "%s - Device %s not responding - "
-			       "tid %u qpid %u\n", func,
-			       pci_name(rdev->lldi.pdev), hwtid, qpid);
-			if (c4iw_fatal_error(rdev)) {
-				wr_waitp->ret = -EIO;
-				break;
-			}
-			to = to << 2;
-		}
-	} while (!ret);
+	if (c4iw_fatal_error(rdev)) {
+		wr_waitp->ret = -EIO;
+		goto out;
+	}
+
+	ret = wait_for_completion_timeout(&wr_waitp->completion, C4IW_WR_TO);
+	if (!ret) {
+		PDBG(KERN_ERR MOD "%s - Device %s not responding (disabling"
+		     " device) - tid %u qpid %u\n", func,
+		     pci_name(rdev->lldi.pdev), hwtid, qpid);
+		rdev->flags |= T4_FATAL_ERROR;
+		wr_waitp->ret = -EIO;
+	}
+out:
 	if (wr_waitp->ret)
 		PDBG("%s: FW reply %d tid %u qpid %u\n",
 		     pci_name(rdev->lldi.pdev), wr_waitp->ret, hwtid, qpid);
-- 
1.7.1

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH for-next 0/2] iw_cxgb4: Misc fixes for iw_cxgb4
       [not found] ` <1418805663-15333-1-git-send-email-hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
  2014-12-17  8:41   ` [PATCH for-next 1/2] iw_cxgb4: serialize CQ event upcalls with CQ destruction Hariprasad Shenai
  2014-12-17  8:41   ` [PATCH for-next 2/2] iw_cxgb4: don't hang threads forever waiting on WR replies Hariprasad Shenai
@ 2015-02-09 15:36   ` Steve Wise
  2 siblings, 0 replies; 4+ messages in thread
From: Steve Wise @ 2015-02-09 15:36 UTC (permalink / raw)
  To: roland-BHEL68pLQRGGvPXPguhicg
  Cc: hariprasad-ut6Up61K2wZBDgjK7y7TUQ,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA

Hey Roland,

Did this series fall through the cracks?

Thanks,

Steve.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-09 15:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-17  8:41 [PATCH for-next 0/2] iw_cxgb4: Misc fixes for iw_cxgb4 Hariprasad Shenai
     [not found] ` <1418805663-15333-1-git-send-email-hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
2014-12-17  8:41   ` [PATCH for-next 1/2] iw_cxgb4: serialize CQ event upcalls with CQ destruction Hariprasad Shenai
2014-12-17  8:41   ` [PATCH for-next 2/2] iw_cxgb4: don't hang threads forever waiting on WR replies Hariprasad Shenai
2015-02-09 15:36   ` [PATCH for-next 0/2] iw_cxgb4: Misc fixes for iw_cxgb4 Steve Wise

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox