Skip to content

block: unify elevator changing and fix lockdep warning

Ming Lei linux-block 5 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest25 patches 16 repliesApplied
  2. v424 patches 26 repliesSuperseded
  3. v320 patches 49 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v220 patches51 repliesSuperseded
v115 patches40 repliesSuperseded

Changes in v5 from the cover letter

- replace down_read_nested() with down_read(), by adding helper of add_disk_final()

- fix race between elv_iosched_store and __del_gendisk (Nilay Shoff)

- improve elv_update_nr_hw_queues() (Christoph)

Patches in v5 Applied

#Subject and filesSizeRepliesApplied
1/25block: move blk_mq_add_queue_tag_set() after blk_mq_map_swqueue()block/blk-mq.c+1 -10 replies
2/25block: move ELEVATOR_FLAG_DISABLE_WBT a request queue flagblock/bfq-iosched.c block/blk-mq-debugfs.c block/blk-wbt.c +2 more+7 -50 replies
3/25block: don't call freeze queue in elevator_switch() and elevator_disable()block/elevator.c+2 -70 replies
4/25block: use q->elevator with ->elevator_lock held in elv_iosched_show()block/elevator.c+1 -20 replies
5/25block: add two helpers for registering/un-registering sched debugfsblock/blk-mq-sched.c+30 -150 replies
6/25block: move sched debugfs register into elvevator_register_queueblock/blk-mq-debugfs.c block/blk-mq-sched.c block/elevator.c +1 more+13 -200 replies
7/25block: add helper add_disk_final()block/genhd.c+27 -193 replies
8/25block: prevent adding/deleting disk during updating nr_hw_queuesblock/blk-mq.c block/genhd.c include/linux/blk-mq.h+86 -340 replies
9/25block: don't allow to switch elevator if updating nr_hw_queues is in-progressblock/elevator.c+3 -02 replies
10/25block: look up the elevator type in elevator_switchblock/blk-mq.c block/blk.h block/elevator.c+10 -120 replies
11/25block: fold elevator_disable into elevator_switchblock/elevator.c+23 -380 replies
12/25block: move blk_queue_registered() check into elv_iosched_store()block/elevator.c+4 -42 replies
13/25block: simplify elevator reattachment for updating nr_hw_queuesblock/blk-mq.c block/blk.h block/elevator.c+21 -920 replies
14/25block: move queue freezing & elevator_lock into elevator_change()block/elevator.c+12 -80 replies
15/25block: add `struct elv_change_ctx` for unifying elevator changeblock/elevator.c+23 -161 reply
16/25block: unifying elevator changeblock/blk-sysfs.c block/blk.h block/elevator.c +1 more+67 -1010 replies
17/25block: pass elevator_queue to elv_register_queue & unregister_queueblock/elevator.c+7 -70 replies
18/25block: remove elevator queue's type check in elv_attr_show/store()block/elevator.c+2 -20 replies
19/25block: fail to show/store elevator sysfs attribute if elevator is dyingblock/blk-mq-sched.c block/elevator.c block/elevator.h+8 -41 reply
20/25block: add new helper for disabling elevator switch when deleting diskblock/blk-mq-debugfs.c block/elevator.c block/genhd.c +1 more+27 -31 reply
21/25block: move elv_register[unregister]_queue out of elevator_lockblock/blk-mq.c block/elevator.c+53 -182 replies
22/25block: move hctx debugfs/sysfs registering out of freezing queueblock/blk-mq.c+7 -80 replies
23/25block: don't acquire ->elevator_lock in blk_mq_map_swqueue and blk_mq_realloc_hw_ctxsblock/blk-mq.c+4 -151 reply
24/25block: move hctx cpuhp add/del out of queue freezingblock/blk-mq.c+4 -11 reply
25/25block: move wbt_enable_default() out of queue freezing from sched ->exit()block/bfq-iosched.c block/blk-sysfs.c block/blk-wbt.c +4 more+20 -71 reply

Reviews trailers per patch

All 25 patches have a Reviewed-by or Acked-by.

PatchNilay ShroffChristoph HellwigHannes ReineckeYu Kuai
1/25R-b R-b R-b
2/25R-b R-b R-b
3/25R-b R-b R-b
4/25R-b R-b R-b
5/25R-b R-b R-b R-b
6/25R-b R-b R-b R-b
7/25R-b R-b R-b
8/25R-b R-b R-b
9/25R-b R-b R-b
10/25R-b R-b
11/25R-b R-b
12/25R-b R-b R-b
13/25R-b R-b R-b
14/25R-b R-b R-b
15/25R-b R-b R-b
16/25R-b R-b R-b
17/25R-b R-b R-b
18/25R-b R-b R-b
19/25R-b R-b R-b
20/25R-b R-b R-b
21/25R-b R-b R-b
22/25R-b R-b
23/25R-b R-b R-b
24/25R-b R-b R-b
25/25R-b R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v5 thread

Cover letter [PATCH V5 00/25] block: unify elevator changing and fix lockdep warning

Hello Jens,

This patchset cleans up elevator change code, and unifying it via single helper, meantime moves kobject_add/del & debugfs register/unregister out of queue freezing & elevator_lock. This way fixes many lockdep warnings reported recently, especially since fs_reclaim is connected with freeze lock manually by commit ffa1e7ada456 ("block: Make request_queue lockdep splats show up earlier").

Thanks,
Ming

V5:
- replace down_read_nested() with down_read(), by adding helper of add_disk_final()

- fix race between elv_iosched_store and __del_gendisk (Nilay Shoff)

- improve elv_update_nr_hw_queues() (Christoph)

V4:
- pull Christoph's two elevator change/switch cleanup patches first, then the following elevator change unifying is simplified a lot(Christoph)

- fold Nilay's patch into the last patch for avoiding one new lock warning on rqos_state_mutex (Nilay Shoff)

- drop patch "block: move blk_unregister_queue() & device_del() after freeze wait" which may cause MD hang during shutdown, and add new patch "block: add
new helper for disabling elevator switch when deleting disk" for dealing with one small race window (Christoph)

- add patch "block: remove elevator queue's type check in elv_attr_show/store()" (Christoph)

- rename ->update_nr_hwq_sema as ->update_nr_hwq_lock (Christoph)

- add small patch "block: move blk_queue_registered() check into elv_iosched_store()"

V3:
- replace srcu with rw_sem for avoiding race between add/del disk & elevator switch and updating nr_hw_queues (Nilay Shoff)

- add elv_update_nr_hw_queues() for elevator reattachment in case of updating nr_hw_queues, meantime keep elv_change_ctx as local structure (Christoph)

- replace ->elevator_lock with disk->rqos_state_mutex for covering wbt state change

- add new patch "block: use q->elevator with ->elevator_lock held in elv_iosched_show()"

- small cleanup & commit log improvement

V2:
- retry add/del disk when blk_mq_update_nr_hw_queues() is in-progress

- swap blk_mq_add_queue_tag_set() with blk_mq_map_swqueue() in blk_mq_init_allocated_queue() (Nilay Shroff)

- move ELEVATOR_FLAG_DISABLE_WBT to request queue's flags (Nilay Shoff)

- fix race because of delaying elevator unregister

- define flags of elv_change_ctx as bool (Christoph)

- improve comment and commit log (Christoph)

Christoph Hellwig (2):
block: look up the elevator type in elevator_switch
block: fold elevator_disable into elevator_switch

Ming Lei (23):
block: move blk_mq_add_queue_tag_set() after blk_mq_map_swqueue()
block: move ELEVATOR_FLAG_DISABLE_WBT a request queue flag
block: don't call freeze queue in elevator_switch() and
elevator_disable()
block: use q->elevator with ->elevator_lock held in elv_iosched_show()
block: add two helpers for registering/un-registering sched debugfs
block: move sched debugfs register into elvevator_register_queue
block: add helper add_disk_final()
block: prevent adding/deleting disk during updating nr_hw_queues
block: don't allow to switch elevator if updating nr_hw_queues is
in-progress
block: move blk_queue_registered() check into elv_iosched_store()
block: simplify elevator reattachment for updating nr_hw_queues
block: move queue freezing & elevator_lock into elevator_change()
block: add struct elv_change_ctx for unifying elevator change
block: unifying elevator change
block: pass elevator_queue to elv_register_queue & unregister_queue
block: remove elevator queue's type check in elv_attr_show/store()
block: fail to show/store elevator sysfs attribute if elevator is
dying
block: add new helper for disabling elevator switch when deleting disk
block: move elv_register[unregister]_queue out of elevator_lock
block: move hctx debugfs/sysfs registering out of freezing queue
block: don't acquire ->elevator_lock in blk_mq_map_swqueue and
blk_mq_realloc_hw_ctxs
block: move hctx cpuhp add/del out of queue freezing
block: move wbt_enable_default() out of queue freezing from sched

    ->exit()
 block/bfq-iosched.c    |   6 +-
 block/blk-mq-debugfs.c |  13 +-
 block/blk-mq-sched.c   |  41 +++--
 block/blk-mq.c         | 132 +++--------------
 block/blk-sysfs.c      |  29 ++--
 block/blk-wbt.c        |   9 +-
 block/blk.h            |   8 +-
 block/elevator.c       | 329 ++++++++++++++++++++++++-----------------
 block/elevator.h       |   6 +-
 block/genhd.c          | 197 +++++++++++++++---------
 include/linux/blk-mq.h |   3 +
 include/linux/blkdev.h |   8 +
 12 files changed, 402 insertions(+), 379 deletions(-)
Signature · 1 line
2.47.0