Re: [PATCH v3 5/9] block, scsi: Rework runtime power management

Bart Van Assche
2018-08-03T16:16:21Z

On Fri, 2018-08-03 at 07:50 +0800, Ming Lei wrote:
> I am not sure if using PREEMPT_ONLY can work well for runtime PM,=
there
> are lots of users which depends on blk_freeze_queue() for mak=
ing sure
> there isn't any in-flight requests.

Please elaborate "lots of other users". The only use I have found i=
n the
kernel tree of that flag of which I think that it is not related to power
management is in ide_prep_sense(). All other uses of the RQF_PR=
EEMPT /
BLK_MQ_REQ_PREEMPT / QUEUE_FLAG_PREEMPT_ONLY flags =
I found are IMHO related
to power management:
* generic_ide_resume()
* __scsi_execute()
* scsi_device_quiesce() / scsi_device_resume()

However, we may have to modify __scsi_execute() such that only re=
quests
that are related to power management are submitted with the
BLK_MQ_REQ_PREEMPT flag set. I don't think that all __scs=
i_execute() callers
need that flag.

> But now PREEMPT_ONLY opens one door for preempt-req during the bi=
g
> window, so this way may break current uses of blk_freeze_queu=
e().

The power management core serializes runtime power management against suspe=
nd,
resume and hibernation so I think it is safe to use the PREEMPT_ONLY fl=
ag for
runtime power management although it is already used for suspend, resume an=
d
hibernation.

Bart.