public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IB/hfi1: Fix hard lockup due to not using save/restore spin lock
@ 2016-06-01 14:38 Mike Marciniszyn
  2016-06-01 15:44 ` Leon Romanovsky
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Marciniszyn @ 2016-06-01 14:38 UTC (permalink / raw)
  To: stable; +Cc: linux-rdma

Upstream commit 7049de65c9e5 into 4.6.

Commit b9b06cb6feda
("IB/hfi1: Fix missing lock/unlock in verbs drain callback")
added a spin lock.

Unfortunately, the new lock code can be called from a base
level interrupt state, and an interrupt that can get stacked
will attempt to get the same lock.

Fix by using the flag save/restore spin lock variation.

Reviewed-by: Sebastian Sanchez <sebastian.sanchez@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
---
 drivers/staging/rdma/hfi1/qp.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rdma/hfi1/qp.c b/drivers/staging/rdma/hfi1/qp.c
index dc9119e..0401955 100644
--- a/drivers/staging/rdma/hfi1/qp.c
+++ b/drivers/staging/rdma/hfi1/qp.c
@@ -512,6 +512,7 @@ static void iowait_wakeup(struct iowait *wait, int reason)
 static void iowait_sdma_drained(struct iowait *wait)
 {
 	struct rvt_qp *qp = iowait_to_qp(wait);
+	unsigned long flags;
 
 	/*
 	 * This happens when the send engine notes
@@ -519,12 +520,12 @@ static void iowait_sdma_drained(struct iowait *wait)
 	 * do the flush work until that QP's
 	 * sdma work has finished.
 	 */
-	spin_lock(&qp->s_lock);
+	spin_lock_irqsave(&qp->s_lock, flags);
 	if (qp->s_flags & RVT_S_WAIT_DMA) {
 		qp->s_flags &= ~RVT_S_WAIT_DMA;
 		hfi1_schedule_send(qp);
 	}
-	spin_unlock(&qp->s_lock);
+	spin_unlock_irqrestore(&qp->s_lock, flags);
 }
 
 /**


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

end of thread, other threads:[~2016-06-01 16:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-01 14:38 [PATCH] IB/hfi1: Fix hard lockup due to not using save/restore spin lock Mike Marciniszyn
2016-06-01 15:44 ` Leon Romanovsky
2016-06-01 16:14   ` Greg KH
2016-06-01 16:47     ` Leon Romanovsky
2016-06-01 16:50       ` Marciniszyn, Mike
2016-06-01 16:25   ` Marciniszyn, Mike

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