Re: [PATCH] scsi: ufs: Allow async suspend/resume callbacks

From: Bart Van Assche
Date: Fri Jul 30 2021 - 12:05:13 EST


On 7/28/21 11:48 PM, Avri Altman wrote:
Vincent wrote:
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index b87ff68aa9aa..9ec5c308a0ea 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -9625,6 +9625,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem
*mmio_base, unsigned int irq)
async_schedule(ufshcd_async_scan, hba);
ufs_sysfs_add_nodes(hba->dev);

+ device_enable_async_suspend(dev);
return 0;
Isn't device_enable_async_suspend is being called for each lun in scsi_sysfs_add_sdev Anyway?

Hi Avri,

Our measurements have shown that resume takes longer than it should with encryption enabled. While suspending we change the power mode of the UFS device to a mode in which it loses crypto keys. Restoring crypto keys during resume (blk_ksm_reprogram_all_keys()) takes about 31 ms. This is the long pole and takes much more time than resuming LUNs. This patch makes UFS resume happen concurrently with resuming other devices in the system instead of serializing it. Measurements have shown that this patch significantly improves the time needed to resume an Android device.

Bart.