]> asedeno.scripts.mit.edu Git - linux.git/commit
scsi: hisi_sas: add memory barrier in task delivery function
authorXiaofei Tan <tanxiaofei@huawei.com>
Wed, 18 Jul 2018 14:14:32 +0000 (22:14 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 20 Jul 2018 01:57:40 +0000 (21:57 -0400)
commit1c09b663168bb5fd8562234976b76115f2aebe91
tree30bf000df9f25ff678abbe32a6569ea07f0c8e0a
parent6cca51ee0aa2540d648ff8698c3889330d897f27
scsi: hisi_sas: add memory barrier in task delivery function

In task start delivery function, we need to add a memory barrier to prevent
re-ordering of reading memory by hardware. Because the slot data is set in
task prepare function and it could be running in another CPU.

This patch adds an memory barrier after s->ready is read in the task start
delivery function, and uses WRITE_ONCE() in the places where s->ready is
set to ensure that the compiler does not re-order.

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/hisi_sas/hisi_sas_main.c
drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c