Skip to content

RFC blk-mq: support runtime PM

Ming Lei linux-block 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 RFC Latest3 patches 30 repliesIn review
  2. v1 RFC4 patches 18 repliesSuperseded

Changes in v2 from the cover letter

- re-organize code as suggested by Christoph
- use seqlock to sync runtime PM and IO path

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3block: put runtime PM code into common helpersblock/blk-core.c+48 -231 reply
2/3blk-mq: prepare for supporting runtime PMblock/blk-core.c block/blk-mq.c block/blk-mq.h +2 more+186 -182 replies
3/3scsi_mq: enable runtime PMdrivers/scsi/scsi_lib.c+2 -121 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH RFC V2 0/3] blk-mq: support runtime PM

Hi Guys,

Runtime PM is usually enabled for SCSI devices, and we are switching to SCSI_MQ recently, but runtime PM isn't supported yet by blk-mq, and people may complain that.

This patch tries to support runtime PM for blk-mq. And one chanllenge is that it can be quite expensive to account the active in-flight IOs for figuring out when to mark the last busy. This patch simply marks busy after each non-PM IO is done, and this way is workable because:

1) pm_runtime_mark_last_busy() is very cheap

2) in-flight non-PM IO is checked in blk_pre_runtime_suspend(), so if there is any IO queued, the device will be prevented from being suspened.

3) Generally speaking, autosuspend_delay_ms is often big, and should be in unit of second, so it shouldn't be a big deal to check if queue is idle in blk_pre_runtime_suspend().

V2:
- re-organize code as suggested by Christoph
- use seqlock to sync runtime PM and IO path

Ming Lei (3):
block: put runtime PM code into common helpers
blk-mq: prepare for supporting runtime PM
scsi_mq: enable runtime PM

 block/blk-core.c        | 176 +++++++++++++++++++++++++++++++++++++++---------
 block/blk-mq.c          |  71 +++++++++++++++++++
 block/blk-mq.h          |  10 +++
 drivers/scsi/scsi_lib.c |   3 +-
 include/linux/blk-mq.h  |   1 +
 include/linux/blkdev.h  |   1 +
 6 files changed, 228 insertions(+), 34 deletions(-)
Cc "Rafael J. Wysocki" <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Bart Van Assche <[email protected]>
Cc Hannes Reinecke <[email protected]>
Cc Johannes Thumshirn <[email protected]>
Cc Adrian Hunter <[email protected]>
Cc "James E.J. Bottomley" <[email protected]>
Cc "Martin K. Petersen" <[email protected]>
Signature · 1 line
2.9.5