diff mbox

[Trusty,SRU] lpfc: Add iotag memory barrier

Message ID 1435163058-27653-1-git-send-email-chris.j.arges@canonical.com
State New
Headers show

Commit Message

Chris J Arges June 24, 2015, 4:24 p.m. UTC
From: James Smart <james.smart@emulex.com>

BugLink: http://bugs.launchpad.net/bugs/1468416

Add a memory barrier to ensure the valid bit is read before
any of the cqe payload is read. This fixes an issue seen
on Power where the cqe payload was getting loaded before
the valid bit. When this occurred, we saw an iotag out of
range error when a command completed, but since the iotag
looked invalid the command didn't get completed to scsi core.
Later we hit the command timeout, attempted to abort the command,
then waited for the aborted command to get returned. Since the
adapter already returned the command, we timeout waiting,
and end up escalating EEH all the way to host reset. This
patch fixes this issue.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Smart <james.smart@emulex.com>

 ---

 lpfc_sli.c |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
Signed-off-by: Christoph Hellwig <hch@lst.de>

(cherry picked from commit 27f344eb15dd0da80ebec80c7245e8c85043f841)
Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
---
 drivers/scsi/lpfc/lpfc_sli.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

Comments

Tim Gardner June 24, 2015, 4:32 p.m. UTC | #1

Kamal Mostafa June 25, 2015, 3:44 p.m. UTC | #2
On Wed, 2015-06-24 at 11:24 -0500, Chris J Arges wrote:
> From: James Smart <james.smart@emulex.com>
> 
> BugLink: http://bugs.launchpad.net/bugs/1468416
> 
> Add a memory barrier to ensure the valid bit is read before


Ack for Trusty.

Note also that this patch (which landed in 3.16) would be suitable for
3.12, 3.13, and 3.14 -stable.  Maybe even 3.2.

 -Kamal
Stefan Bader June 25, 2015, 3:45 p.m. UTC | #3

Kamal Mostafa June 25, 2015, 5:56 p.m. UTC | #4

diff mbox

Patch

diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 8f580fd..ce21132 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -265,6 +265,16 @@  lpfc_sli4_eq_get(struct lpfc_queue *q)
 		return NULL;
 
 	q->hba_index = idx;
+
+	/*
+	 * insert barrier for instruction interlock : data from the hardware
+	 * must have the valid bit checked before it can be copied and acted
+	 * upon. Given what was seen in lpfc_sli4_cq_get() of speculative
+	 * instructions allowing action on content before valid bit checked,
+	 * add barrier here as well. May not be needed as "content" is a
+	 * single 32-bit entity here (vs multi word structure for cq's).
+	 */
+	mb();
 	return eqe;
 }
 
@@ -370,6 +380,17 @@  lpfc_sli4_cq_get(struct lpfc_queue *q)
 
 	cqe = q->qe[q->hba_index].cqe;
 	q->hba_index = idx;
+
+	/*
+	 * insert barrier for instruction interlock : data from the hardware
+	 * must have the valid bit checked before it can be copied and acted
+	 * upon. Speculative instructions were allowing a bcopy at the start
+	 * of lpfc_sli4_fp_handle_wcqe(), which is called immediately
+	 * after our return, to copy data before the valid bit check above
+	 * was done. As such, some of the copied data was stale. The barrier
+	 * ensures the check is before any data is copied.
+	 */
+	mb();
 	return cqe;
 }