Zhang Chen <[email protected]> writes:

> On Mon, Aug 24, 2026 at 3:24 PM Markus Armbruster <[email protected]> wrote:
>>

[...]

>> Back to what got us there.  My attempt to test query-iothreads showing
>> holders failed, because monitors are not usable for this test.  Please
>> show me how to test this.  Ideally, a simple command line and a few
>> simple monitor commands ending with a query-iothreads that shows
>> holders.
>>
>
> Thanks. Here is a reproducer that also exercises holder removal and
> registration by another device type:
>
> $ qemu-system-x86_64 \
>     -S -nodefaults -display none \
>     -object iothread,id=iothread0 \
>     -blockdev driver=null-co,node-name=null0 \
>     -qmp stdio
>
> First, hotplug a virtio-scsi device and query the IOThread:
> {"execute":"qmp_capabilities"}
> {"execute":"query-iothreads"}
>
> {"return": [{"poll-shrink": 2, "thread-id": 4002255, "poll-weight": 3,
> "aio-max-batch": 0, "poll-grow": 2, "holders": [], "poll-max-ns":
> 32768, "id": "iothread0"}]}
>
> {"execute":"device_add","arguments":{"driver":"virtio-scsi-pci","id":"scsi0","iothread":"iothread0"}}
> {"execute":"query-iothreads"}
>
> {"return": [{"poll-shrink": 2, "thread-id": 4002255, "poll-weight": 3,
> "aio-max-batch": 0, "poll-grow": 2, "holders": [{"qom-path":
> "/machine/peripheral/scsi0/virtio-backend", "type": "qom-object"}],
> "poll-max-ns": 32768, "id": "iothread0"}]}
>
>  The result contains:
>   > "holders": [
>
> Remove the device:
>
> {"execute":"device_del","arguments":{"id":"scsi0"}}
> {"return": {}}
>
> {"execute":"query-iothreads"}
> {"return": [{"poll-shrink": 2, "thread-id": 4002255, "poll-weight": 3,
> "aio-max-batch": 0, "poll-grow": 2, "holders": [], "poll-max-ns":
> 32768, "id": "iothread0"}]}
>
> And use the HMP is the same logic, just need change the "-qmp" to "-monitor":
> $ qemu-system-x86_64 \
>     -S -nodefaults -display none \
>     -object iothread,id=iothread0 \
>     -blockdev driver=null-co,node-name=null0 \
>     -monitor stdio
>
> (qemu) info iothreads
> iothread0:
>   thread_id=4005900
>   holders=
>   poll-max-ns=32768
>   poll-grow=2
>   poll-shrink=2
>   poll-weight=3
>   aio-max-batch=0
>
> .......

This serves nicely, thanks!

[...]


Reply via email to