From: Zhang Chen <zhangckid@gmail.com>
To: qemu-devel <qemu-devel@nongnu.org>,
"Dr . David Alan Gilbert" <dave@treblig.org>,
Eric Blake <eblake@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
"Michael S . Tsirkin" <mst@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Kevin Wolf <kwolf@redhat.com>, Jason Wang <jasowang@redhat.com>,
Fam Zheng <fam@euphon.net>
Cc: Zhang Chen <zhangckid@gmail.com>
Subject: [PATCH V9 00/17] iothread: Support tracking and querying IOThread holders
Date: Wed, 24 Jun 2026 15:08:34 +0800 [thread overview]
Message-ID: <20260624070851.13342-1-zhangckid@gmail.com> (raw)
### Motivation
Currently, the relationship between IOThreads and the resources using them is
opaque. From a management perspective, it is difficult to determine which
devices or block exports are currently associated with a specific IOThread
via QMP or HMP.
This series introduces a "holder" tracking mechanism based on QOM paths,
block nodes or monitor to significantly improve IOThread observability.
In high-performance virtualization environments, users often pre-allocate
a set of IOThreads to serve as a persistent thread pool. During device
hotplug/unplug cycles, while IOThread objects remain persistent,
their attachment state changes dynamically.
By tracking these "holders," administrators can use `query-iothreads` to
monitor the real-time load distribution of the thread pool and identify which
specific devices (e.g., virtio-blk, BlockExport) are attached to which thread.
### Technical Overview
* Atomic API Design: Merged iothread_get_aio_context and
iothread_ref_and_get_aio_context into a single unified function. The new
API enforces a 'holder' parameter, making "retrieval" and "tracking" an
atomic operation to prevent reference tracking leaks.
* Subsystem Integration: Fully migrated and adapted core modules including
Virtio (blk, vq-mapping, balloon, scsi), Block Layer (export, xen),
Network (COLO), VFIO, and the Monitor subsystem.
* Introspection: Expanded the IOThreadInfo QAPI structure to include a
'holders' array (list of QOM paths), accessible via both
query-iothreads (QMP) and info iothreads (HMP).
### V9 -> V8 Changelog
- Drop to assign unique default ID for monitor, and keep the NULL ID.
- Rewrite and split the monitor patch 7 and 8.
- Add the [PATCH 17/17]tests/unit/iothread: Update the iothread_get_aio_context
to keep the API same in the unit tests.
- Refactorcode according comments.
- Update the example.
- Fix other comments issues.
### V7 -> V8 Changelog
- Drop the assumption of the Monitor QOM, add the new type
IO_THREAD_HOLDER_KIND_MONITOR_NAME.
- Drop the assumption of the string '/' as QOM path.
- Introduce new patch for Monitor:
[PATCH 06/15] assign unique default ID to anonymous monitors
- Fixed Monitor ID for the IOThread.
- Refactorcode according comments.
- Update QMP example.
- Rebased patches on upstream code.
- Fixed comments issues.
- Removed redundant code.
### V6 -> V7 Changelog
- Fixed comments issues in patch 02/14 (Thanks Markus).
- Removed redundant code.
- Rebased patches on upstream code.
- Fixed code conflict with latest patches.
- Added detailed description in git log and code.
- Added comments for patch 06/14 assuming the monitor is a QOM object,
Depends on Daniel Berrange's RFC patch:
[PATCH RFC 00/17] monitor: turn QMP and HMP into QOM objects
### V5 -> V6 Changelog
* API Refactoring (Breaking Change):
- Implement the 'union': 'IoThreadHolder' for combine the QOM objects
and the block-node.
- Completely merged iothread_get_aio_context variants.
- The iothread_get_aio_context function now strictly requires a 'holder'
argument to ensure every context retrieval is accounted for.
* Expanded Module Coverage:
- Added holder tracking for the monitor subsystem (tracking threads used
by QMP/HMP).
- Added support for the virtio-scsi dataplane.
* Code Cleanup:
- Removed redundant and obsolete API declarations.
- Standardized the use of object_get_canonical_path() across all callers
to provide consistent and unique holder names.
* Bug Fixes:
- Updated qapi/misc.json documentation to fix missing descriptions in
query-iothreads items.
* Build System:
- Improved header inclusion logic to avoid redundant declaration errors
in unit tests.
* QAPI part:
- Sorry to drop the "Acked-by: Markus Armbruster <armbru@redhat.com>",
because this version have lots of changes in the:
[PATCH V6 13/14]qapi: examine IOThread attachment status via query-iothreads
Zhang Chen (17):
qapi/misc: Fix missed query-iothreads items
iothread: introduce iothread_ref/unref to track attached devices
iothread: tracking iothread users with holder name
iothread: introduce iothread_unsafe_get_aio_context()
block/export: track IOThread reference in BlockExport
monitor: refactor monitor_data_init() to pass ID
monitor: support iothread ref/unref for anonymous monitors
monitor: switch to iothread_unsafe_get_aio_context()
virtio-vq-mapping: track iothread-vq-mapping references using device
path
virtio: use iothread_get/put_aio_context for thread pinning
net/colo: track IOThread references using path-based holder
virtio-balloon: Update tracking iothread users with holder
vfio-user/proxy: Update tracking iothread users with holder name
xen-block: Update tracking iothread users with holder name
qapi: examine IOThread attachment status via query-iothreads
iothread: simplify API by merging iothread_get_aio_context variants
tests/unit/iothread: Update the iothread_get_aio_context
block/export/export.c | 62 +++++++++--
blockdev.c | 2 +-
chardev/char.c | 2 +-
gdbstub/system.c | 3 +-
hw/block/dataplane/xen-block.c | 19 +++-
hw/block/virtio-blk.c | 22 ++--
hw/scsi/virtio-scsi-dataplane.c | 22 ++--
hw/vfio-user/proxy.c | 15 ++-
hw/virtio/iothread-vq-mapping.c | 19 +++-
hw/virtio/virtio-balloon.c | 22 +++-
include/block/export.h | 6 ++
include/hw/virtio/iothread-vq-mapping.h | 6 +-
include/monitor/monitor.h | 5 +-
include/system/iothread.h | 17 ++-
iothread.c | 136 +++++++++++++++++++++++-
monitor/hmp-cmds.c | 26 +++++
monitor/hmp.c | 5 +-
monitor/monitor-internal.h | 4 +-
monitor/monitor.c | 37 +++++--
monitor/qmp-cmds.c | 2 +-
monitor/qmp.c | 7 +-
net/colo-compare.c | 29 +++--
qapi/misc.json | 82 +++++++++++++-
stubs/monitor-internal.c | 3 +-
tests/unit/iothread.c | 16 +--
tests/unit/iothread.h | 6 +-
tests/unit/test-aio-multithread.c | 5 +-
tests/unit/test-bdrv-drain.c | 18 +++-
tests/unit/test-block-iothread.c | 21 ++--
29 files changed, 526 insertions(+), 93 deletions(-)
--
2.49.0
next reply other threads:[~2026-06-24 7:09 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-24 7:08 Zhang Chen [this message]
2026-06-24 7:08 ` [PATCH V9 01/17] qapi/misc: Fix missed query-iothreads items Zhang Chen
2026-06-24 7:08 ` [PATCH V9 02/17] iothread: introduce iothread_ref/unref to track attached devices Zhang Chen
2026-06-24 15:51 ` Stefan Hajnoczi
2026-06-24 7:08 ` [PATCH V9 03/17] iothread: tracking iothread users with holder name Zhang Chen
2026-06-24 17:10 ` Stefan Hajnoczi
2026-06-24 7:08 ` [PATCH V9 04/17] iothread: introduce iothread_unsafe_get_aio_context() Zhang Chen
2026-06-24 17:19 ` Stefan Hajnoczi
2026-06-24 7:08 ` [PATCH V9 05/17] block/export: track IOThread reference in BlockExport Zhang Chen
2026-06-24 17:51 ` Stefan Hajnoczi
2026-06-24 7:08 ` [PATCH V9 06/17] monitor: refactor monitor_data_init() to pass ID Zhang Chen
2026-06-24 7:08 ` [PATCH V9 07/17] monitor: support iothread ref/unref for anonymous monitors Zhang Chen
2026-06-24 7:08 ` [PATCH V9 08/17] monitor: switch to iothread_unsafe_get_aio_context() Zhang Chen
2026-06-24 7:08 ` [PATCH V9 09/17] virtio-vq-mapping: track iothread-vq-mapping references using device path Zhang Chen
2026-06-24 7:08 ` [PATCH V9 10/17] virtio: use iothread_get/put_aio_context for thread pinning Zhang Chen
2026-06-24 7:08 ` [PATCH V9 11/17] net/colo: track IOThread references using path-based holder Zhang Chen
2026-06-24 7:08 ` [PATCH V9 12/17] virtio-balloon: Update tracking iothread users with holder Zhang Chen
2026-06-24 7:08 ` [PATCH V9 13/17] vfio-user/proxy: Update tracking iothread users with holder name Zhang Chen
2026-06-24 7:08 ` [PATCH V9 14/17] xen-block: " Zhang Chen
2026-06-24 7:08 ` [PATCH V9 15/17] qapi: examine IOThread attachment status via query-iothreads Zhang Chen
2026-06-24 7:08 ` [PATCH V9 16/17] iothread: simplify API by merging iothread_get_aio_context variants Zhang Chen
2026-06-24 7:08 ` [PATCH V9 17/17] tests/unit/iothread: Update the iothread_get_aio_context Zhang Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260624070851.13342-1-zhangckid@gmail.com \
--to=zhangckid@gmail.com \
--cc=armbru@redhat.com \
--cc=dave@treblig.org \
--cc=eblake@redhat.com \
--cc=fam@euphon.net \
--cc=jasowang@redhat.com \
--cc=kwolf@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.