[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <lsq.1407170911.994208773@decadent.org.uk>
Date: Mon, 04 Aug 2014 17:48:31 +0100
From: Ben Hutchings <ben@...adent.org.uk>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
CC: akpm@...ux-foundation.org, "Christoph Hellwig" <hch@....de>,
"Nathan Fontenot" <nfont@...ux.vnet.ibm.com>,
"Brian King" <brking@...ux.vnet.ibm.com>
Subject: [PATCH 3.2 13/94] ibmvscsi: Add memory barriers for send / receive
3.2.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Brian King <brking@...ux.vnet.ibm.com>
commit 7114aae02742d6b5c5a0d39a41deb61d415d3717 upstream.
Add a memory barrier prior to sending a new command to the VIOS
to ensure the VIOS does not receive stale data in the command buffer.
Also add a memory barrier when processing the CRQ for completed commands.
Signed-off-by: Brian King <brking@...ux.vnet.ibm.com>
Acked-by: Nathan Fontenot <nfont@...ux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@....de>
[bwh: Backported to 3.2: as the iSeries code is still present, these
functions have different names and live in rpa_vscsi.c.]
Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
---
drivers/scsi/ibmvscsi/ibmvscsi.c | 10 ++++++++++
1 file changed, 10 insertions(+)
--- a/drivers/scsi/ibmvscsi/rpa_vscsi.c
+++ b/drivers/scsi/ibmvscsi/rpa_vscsi.c
@@ -104,6 +104,11 @@ static struct viosrp_crq *crq_queue_next
if (crq->valid & 0x80) {
if (++queue->cur == queue->size)
queue->cur = 0;
+
+ /* Ensure the read of the valid bit occurs before reading any
+ * other bits of the CRQ entry
+ */
+ rmb();
} else
crq = NULL;
spin_unlock_irqrestore(&queue->lock, flags);
@@ -122,6 +127,11 @@ static int rpavscsi_send_crq(struct ibmv
{
struct vio_dev *vdev = to_vio_dev(hostdata->dev);
+ /*
+ * Ensure the command buffer is flushed to memory before handing it
+ * over to the VIOS to prevent it from fetching any stale data.
+ */
+ mb();
return plpar_hcall_norets(H_SEND_CRQ, vdev->unit_address, word1, word2);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists