scsi: hisi_sas: Fix memory ordering in hisi_sas_task_deliver()
Subsystems (2)
PATCH 1/1 scsi: hisi_sas: Fix memory ordering in hisi_sas_task_deliver()
The memories for the slot should be observed to be written prior to observing the slot as ready.
Prior to commit 26fc0ea74fcb ("scsi: libsas: Drop SAS_TASK_AT_INITIATOR"), we had a spin_lock() + spin_unlock() immediately before marking the slot as ready. The spin_unlock() - with release semantics - caused the slot memory to be observed to be written.
Now that the spin_lock() + spin_unlock() is gone, use a smp_wmb().
---
Hi Martin, Please consider for v5.18, thanks!
drivers/scsi/hisi_sas/hisi_sas_main.c +2 -0
@@ -446,6 +446,8 @@ void hisi_sas_task_deliver(struct hisi_hba *hisi_hba,return ; } +/* Make slot memories observable before marking as ready */ +smp_wmb ();WRITE_ONCE (slot->ready,1 );spin_lock (&dq->lock);
Signature · 1 line
2.26.2
Martin K. Petersen
AppliedJohn,
Quoted 2 lines
The memories for the slot should be observed to be written prior to observing the slot as ready.
Applied to 5.19/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedQuoted 9 lines · John Garry
The memories for the slot should be observed to be written prior to observing the slot as ready.
Prior to commit
26fc0ea74fcb("scsi: libsas: DropSAS_TASK_AT_INITIATOR"), we had aspin_lock()+spin_unlock()immediately before marking the slot as ready. Thespin_unlock()- with release semantics - caused the slot memory to be observed to be written.[...]
Applied to 5.19/scsi-queue, thanks!
[1/1] scsi: hisi_sas: Fix memory ordering in hisi_sas_task_deliver()
https://git.kernel.org/mkp/scsi/c/6c6ac8b7773f
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering