Patch "scsi: ufs: core: Fix another task management completion race" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    scsi: ufs: core: Fix another task management completion race

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     scsi-ufs-core-fix-another-task-management-completion.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 7fa3f5a8a4f74da9b14620fa3ef689deaef3b687
Author: Adrian Hunter <adrian.hunter@xxxxxxxxx>
Date:   Mon Nov 8 08:48:15 2021 +0200

    scsi: ufs: core: Fix another task management completion race
    
    [ Upstream commit 5cb37a26355d79ab290220677b1b57d28e99a895 ]
    
    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/20211108064815.569494-3-adrian.hunter@xxxxxxxxx
    Fixes: f5ef336fd2e4 ("scsi: ufs: core: Fix task management completion")
    Reviewed-by: Bart Van Assche <bvanassche@xxxxxxx>
    Signed-off-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>
    Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 3d0da8b3fed8a..55f2e4d6f10b7 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -6382,9 +6382,8 @@ static irqreturn_t ufshcd_tmc_handler(struct ufs_hba *hba)
 	irqreturn_t ret = IRQ_NONE;
 	int tag;
 
-	pending = ufshcd_readl(hba, REG_UTP_TASK_REQ_DOOR_BELL);
-
 	spin_lock_irqsave(hba->host->host_lock, flags);
+	pending = ufshcd_readl(hba, REG_UTP_TASK_REQ_DOOR_BELL);
 	issued = hba->outstanding_tasks & ~pending;
 	for_each_set_bit(tag, &issued, hba->nutmrs) {
 		struct request *req = hba->tmf_rqs[tag];



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux