scsi: ibmvscsi: add write memory barrier to CRQ processing
authorTyrel Datwyler <tyreld@linux.vnet.ibm.com>
Wed, 7 Dec 2016 23:31:26 +0000 (17:31 -0600)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 8 Dec 2016 22:04:25 +0000 (17:04 -0500)
The first byte of each CRQ entry is used to indicate whether an entry is
a valid response or free for the VIOS to use. After processing a
response the driver sets the valid byte to zero to indicate the entry is
now free to be reused. Add a memory barrier after this write to ensure
no other stores are reordered when updating the valid byte.

Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Reviewed-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ibmvscsi/ibmvscsi.c

index 7752656c3d2151b634a89d186846dd8dc4bd3225..50cd01165e355b092fb954d2399f42798d5e3e00 100644 (file)
@@ -233,6 +233,7 @@ static void ibmvscsi_task(void *data)
                while ((crq = crq_queue_next_crq(&hostdata->queue)) != NULL) {
                        ibmvscsi_handle_crq(crq, hostdata);
                        crq->valid = VIOSRP_CRQ_FREE;
+                       wmb();
                }
 
                vio_enable_interrupts(vdev);
@@ -241,6 +242,7 @@ static void ibmvscsi_task(void *data)
                        vio_disable_interrupts(vdev);
                        ibmvscsi_handle_crq(crq, hostdata);
                        crq->valid = VIOSRP_CRQ_FREE;
+                       wmb();
                } else {
                        done = 1;
                }