Re: [PATCH] scsi: sd: add runtime pm to open / release

Bart Van Assche
2020-06-26T15:07:58Z

On 2020-06-25 01:16, Martin Kepplinger wrote:
> here's roughly what happens when enabling runtime PM in sysfs (again,
> because sd_probe() calls autopm_put() and thus allows it:
>
> [ 27.384446] sd 0:0:0:0: scsi_runtime_suspend
> [ 27.432282] blk_pre_runtime_suspend
> [ 27.435783] sd_suspend_common
> [ 27.438782] blk_post_runtime_suspend
> [ 27.442427] scsi target0:0:0: scsi_runtime_suspend
> [ 27.447303] scsi host0: scsi_runtime_suspend
>
> then I "mount /dev/sda1 /mnt" and none of the resume() functions get
> called. To me it looks like the sd driver should initiate resuming, and
> that's not implemented.
>
> what am I doing wrong or overlooking? how exactly does (or should) the
> block layer initiate resume here?

As far as I know runtime power management support in the sd driver is working
fine and is being used intensively by the UFS driver. The following commit was
submitted to fix a bug encountered by an UFS developer: 05d18ae1cc8a ("scsi:
pm: Balance pm_only counter of request queue during system resume") # v5.7.
I'm not sure which bug is causing trouble on your setup but I think it's likely
that the root cause is somewhere else than in the block layer, the SCSI core
or the SCSI sd driver.

Bart.