Re: [PATCH v8 0/8] hmp, qmp: Add commands to introspect virtio devices
On 11/5/21 03:26, Markus Armbruster wrote: Daniel P. Berrangé writes: On Wed, Oct 27, 2021 at 07:41:41AM -0400, Jonah Palmer wrote: This series introduces new QMP/HMP commands to dump the status of a virtio device at different levels. [Jonah: Rebasing previous patchset from Oct. 5 (v7). Original patches are from Laurent Vivier from May 2020. Rebase from v7 to v8 includes an additional assert to make sure we're not returning NULL in virtio_id_to_name(). Rebase also includes minor additions/edits to qapi/virtio.json.] 1. Main command HMP Only: virtio [subcommand] Example: List all sub-commands: (qemu) virtio virtio query -- List all available virtio devices virtio status path -- Display status of a given virtio device virtio queue-status path queue -- Display status of a given virtio queue virtio vhost-queue-status path queue -- Display status of a given vhost queue virtio queue-element path queue [index] -- Display element of a given virtio queue I don't see a compelling reason why these are setup as sub-commands under a new "virtio" top level. This HMP approach and the QMP 'x-debug-query' naming just feels needlessly different from the current QEMU practices. IMHO they should just be "info" subcommands for HMP. ie info virtio -- List all available virtio devices info virtio-status path -- Display status of a given virtio device info virtio-queue-status path queue -- Display status of a given virtio queue info virtio-vhost-queue-status path queue -- Display status of a given vhost queue info virtio-queue-element path queue [index] -- Display element of a given virtio queue I agree with Dan (but I'm not the maintainer). I do like this format a bit better than Dave's recommendation. Feels a bit more intuitive to understand what the commands should be doing, but I'm not sure if this is just because I'm new to these things. I'd like to format it like above if that's okay. While the corresponding QMP commands ought to be x-query-virtio x-query-virtio-status x-query-virtio-queue-status x-query-virtio-vhost-queue-status x-query-virtio-queue-element I agree with Dan (and I am the maintainer). The x- is not strictly required anymore (see commit a3c45b3e62 'qapi: New special feature flag "unstable"'). I lean towards keeping it here, because we don't plan to stabilize these commands. Ok! I'll keep the 'x-' in and change them to the above. Thank you for the comments!! Jonah
Re: [PATCH v8 0/8] hmp, qmp: Add commands to introspect virtio devices
This series increases total size (text + data + bss) by 134KiB for me. QAPI clearly was not designed for space efficiency. Still, it's a drop in the bucket. If debugging commands ever become a burden for certain use cases, we can think about making them compile-time optional.
Re: [PATCH v8 0/8] hmp, qmp: Add commands to introspect virtio devices
Daniel P. Berrangé writes: > On Wed, Oct 27, 2021 at 07:41:41AM -0400, Jonah Palmer wrote: >> This series introduces new QMP/HMP commands to dump the status of a >> virtio device at different levels. >> >> [Jonah: Rebasing previous patchset from Oct. 5 (v7). Original patches >> are from Laurent Vivier from May 2020. >> >> Rebase from v7 to v8 includes an additional assert to make sure >> we're not returning NULL in virtio_id_to_name(). Rebase also >> includes minor additions/edits to qapi/virtio.json.] >> >> 1. Main command >> >> HMP Only: >> >> virtio [subcommand] >> >> Example: >> >> List all sub-commands: >> >> (qemu) virtio >> virtio query -- List all available virtio devices >> virtio status path -- Display status of a given virtio device >> virtio queue-status path queue -- Display status of a given virtio >> queue >> virtio vhost-queue-status path queue -- Display status of a given >> vhost queue >> virtio queue-element path queue [index] -- Display element of a >> given virtio queue > > I don't see a compelling reason why these are setup as sub-commands > under a new "virtio" top level. This HMP approach and the QMP 'x-debug-query' > naming just feels needlessly different from the current QEMU practices. > > IMHO they should just be "info" subcommands for HMP. ie > > info virtio -- List all available virtio devices > info virtio-status path -- Display status of a given virtio device > info virtio-queue-status path queue -- Display status of a given > virtio queue > info virtio-vhost-queue-status path queue -- Display status of a > given vhost queue > info virtio-queue-element path queue [index] -- Display element of a > given virtio queue I agree with Dan (but I'm not the maintainer). > While the corresponding QMP commands ought to be > > x-query-virtio > x-query-virtio-status > x-query-virtio-queue-status > x-query-virtio-vhost-queue-status > x-query-virtio-queue-element I agree with Dan (and I am the maintainer). The x- is not strictly required anymore (see commit a3c45b3e62 'qapi: New special feature flag "unstable"'). I lean towards keeping it here, because we don't plan to stabilize these commands.
Re: [PATCH v8 0/8] hmp, qmp: Add commands to introspect virtio devices
* Jonah Palmer (jonah.pal...@oracle.com) wrote: > > On 10/27/21 07:55, Daniel P. Berrangé wrote: > > On Wed, Oct 27, 2021 at 07:41:41AM -0400, Jonah Palmer wrote: > > > This series introduces new QMP/HMP commands to dump the status of a > > > virtio device at different levels. > > > > > > [Jonah: Rebasing previous patchset from Oct. 5 (v7). Original patches > > > are from Laurent Vivier from May 2020. > > > > > > Rebase from v7 to v8 includes an additional assert to make sure > > > we're not returning NULL in virtio_id_to_name(). Rebase also > > > includes minor additions/edits to qapi/virtio.json.] > > > > > > 1. Main command > > > > > > HMP Only: > > > > > > virtio [subcommand] > > > > > > Example: > > > > > > List all sub-commands: > > > > > > (qemu) virtio > > > virtio query -- List all available virtio devices > > > virtio status path -- Display status of a given virtio device > > > virtio queue-status path queue -- Display status of a given > > > virtio queue > > > virtio vhost-queue-status path queue -- Display status of a > > > given vhost queue > > > virtio queue-element path queue [index] -- Display element of a > > > given virtio queue > > I don't see a compelling reason why these are setup as sub-commands > > under a new "virtio" top level. This HMP approach and the QMP > > 'x-debug-query' > > naming just feels needlessly different from the current QEMU practices. > > > > IMHO they should just be "info" subcommands for HMP. ie > > > > info virtio -- List all available virtio devices > > info virtio-status path -- Display status of a given virtio device > > info virtio-queue-status path queue -- Display status of a given > > virtio queue > > info virtio-vhost-queue-status path queue -- Display status of a > > given vhost queue > > info virtio-queue-element path queue [index] -- Display element > > of a given virtio queue > > > > While the corresponding QMP commands ought to be > > > > x-query-virtio > > x-query-virtio-status > > x-query-virtio-queue-status > > x-query-virtio-vhost-queue-status > > x-query-virtio-queue-element > > > > > > Regards, > > Daniel > > Sure, I don't mind changing it to this if this is what others would prefer. > If there aren't any objections, I'll switch it to this in the next revision. I agree with Dan that there's no need for the extra level; however you could do it all in one HMP command I think: info virtio -- list all available virtio devices info virtio path -- Display status of a given virtio device info virtio path queue -- Display status of a given virtio queue info virtio -h path queue -- Display status of a given vhost queue info virtio -e path queue [index] -- Display element of a given virtio queue It wouldn't need to change the qmp commands underneath unless it made sense. Dave > Jonah -- Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
Re: [PATCH v8 0/8] hmp, qmp: Add commands to introspect virtio devices
On 10/27/21 07:55, Daniel P. Berrangé wrote: On Wed, Oct 27, 2021 at 07:41:41AM -0400, Jonah Palmer wrote: This series introduces new QMP/HMP commands to dump the status of a virtio device at different levels. [Jonah: Rebasing previous patchset from Oct. 5 (v7). Original patches are from Laurent Vivier from May 2020. Rebase from v7 to v8 includes an additional assert to make sure we're not returning NULL in virtio_id_to_name(). Rebase also includes minor additions/edits to qapi/virtio.json.] 1. Main command HMP Only: virtio [subcommand] Example: List all sub-commands: (qemu) virtio virtio query -- List all available virtio devices virtio status path -- Display status of a given virtio device virtio queue-status path queue -- Display status of a given virtio queue virtio vhost-queue-status path queue -- Display status of a given vhost queue virtio queue-element path queue [index] -- Display element of a given virtio queue I don't see a compelling reason why these are setup as sub-commands under a new "virtio" top level. This HMP approach and the QMP 'x-debug-query' naming just feels needlessly different from the current QEMU practices. IMHO they should just be "info" subcommands for HMP. ie info virtio -- List all available virtio devices info virtio-status path -- Display status of a given virtio device info virtio-queue-status path queue -- Display status of a given virtio queue info virtio-vhost-queue-status path queue -- Display status of a given vhost queue info virtio-queue-element path queue [index] -- Display element of a given virtio queue While the corresponding QMP commands ought to be x-query-virtio x-query-virtio-status x-query-virtio-queue-status x-query-virtio-vhost-queue-status x-query-virtio-queue-element Regards, Daniel Sure, I don't mind changing it to this if this is what others would prefer. If there aren't any objections, I'll switch it to this in the next revision. Jonah
Re: [PATCH v8 0/8] hmp, qmp: Add commands to introspect virtio devices
On Wed, Oct 27, 2021 at 07:41:41AM -0400, Jonah Palmer wrote: > This series introduces new QMP/HMP commands to dump the status of a > virtio device at different levels. > > [Jonah: Rebasing previous patchset from Oct. 5 (v7). Original patches > are from Laurent Vivier from May 2020. > > Rebase from v7 to v8 includes an additional assert to make sure > we're not returning NULL in virtio_id_to_name(). Rebase also > includes minor additions/edits to qapi/virtio.json.] > > 1. Main command > > HMP Only: > > virtio [subcommand] > > Example: > > List all sub-commands: > > (qemu) virtio > virtio query -- List all available virtio devices > virtio status path -- Display status of a given virtio device > virtio queue-status path queue -- Display status of a given virtio > queue > virtio vhost-queue-status path queue -- Display status of a given > vhost queue > virtio queue-element path queue [index] -- Display element of a given > virtio queue I don't see a compelling reason why these are setup as sub-commands under a new "virtio" top level. This HMP approach and the QMP 'x-debug-query' naming just feels needlessly different from the current QEMU practices. IMHO they should just be "info" subcommands for HMP. ie info virtio -- List all available virtio devices info virtio-status path -- Display status of a given virtio device info virtio-queue-status path queue -- Display status of a given virtio queue info virtio-vhost-queue-status path queue -- Display status of a given vhost queue info virtio-queue-element path queue [index] -- Display element of a given virtio queue While the corresponding QMP commands ought to be x-query-virtio x-query-virtio-status x-query-virtio-queue-status x-query-virtio-vhost-queue-status x-query-virtio-queue-element Regards, Daniel -- |: https://berrange.com -o-https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o-https://fstop138.berrange.com :| |: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|
[PATCH v8 0/8] hmp,qmp: Add commands to introspect virtio devices
This series introduces new QMP/HMP commands to dump the status of a virtio device at different levels. [Jonah: Rebasing previous patchset from Oct. 5 (v7). Original patches are from Laurent Vivier from May 2020. Rebase from v7 to v8 includes an additional assert to make sure we're not returning NULL in virtio_id_to_name(). Rebase also includes minor additions/edits to qapi/virtio.json.] 1. Main command HMP Only: virtio [subcommand] Example: List all sub-commands: (qemu) virtio virtio query -- List all available virtio devices virtio status path -- Display status of a given virtio device virtio queue-status path queue -- Display status of a given virtio queue virtio vhost-queue-status path queue -- Display status of a given vhost queue virtio queue-element path queue [index] -- Display element of a given virtio queue 2. List available virtio devices in the machine HMP Form: virtio query Example: (qemu) virtio query /machine/peripheral/vsock0/virtio-backend [vhost-vsock] /machine/peripheral/crypto0/virtio-backend [virtio-crypto] /machine/peripheral-anon/device[2]/virtio-backend [virtio-scsi] /machine/peripheral-anon/device[1]/virtio-backend [virtio-net] /machine/peripheral-anon/device[0]/virtio-backend [virtio-serial] QMP Form: { 'command': 'x-debug-query-virtio', 'returns': ['VirtioInfo'] } Example: -> { "execute": "x-debug-query-virtio" } <- { "return": [ { "path": "/machine/peripheral/vsock0/virtio-backend", "type": "vhost-vsock" }, { "path": "/machine/peripheral/crypto0/virtio-backend", "type": "virtio-crypto" }, { "path": "/machine/peripheral-anon/device[2]/virtio-backend", "type": "virtio-scsi" }, { "path": "/machine/peripheral-anon/device[1]/virtio-backend", "type": "virtio-net" }, { "path": "/machine/peripheral-anon/device[0]/virtio-backend", "type": "virtio-serial" } ] } 3. Display status of a given virtio device HMP Form: virtio status Example: (qemu) virtio status /machine/peripheral/vsock0/virtio-backend /machine/peripheral/vsock0/virtio-backend: device_name: vhost-vsock (vhost) device_id: 19 vhost_started: true bus_name:(null) broken: false disabled:false disable_legacy_check:false started: true use_started: true start_on_kick: false use_guest_notifier_mask: true vm_running: true num_vqs: 3 queue_sel: 2 isr: 0 endianness: little status: acknowledge, driver, features-ok, driver-ok Guest features: event-idx, indirect-desc, version-1 Host features:protocol-features, event-idx, indirect-desc, version-1, any-layout, notify-on-empty Backend features: VHost: nvqs: 2 vq_index: 0 max_queues: 0 n_mem_sections: 4 n_tmp_sections: 4 backend_cap:0 log_enabled:false log_size: 0 Features: event-idx, indirect-desc, version-1, any-layout, notify-on-empty, log-all Acked features:event-idx, indirect-desc, version-1 Backend features: Protocol features: QMP Form: { 'command': 'x-debug-virtio-status', 'data': { 'path': 'str' }, 'returns': 'VirtioStatus' } Example: -> { "execute": "x-debug-virtio-status", "arguments": { "path": "/machine/peripheral/vsock0/virtio-backend" } } <- { "return": { "device-endian": "little", "bus-name": "", "disable-legacy-check": false, "name": "vhost-vsock", "started": true, "device-id": 19, "vhost-dev": { "n-tmp-sections": 4, "n-mem-sections": 4, "max-queues": 0, "backend-cap": 0, "log-size": 0, "backend-features": {