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

From: Bart Van Assche
Date: Sat Jun 27 2020 - 22:38:03 EST


On 2020-06-26 08:44, Alan Stern wrote:
> On Fri, Jun 26, 2020 at 08:07:51AM -0700, Bart Van Assche wrote:
>> 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 just looked at that commit for the first time.
>
> Instead of making the SCSI driver do the work of deciding what routine to
> call, why not redefine blk_set_runtime_active(q) to simply call
> blk_post_runtime_resume(q, 0)? Or vice versa: if err == 0 have
> blk_post_runtime_resume call blk_set_runtime_active?
>
> After all, the two routines do almost the same thing -- and the bug
> addressed by this commit was caused by the difference in their behaviors.
>
> If the device was already runtime-active during the system suspend, doing
> an extra clear of the pm_only counter won't hurt anything.

Hi Alan,

Do you want to submit a patch that implements this change or do you
perhaps expect me to do that?

Thanks,

Bart.