[PATCH RFC v1 0/1] scsi: pm: Leave runtime resume along if block layer PM is enabled

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

 



In current UFS driver, if the hba device is in RPM_SUSPENDED status when system suspend
happens, UFS driver chooses not to resume hba device during system resume [1], which is
to achieve power efficiency by leaving the runtime PM to block layer PM.

Similarly, if block layer runtime PM is enabled for one SCSI device, then there is no
need to forcibly change the SCSI device and its request queue's runtime PM status to
RPM_ACTIVE in scsi_dev_type_resume(), since block layer PM shall resume the SCSI device
on the demand of bios.

Without this change, if situation [1] happens, when scsi_dev_type_resume() invokes
blk_pm_set_active(), we will get an error since it is trying to set the SCSI device's
runtime PM status to RPM_ACTIVE even when its parent is not RPM_ACTIVE, which actually
is not fatal. This change can avoid the annoying error logs when situation [1] happens.

However, there are some rare cases where upper layers start to submit bios into the
request queue of one SCSI device even when scsi_dev_type_resume() is still running on
that SCSI device. In these rare cases, if situation [1] happens, when a bio is sent to
block layer, block layer runtime PM shall try to runtime resume the SCSI device
(invoked from blk_queue_enter()) and if meanwhile scsi_dev_type_resume() has ran over
line #83 but before #85 (see below code snippet), block layer runtime PM won't be able
to resume it due to runtime PM is disabled on this device at this moment. And later if
no more bios kick blk_queue_enter(), the bio will be stuck at blk_queue_enter() forever.
This change can fix the problem too.

<--code snippet-->
72 static int scsi_dev_type_resume(struct device *dev,
73 		int (*cb)(struct device *, const struct dev_pm_ops *))
74 {
...
83 		pm_runtime_disable(dev);
84 		err = pm_runtime_set_active(dev);
85 		pm_runtime_enable(dev);
...
<--code snippet-->

Can Guo (1):
  scsi: pm: Leave runtime resume along if block layer PM is enabled

 drivers/scsi/scsi_pm.c | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux