Zhang Chen <[email protected]> writes:

> On Tue, Feb 24, 2026 at 4:42 PM Markus Armbruster <[email protected]> wrote:
>>
>> Zhang Chen <[email protected]> writes:
>>
>> > On Tue, Feb 17, 2026 at 3:51 PM Markus Armbruster <[email protected]> 
>> > wrote:
>> >>
>> >> Zhang Chen <[email protected]> writes:
>> >>
>> >> > Extend the 'IOThreadInfo' structure to include attachment metrics.
>> >> > This allows users to monitor how many devices are associated with
>> >> > a specific IOThread and identify them by their QOM paths.
>> >> >
>> >> > New fields added to IOThreadInfo:
>> >> > - @attached-cnt: An integer representing the number of devices
>> >> >   currently using this IOThread's AioContext.
>> >> > - @attached-dev: A string containing a delimited list ("|") of
>> >> >   QOM paths for the attached devices.
>> >> >
>> >> > These fields are also exposed via the Human Monitor Interface (HMP)
>> >> > command 'info iothreads' to assist with manual debugging and
>> >> > performance tuning.
>> >> >
>> >> > Example QMP output:
>> >> > {
>> >> >     "id": "iothread0",
>> >> >     "thread-id": 3134,
>> >> >     "attached-cnt": 2,
>> >> >     "attached-dev": "/machine/peripheral/blk1/virtio-backend | 
>> >> > /machine/peripheral/blk0/virtio-backend",
>> >> >     ...
>> >> > }
>> >> >
>> >> > Signed-off-by: Zhang Chen <[email protected]>
>> >>
>> >> [...]
>> >>
>> >> > diff --git a/qapi/misc.json b/qapi/misc.json
>> >> > index 1f5062df2a..ca53638684 100644
>> >> > --- a/qapi/misc.json
>> >> > +++ b/qapi/misc.json
>> >> > @@ -76,6 +76,19 @@
>> >> >  #
>> >> >  # @thread-id: ID of the underlying host thread
>> >> >  #
>> >> > +# @attached-cnt: The parameter is a counter indicating how many
>> >> > +#     active devices are currently associated with this iothread
>> >> > +#     (e.g. virtio-blk).  In hotplug scenarios, users can
>> >> > +#     pre-allocate multiple iothread objects to serve as a persistent
>> >> > +#     thread pool.  When a device is hot-unplugged, the corresponding
>> >> > +#     IOThread is released but remains available, allowing subsequent
>> >> > +#     hot-plugged devices to attach to and reuse the existing thread.
>> >> > +#     (since 11.0)
>> >> > +#
>> >> > +# @attached-dev: A list of QOM paths for the devices currently
>> >> > +#     associated with this IOThread, delimited by " | ".
>> >> > +#     Returns "none" if no devices are attached. (since 11.0)

[...]

>> >>
>> >> QAPI schema design maxim: do not encode structured data as strings.
>> >> @attached-devs should be an array of QOM paths instead.
>> >
>> > OK, will fix in next version.
>>
>> Thanks!
>>
>> >> Unless I misunderstand your docs, @attached-cnt is the number of QOM
>> >> paths in @attached-dev, i.e. @attached-dev is redundant.  If this is the
>> >> case, drop it.  If it isn't, educate me :)
>> >
>> > As Stefan's comments, I try to address more specific needs:
>> > https://mail.gnu.org/archive/html/qemu-devel/2026-02/msg01892.html
>>
>> As far as I can tell, Stefan asked for the QOM paths of attached
>> devices.  @attached-dev provides it.  Good.  Why have @attached-cnt as
>> well?
>>
>
> Users can obtain the quantity more conveniently, avoiding the need to
> count the number of @attached-dev.
> If you think the @attached-cnt is redundant, I will remove it in next version.

Please do.

[...]


Reply via email to