[PATCH v1 0/4] Expose blk-mq tag sets through debugfs

From: Lei Chen

Date: Thu Oct 08 2026 - 23:02:33 EST


Block debugfs provides views of request queues and hardware contexts, but
not the tag set they share. This series adds a tag set view for inspecting
configuration, CPU mappings and driver tags, with links from request queue
directories to identify queues using the same tag set.

The series first removes a stale CPU mapping comment and moves driver tag
allocation and reclamation from individual request queue initialization to
the tag set level. This gives the debugfs tag files a lifetime that can be
coordinated with tag allocation and release. It then adds tagset/<id>
directories under the debugfs root and links each request queue to its tag
set directory.

Tag reads hold a debugfs active reference only while copying tag fields to
local variables. Releasing it before copying to userspace lets tag file
removal complete even if a reader faults on its user buffer and needs I/O
to a frozen queue.

Based on Linux v7.3-rc2.

Testing on a 192-CPU x86_64 host with KASAN and lockdep enabled included:

- null_blk queue growth and shrink under concurrent direct I/O and
debugfs reads, including 100 cycles between 1 and 192 queues.
- Shared tag sets, shared tag bitmaps, three-map configurations, and
repeated device teardown and recreation with old file descriptors.
- Unmapped tag reclamation with 256 poll queues: tracing confirmed
allocation, reclamation, reallocation and reclamation again for
indices that became unmapped as the queue count changed.
- Task-local allocation fault injection, including hctx allocation
failures that rolled the hardware queue count back.
- NVMe loop with two namespaces, 50 controller resets and data-checked
direct I/O. These resets retained the same hardware queue count.
- userfaultfd-controlled stalls in tag reads: null_blk queue resizing
and NVMe loop controller deletion completed while copying to the
user buffer was blocked.

No KASAN or lockdep reports were observed in these tests. A hardware queue
count change with NVMe queues already frozen has not been tested.

Lei Chen (4):
blk-mq: remove stale comment about non-present CPU mapping
blk-mq: manage driver tags at the tag set level
block: expose blk-mq tag sets through debugfs
block: link request queue debugfs directories to tag sets

block/blk-mq-debugfs.c | 298 +++++++++++++++++++++++++++++++++++++++++
block/blk-mq-debugfs.h | 22 +++
block/blk-mq.c | 143 +++++++++++++++-----
include/linux/blk-mq.h | 13 ++
4 files changed, 445 insertions(+), 31 deletions(-)

--
2.43.0