Skip to content

Commit 5cb37a2

Browse files
ahunter6martinkpetersen
authored andcommitted
scsi: ufs: core: Fix another task management completion race
hba->outstanding_tasks, which is read under host_lock spinlock, tells the interrupt handler what task management tags are in use by the driver. The doorbell register bits indicate which tags are in use by the hardware. A doorbell bit that is 0 is because the bit has yet to be set by the driver, or because the task is complete. It is only possible to disambiguate the 2 cases, if reading/writing the doorbell register is synchronized with reading/writing hba->outstanding_tasks. For that reason, reading REG_UTP_TASK_REQ_DOOR_BELL must be done under spinlock. Link: https://lore.kernel.org/r/[email protected] Fixes: f5ef336 ("scsi: ufs: core: Fix task management completion") Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Adrian Hunter <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 886fe29 commit 5cb37a2

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/scsi/ufs/ufshcd.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6453,9 +6453,8 @@ static irqreturn_t ufshcd_tmc_handler(struct ufs_hba *hba)
64536453
irqreturn_t ret = IRQ_NONE;
64546454
int tag;
64556455

6456-
pending = ufshcd_readl(hba, REG_UTP_TASK_REQ_DOOR_BELL);
6457-
64586456
spin_lock_irqsave(hba->host->host_lock, flags);
6457+
pending = ufshcd_readl(hba, REG_UTP_TASK_REQ_DOOR_BELL);
64596458
issued = hba->outstanding_tasks & ~pending;
64606459
for_each_set_bit(tag, &issued, hba->nutmrs) {
64616460
struct request *req = hba->tmf_rqs[tag];

0 commit comments

Comments
 (0)