aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_sli.c
diff options
context:
space:
mode:
authorJames Smart <james.smart@emulex.com>2014-05-07 17:16:46 -0400
committerChristoph Hellwig <hch@lst.de>2014-05-19 13:12:25 -0400
commit27f344eb15dd0da80ebec80c7245e8c85043f841 (patch)
tree743db60ac9c0037192f89f75038c21308d9613e1 /drivers/scsi/lpfc/lpfc_sli.c
parenta79b03222712e99e6895c3b86f2ebd772b86bfc1 (diff)
lpfc: Add iotag memory barrier
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>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_sli.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 6bb51f8e3c1b..393662c24df5 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)
265 return NULL; 265 return NULL;
266 266
267 q->hba_index = idx; 267 q->hba_index = idx;
268
269 /*
270 * insert barrier for instruction interlock : data from the hardware
271 * must have the valid bit checked before it can be copied and acted
272 * upon. Given what was seen in lpfc_sli4_cq_get() of speculative
273 * instructions allowing action on content before valid bit checked,
274 * add barrier here as well. May not be needed as "content" is a
275 * single 32-bit entity here (vs multi word structure for cq's).
276 */
277 mb();
268 return eqe; 278 return eqe;
269} 279}
270 280
@@ -370,6 +380,17 @@ lpfc_sli4_cq_get(struct lpfc_queue *q)
370 380
371 cqe = q->qe[q->hba_index].cqe; 381 cqe = q->qe[q->hba_index].cqe;
372 q->hba_index = idx; 382 q->hba_index = idx;
383
384 /*
385 * insert barrier for instruction interlock : data from the hardware
386 * must have the valid bit checked before it can be copied and acted
387 * upon. Speculative instructions were allowing a bcopy at the start
388 * of lpfc_sli4_fp_handle_wcqe(), which is called immediately
389 * after our return, to copy data before the valid bit check above
390 * was done. As such, some of the copied data was stale. The barrier
391 * ensures the check is before any data is copied.
392 */
393 mb();
373 return cqe; 394 return cqe;
374} 395}
375 396