Skip to content

blk-mq: fix race conditions on cpu hotplug handling

Akinobu Mita lkml 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest7 patches 17 repliesIn review
  2. v37 patches 9 repliesSuperseded
  3. v26 patches 10 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v14 patches16 repliesSuperseded

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7blk-mq: avoid setting hctx->tags->cpumask before allocationblock/blk-mq.c+8 -11 reply
2/7blk-mq: fix sysfs registration/unregistration raceblock/blk-mq-sysfs.c block/blk-mq.c include/linux/blk-mq.h +1 more+27 -121 reply
3/7blk-mq: Fix use after of free q->mq_mapblock/blk-mq.c+3 -53 replies
4/7blk-mq: fix q->mq_usage_counter access raceblock/blk-mq.c+4 -31 reply
5/7blk-mq: avoid inserting requests before establishing new mappingblock/blk-mq-cpumap.c block/blk-mq.c block/blk-mq.h+52 -191 reply
6/7blk-mq: fix freeze queue raceblock/blk-core.c block/blk-mq-sysfs.c block/blk-mq.c +1 more+17 -08 replies
7/7blk-mq: fix deadlock when reading cpu_listblock/blk-mq-sysfs.c block/blk-mq.c+7 -41 reply

Reviews trailers per patch

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

PatchMing LeiTejun HeoChristoph Hellwig
1/7R-b
2/7R-b R-b
3/7R-b R-b
4/7R-b R-b
5/7R-b R-b
6/7R-b A-b
7/7R-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 3 reviewers.

Read the v4 thread

Cover letter [PATCH v4 0/7] blk-mq: fix race conditions on cpu hotplug handling

This patchset addresses several race conditions on cpu hotplug handling for blk-mq. All problems can be reproducible by the following script.

while true; do
echo 0 > /sys/devices/system/cpu/cpu1/online echo 1 > /sys/devices/system/cpu/cpu1/online
done &

while true; do
modprobe -r null_blk
modprobe null_blk queue_mode=2 irqmode=1
sleep 0.1
done

* Changes from v3
- Rebased to the latest kernel
- Add Reviewed-by tags

* Changes from v2
- Add regression fix for hctx->tags->cpumask
- Remove BLK_MQ_F_SYSFS_UP per-hctx flag and use mq_sysfs_init_done per-queue flag instead with appropriate locking in order to keep track of 'mq' sysfs entry's life
- Add comments on non-trivial stuffs, suggested by Ming

* Changes from v1
- Release q->mq_map in blk_mq_release()
- Fix deadlock when reading cpu_list
- Fix race freeze and unfreeze

Akinobu Mita (7):
blk-mq: avoid setting hctx->tags->cpumask before allocation
blk-mq: fix sysfs registration/unregistration race
blk-mq: Fix use after of free q->mq_map
blk-mq: fix q->mq_usage_counter access race
blk-mq: avoid inserting requests before establishing new mapping
blk-mq: fix freeze queue race
blk-mq: fix deadlock when reading cpu_list

 block/blk-core.c       |   1 +
 block/blk-mq-cpumap.c  |   9 +++--
 block/blk-mq-sysfs.c   |  36 ++++++++++++------
 block/blk-mq.c         | 100 +++++++++++++++++++++++++++++++++++++------------
 block/blk-mq.h         |   3 +-
 include/linux/blk-mq.h |   1 -
 include/linux/blkdev.h |   8 ++++
 7 files changed, 116 insertions(+), 42 deletions(-)
Cc Jens Axboe <[email protected]>
Cc Ming Lei <[email protected]>
Cc Tejun Heo <[email protected]>
Cc Keith Busch <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Wanpeng Li <[email protected]>
Signature · 1 line
1.9.1