mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 14:04:54 +02:00
FROMLIST: scsi: ufs: Fix deadlock while suspending ufs host
During runtime-suspend of ufs host, the scsi devices are already suspended and so are the queues associated with them. But the ufs host sends SSU to wlun during its runtime-suspend. During the process blk_queue_enter checks if the queue is not in suspended state. If so, it waits for the queue to resume, and never comes out of it. The commit (d55d15a33: scsi: block: Do not accept any requests while suspended) adds the check if the queue is in suspended state in blk_queue_enter(). Fix this, by decoupling wlun scsi devices from block layer pm. The runtime-pm for these devices would be managed by bsg and sg drivers. Call trace: __switch_to+0x174/0x2c4 __schedule+0x478/0x764 schedule+0x9c/0xe0 blk_queue_enter+0x158/0x228 blk_mq_alloc_request+0x40/0xa4 blk_get_request+0x2c/0x70 __scsi_execute+0x60/0x1c4 ufshcd_set_dev_pwr_mode+0x124/0x1e4 ufshcd_suspend+0x208/0x83c ufshcd_runtime_suspend+0x40/0x154 ufshcd_pltfrm_runtime_suspend+0x14/0x20 pm_generic_runtime_suspend+0x28/0x3c __rpm_callback+0x80/0x2a4 rpm_suspend+0x308/0x614 rpm_idle+0x158/0x228 pm_runtime_work+0x84/0xac process_one_work+0x1f0/0x470 worker_thread+0x26c/0x4c8 kthread+0x13c/0x320 ret_from_fork+0x10/0x18 Bug: 178653131 Link: https://lore.kernel.org/linux-arm-msm/7929cc67311133f8dbdfe5e627cf6a2f1daa486e.1611719814.git.asutoshd@codeaurora.org/T/#u Change-Id: I78e49e0dd7d4d16c1d6691ea04f9aabab2ef8f43 Signed-off-by: Asutosh Das <asutoshd@codeaurora.org> Signed-off-by: Can Guo <cang@codeaurora.org> Signed-off-by: Bao D. Nguyen <nguyenb@codeaurora.org>
This commit is contained in:
parent
e48a262853
commit
e7d848c921
|
|
@ -7134,16 +7134,6 @@ static void ufshcd_set_active_icc_lvl(struct ufs_hba *hba)
|
|||
kfree(desc_buf);
|
||||
}
|
||||
|
||||
static inline void ufshcd_blk_pm_runtime_init(struct scsi_device *sdev)
|
||||
{
|
||||
scsi_autopm_get_device(sdev);
|
||||
blk_pm_runtime_init(sdev->request_queue, &sdev->sdev_gendev);
|
||||
if (sdev->rpm_autosuspend)
|
||||
pm_runtime_set_autosuspend_delay(&sdev->sdev_gendev,
|
||||
RPM_AUTOSUSPEND_DELAY_MS);
|
||||
scsi_autopm_put_device(sdev);
|
||||
}
|
||||
|
||||
/**
|
||||
* ufshcd_scsi_add_wlus - Adds required W-LUs
|
||||
* @hba: per-adapter instance
|
||||
|
|
@ -7182,7 +7172,6 @@ static int ufshcd_scsi_add_wlus(struct ufs_hba *hba)
|
|||
hba->sdev_ufs_device = NULL;
|
||||
goto out;
|
||||
}
|
||||
ufshcd_blk_pm_runtime_init(hba->sdev_ufs_device);
|
||||
scsi_device_put(hba->sdev_ufs_device);
|
||||
|
||||
hba->sdev_rpmb = __scsi_add_device(hba->host, 0, 0,
|
||||
|
|
@ -7191,17 +7180,14 @@ static int ufshcd_scsi_add_wlus(struct ufs_hba *hba)
|
|||
ret = PTR_ERR(hba->sdev_rpmb);
|
||||
goto remove_sdev_ufs_device;
|
||||
}
|
||||
ufshcd_blk_pm_runtime_init(hba->sdev_rpmb);
|
||||
scsi_device_put(hba->sdev_rpmb);
|
||||
|
||||
sdev_boot = __scsi_add_device(hba->host, 0, 0,
|
||||
ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_BOOT_WLUN), NULL);
|
||||
if (IS_ERR(sdev_boot)) {
|
||||
if (IS_ERR(sdev_boot))
|
||||
dev_err(hba->dev, "%s: BOOT WLUN not found\n", __func__);
|
||||
} else {
|
||||
ufshcd_blk_pm_runtime_init(sdev_boot);
|
||||
else
|
||||
scsi_device_put(sdev_boot);
|
||||
}
|
||||
goto out;
|
||||
|
||||
remove_sdev_ufs_device:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user