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 making sure > there isn't any in-flight requests.
Please elaborate "lots of other users". The only use I have found in 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_PREEMPT / 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 requests that are related to power management are submitted with the BLK_MQ_REQ_PREEMPT flag set. I don't think that all __scsi_execute() callers need that flag. > But now PREEMPT_ONLY opens one door for preempt-req during the big > window, so this way may break current uses of blk_freeze_queue(). The power management core serializes runtime power management against suspend, resume and hibernation so I think it is safe to use the PREEMPT_ONLY flag for runtime power management although it is already used for suspend, resume and hibernation. Bart.
