Skip to content

blk-mq: Implement runtime power management

Bart Van Assche linux-block 6 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest12 patches 13 repliesIn review
  2. v59 patches 11 repliesSuperseded
  3. v410 patches 16 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v39 patches13 repliesSuperseded
v25 patches12 repliesSuperseded
v13 patches6 repliesSuperseded

Changes in v6 from the cover letter

- Introduced a new flag RQF_DV that replaces RQF_PREEMPT for SCSI domain validation.
- Introduced a new request queue state QUEUE_FLAG_DV_ONLY for SCSI domain validation.
- Instead of using SDEV_QUIESCE for both runtime suspend and SCSI domain validation, use that state for domain validation only and introduce a new state for runtime suspend, namely SDEV_QUIESCE.
- Reallow system suspend during SCSI domain validation.
- Moved the runtime resume call from the request allocation code into blk_queue_enter().
- Instead of relying on q_usage_counter, iterate over the tag set to determine whether or not any requests are in flight.

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12block, scsi: Introduce request flag RQF_DVblock/blk-core.c block/blk-mq-debugfs.c block/blk-mq.c +4 more+23 -160 replies
2/12scsi: Alter handling of RQF_DV requestsdrivers/scsi/scsi_lib.c+36 -422 replies
3/12scsi: Only set RQF_DV for requests used for domain validationdrivers/scsi/scsi_lib.c drivers/scsi/scsi_transport_spi.c include/scsi/scsi_device.h +1 more+8 -90 replies
4/12scsi: Introduce the SDEV_SUSPENDED device statusdrivers/scsi/scsi_lib.c drivers/scsi/scsi_pm.c drivers/scsi/scsi_sysfs.c +2 more+125 -350 replies
5/12block, scsi: Rename QUEUE_FLAG_PREEMPT_ONLY into DV_ONLY and introduce PM_ONLYblock/blk-core.c block/blk-mq-debugfs.c drivers/scsi/scsi_lib.c +1 more+66 -312 replies
6/12scsi: Reallow SPI domain validation during system suspenddrivers/scsi/scsi_lib.c drivers/scsi/scsi_sysfs.c drivers/scsi/scsi_transport_spi.c +1 more+39 -150 replies
7/12block: Move power management code into a new source fileblock/Kconfig block/Makefile block/blk-core.c +8 more+266 -2390 replies
8/12block, scsi: Introduce blk_pm_runtime_exit()block/blk-pm.c drivers/scsi/sd.c drivers/scsi/sr.c +1 more+26 -65 replies
9/12block: Split blk_pm_add_request() and blk_pm_put_request()block/blk-core.c block/blk-pm.h block/elevator.c+33 -50 replies
10/12block: Change the runtime power management approach (1/2)block/blk-core.c block/blk-mq.c block/elevator.c+4 -12 replies
11/12block: Change the runtime power management approach (2/2)block/blk-core.c block/blk-pm.c+75 -342 replies
12/12blk-mq: Enable support for runtime power managementblock/blk-pm.c+0 -60 replies

Reviews trailers per patch

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

Read the v6 thread

Cover letter [PATCH v6 00/12] blk-mq: Implement runtime power management

Hello Jens,

This patch series not only implements runtime power management for blk-mq but also fixes a starvation issue in the power management code for the legacy block layer. Please consider this patch series for the upstream kernel.

Thanks,

Bart.

Changes compared to v5:
- Introduced a new flag RQF_DV that replaces RQF_PREEMPT for SCSI domain validation.
- Introduced a new request queue state QUEUE_FLAG_DV_ONLY for SCSI domain validation.
- Instead of using SDEV_QUIESCE for both runtime suspend and SCSI domain validation, use that state for domain validation only and introduce a new state for runtime suspend, namely SDEV_QUIESCE.
- Reallow system suspend during SCSI domain validation.
- Moved the runtime resume call from the request allocation code into blk_queue_enter().
- Instead of relying on q_usage_counter, iterate over the tag set to determine whether or not any requests are in flight.

Changes compared to v4:
- Dropped the patches "Give RQF_PREEMPT back its original meaning" and "Serialize queue freezing and blk_pre_runtime_suspend()".
- Replaced "percpu_ref_read()" with "percpu_is_in_use()".
- Inserted pm_request_resume() calls in the block layer request allocation code such that the context that submits a request no longer has to call pm_runtime_get().

Changes compared to v3:
- Avoid adverse interactions between system-wide suspend/resume and runtime power management by changing the PREEMPT_ONLY flag into a counter.
- Give RQF_PREEMPT back its original meaning, namely that it is only set for ide_preempt requests.
- Remove the flag BLK_MQ_REQ_PREEMPT.
- Removed the pm_request_resume() call.

Changes compared to v2:
- Fixed the build for CONFIG_BLOCK=n.
- Added a patch that introduces percpu_ref_read() in the percpu-counter code.
- Added a patch that makes it easier to detect missing pm_runtime_get*() calls.
- Addressed Jianchao's feedback including the comment about runtime overhead of switching a per-cpu counter to atomic mode.

Changes compared to v1:
- Moved the runtime power management code into a separate file.
- Addressed Ming's feedback.

Bart Van Assche (12):
block, scsi: Introduce request flag RQF_DV
scsi: Alter handling of RQF_DV requests
scsi: Only set RQF_DV for requests used for domain validation
scsi: Introduce the SDEV_SUSPENDED device status
block, scsi: Rename QUEUE_FLAG_PREEMPT_ONLY into DV_ONLY and introduce
PM_ONLY
scsi: Reallow SPI domain validation during system suspend
block: Move power management code into a new source file block, scsi: Introduce blk_pm_runtime_exit()
block: Split blk_pm_add_request() and blk_pm_put_request()
block: Change the runtime power management approach (1/2)
block: Change the runtime power management approach (2/2)
blk-mq: Enable support for runtime power management

 block/Kconfig                     |   5 +
 block/Makefile                    |   1 +
 block/blk-core.c                  | 310 ++++++------------------------
 block/blk-mq-debugfs.c            |   4 +-
 block/blk-mq.c                    |   4 +-
 block/blk-pm.c                    | 262 +++++++++++++++++++++++++
 block/blk-pm.h                    |  69 +++++++
 block/elevator.c                  |  22 +--
 drivers/ide/ide-pm.c              |   3 +-
 drivers/scsi/scsi_lib.c           | 266 ++++++++++++++++++-------
 drivers/scsi/scsi_pm.c            |   7 +-
 drivers/scsi/scsi_sysfs.c         |   2 +
 drivers/scsi/scsi_transport_spi.c |  26 +--
 drivers/scsi/sd.c                 |  10 +-
 drivers/scsi/sr.c                 |   4 +-
 include/linux/blk-mq.h            |   6 +-
 include/linux/blk-pm.h            |  26 +++
 include/linux/blkdev.h            |  41 ++--
 include/scsi/scsi_device.h        |  15 +-
 include/scsi/scsi_transport_spi.h |   1 -
 20 files changed, 673 insertions(+), 411 deletions(-)
 create mode 100644 block/blk-pm.c
 create mode 100644 block/blk-pm.h
 create mode 100644 include/linux/blk-pm.h
Signature · 1 line
2.18.0