From: Jonah Palmer <jonah.palmer@oracle.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: mst@redhat.com, qemu_oss@crudebyte.com, qemu-devel@nongnu.org,
kraxel@redhat.com, si-wei.liu@oracle.com,
joao.m.martins@oracle.com, eblake@redhat.com,
qemu-block@nongnu.org, david@redhat.com, arei.gonglei@huawei.com,
marcandre.lureau@redhat.com, lvivier@redhat.com,
thuth@redhat.com, michael.roth@amd.com, groug@kaod.org,
dgilbert@redhat.com, eric.auger@redhat.com, stefanha@redhat.com,
boris.ostrovsky@oracle.com, kwolf@redhat.com,
mathieu.poirier@linaro.org, raphael.norwitz@nutanix.com,
pbonzini@redhat.com
Subject: Re: [PATCH v8 4/8] qmp: add QMP command x-debug-virtio-status
Date: Fri, 5 Nov 2021 04:36:16 -0400 [thread overview]
Message-ID: <69536f67-1399-e95b-6dc7-a2fe5237c609@oracle.com> (raw)
In-Reply-To: <874k8s9bkl.fsf@dusky.pond.sub.org>
[-- Attachment #1: Type: text/plain, Size: 10001 bytes --]
On 11/4/21 11:37, Markus Armbruster wrote:
> Jonah Palmer<jonah.palmer@oracle.com> writes:
>
>> From: Laurent Vivier<lvivier@redhat.com>
>>
>> This new command shows the status of a VirtIODevice, including
>> its corresponding vhost device status (if active).
>>
>> Next patch will improve output by decoding feature bits, including
>> vhost device's feature bits (backend, protocol, acked, and features).
>> Also will decode status bits of a VirtIODevice.
>>
>> Next patch will also suppress the vhost device field from displaying
>> if no vhost device is active for a given VirtIODevice.
>>
>> Signed-off-by: Jonah Palmer<jonah.palmer@oracle.com>
>> ---
> [...]
>
>> diff --git a/qapi/virtio.json b/qapi/virtio.json
>> index 4490c2c..656a26f 100644
>> --- a/qapi/virtio.json
>> +++ b/qapi/virtio.json
>> @@ -65,3 +65,258 @@
>> ##
>>
>> { 'command': 'x-debug-query-virtio', 'returns': ['VirtioInfo'] }
>> +
>> +##
>> +# @VirtioStatusEndianness:
>> +#
>> +# Enumeration of endianness for VirtioDevice
>> +#
>> +# Since: 6.2
>> +##
>> +
>> +{ 'enum': 'VirtioStatusEndianness',
>> + 'data': [ 'unknown', 'little', 'big' ]
>> +}
>> +
>> +##
>> +# @VhostStatus:
>> +#
>> +# Information about a vhost device. This information will only be
>> +# displayed if the vhost device is active.
>> +#
>> +# @n-mem-sections: vhost_dev n_mem_sections
>> +#
>> +# @n-tmp-sections: vhost_dev n_tmp_sections
>> +#
>> +# @nvqs: vhost_dev nvqs. This is the number of virtqueues being used
>> +# by the vhost device.
>> +#
>> +# @vq-index: vhost_dev vq_index
>> +#
>> +# @features: vhost_dev features
>> +#
>> +# @acked-features: vhost_dev acked_features
>> +#
>> +# @backend-features: vhost_dev backend_features
>> +#
>> +# @protocol-features: vhost_dev protocol_features
>> +#
>> +# @max-queues: vhost_dev max_queues
>> +#
>> +# @backend-cap: vhost_dev backend_cap
>> +#
>> +# @log-enabled: vhost_dev log_enabled flag
>> +#
>> +# @log-size: vhost_dev log_size
>> +#
>> +# Since: 6.2
>> +#
>> +##
>> +
>> +{ 'struct': 'VhostStatus',
>> + 'data': {
>> + 'n-mem-sections': 'int',
>> + 'n-tmp-sections': 'int',
> Odd indentation. Better
>
> { 'struct': 'VhostStatus',
> 'data': {
> 'n-mem-sections': 'int',
> 'n-tmp-sections': 'int',
>
> or
>
> { 'struct': 'VhostStatus',
> 'data': { 'n-mem-sections': 'int',
> 'n-tmp-sections': 'int',
>
> More of the same below, and possibly in other patches. I'm not going to
> point it out again.
Gotcha, I'll use this format in the .json file. Will change it to this for
all relevant patches.
>
>> + 'nvqs': 'uint32',
>> + 'vq-index': 'int',
>> + 'features': 'uint64',
>> + 'acked-features': 'uint64',
>> + 'backend-features': 'uint64',
>> + 'protocol-features': 'uint64',
>> + 'max-queues': 'uint64',
>> + 'backend-cap': 'uint64',
>> + 'log-enabled': 'bool',
>> + 'log-size': 'uint64'
>> + }
>> +}
> I can't tell whether these are all needed. Got to trust virtio experts
> there.
Not sure either, I just included whatever I could include.
>
> I'm not checking the schema types match the data sources' C types. I
> hope you did :)
Yes c:
>
> More of the same below, and possibly in other patches. I'm not going to
> point it out again.
>
>> +
>> +##
>> +# @VirtioStatus:
>> +#
>> +# Full status of the virtio device with most VirtIODevice members.
>> +# Also includes the full status of the corresponding vhost device
>> +# if the vhost device is active.
>> +#
>> +# @name: VirtIODevice name
>> +#
>> +# @device-id: VirtIODevice ID
>> +#
>> +# @vhost-started: VirtIODevice vhost_started flag
>> +#
>> +# @guest-features: VirtIODevice guest_features
>> +#
>> +# @host-features: VirtIODevice host_features
>> +#
>> +# @backend-features: VirtIODevice backend_features
>> +#
>> +# @device-endian: VirtIODevice device_endian
>> +#
>> +# @num-vqs: VirtIODevice virtqueue count. This is the number of active
>> +# virtqueues being used by the VirtIODevice.
>> +#
>> +# @status: VirtIODevice configuration status (e.g. DRIVER_OK,
>> +# FEATURES_OK, DRIVER, etc.)
>> +#
>> +# @isr: VirtIODevice ISR
>> +#
>> +# @queue-sel: VirtIODevice queue_sel
>> +#
>> +# @vm-running: VirtIODevice vm_running flag
>> +#
>> +# @broken: VirtIODevice broken flag
>> +#
>> +# @disabled: VirtIODevice disabled flag
>> +#
>> +# @use-started: VirtIODevice use_started flag
>> +#
>> +# @started: VirtIODevice started flag
>> +#
>> +# @start-on-kick: VirtIODevice start_on_kick flag
>> +#
>> +# @disable-legacy-check: VirtIODevice disabled_legacy_check flag
>> +#
>> +# @bus-name: VirtIODevice bus_name
>> +#
>> +# @use-guest-notifier-mask: VirtIODevice use_guest_notifier_mask flag
>> +#
>> +# @vhost-dev: corresponding vhost device info for a given VirtIODevice
>> +#
>> +# Since: 6.2
>> +#
>> +##
>> +
>> +{ 'struct': 'VirtioStatus',
>> + 'data': {
>> + 'name': 'str',
>> + 'device-id': 'uint16',
>> + 'vhost-started': 'bool',
>> + 'guest-features': 'uint64',
>> + 'host-features': 'uint64',
>> + 'backend-features': 'uint64',
>> + 'device-endian': 'VirtioStatusEndianness',
>> + 'num-vqs': 'int',
>> + 'status': 'uint8',
>> + 'isr': 'uint8',
>> + 'queue-sel': 'uint16',
>> + 'vm-running': 'bool',
>> + 'broken': 'bool',
>> + 'disabled': 'bool',
>> + 'use-started': 'bool',
>> + 'started': 'bool',
>> + 'start-on-kick': 'bool',
>> + 'disable-legacy-check': 'bool',
>> + 'bus-name': 'str',
>> + 'use-guest-notifier-mask': 'bool',
>> + 'vhost-dev': 'VhostStatus'
>> + }
>> +}
>> +
>> +##
>> +# @x-debug-virtio-status:
>> +#
>> +# Poll for a comprehensive status of a given virtio device
>> +#
>> +# @path: Canonical QOM path of the VirtIODevice
>> +#
>> +# Returns: VirtioStatus of the virtio device
>> +#
>> +# Since: 6.2
>> +#
>> +# Examples:
>> +#
>> +# 1. Poll for the status of virtio-crypto (no vhost-crypto active)
>> +#
>> +# -> { "execute": "x-debug-virtio-status",
>> +# "arguments": {
>> +# "path": "/machine/peripheral/crypto0/virtio-backend"
>> +# }
>> +# }
>> +# <- { "return": {
>> +# "device-endian": "little",
>> +# "bus-name": "",
>> +# "disable-legacy-check": false,
>> +# "name": "virtio-crypto",
>> +# "started": true,
>> +# "device-id": 20,
>> +# "vhost-dev": {
>> +# "n-tmp-sections": 0,
>> +# "n-mem-sections": 0,
>> +# "max-queues": 0,
>> +# "backend-cap": 0,
>> +# "log-size": 0,
>> +# "backend-features": 0,
>> +# "nvqs": 0,
>> +# "protocol-features": 0,
>> +# "vq-index": 0,
>> +# "log-enabled": false,
>> +# "acked-features": 0,
>> +# "features": 0
>> +# },
>> +# "backend-features": 0,
>> +# "start-on-kick": false,
>> +# "isr": 1,
>> +# "broken": false,
>> +# "status": 15,
>> +# "num-vqs": 2,
>> +# "guest-features": 5100273664,
>> +# "host-features": 6325010432,
>> +# "use-guest-notifier-mask": true,
>> +# "vm-running": true,
>> +# "queue-sel": 1,
>> +# "disabled": false,
>> +# "vhost-started": false,
>> +# "use-started": true
>> +# }
>> +# }
>> +#
>> +# 2. Poll for the status of virtio-net (vhost-net is active)
>> +#
>> +# -> { "execute": "x-debug-virtio-status",
>> +# "arguments": {
>> +# "path": "/machine/peripheral-anon/device[1]/virtio-backend"
>> +# }
>> +# }
>> +# <- { "return": {
>> +# "device-endian": "little",
>> +# "bus-name": "",
>> +# "disabled-legacy-check": false,
>> +# "name": "virtio-net",
>> +# "started": true,
>> +# "device-id": 1,
>> +# "vhost-dev": {
>> +# "n-tmp-sections": 4,
>> +# "n-mem-sections": 4,
>> +# "max-queues": 1,
>> +# "backend-cap": 2,
>> +# "log-size": 0,
>> +# "backend-features": 0,
>> +# "nvqs": 2,
>> +# "protocol-features": 0,
>> +# "vq-index": 0,
>> +# "log-enabled": false,
>> +# "acked-features": 5100306432,
>> +# "features": 13908344832
>> +# },
>> +# "backend-features": 6337593319,
>> +# "start-on-kick": false,
>> +# "isr": 1,
>> +# "broken": false,
>> +# "status": 15,
>> +# "num-vqs": 3,
>> +# "guest-features": 5111807911,
>> +# "host-features": 6337593319,
>> +# "use-guest-notifier-mask": true,
>> +# "vm-running": true,
>> +# "queue-sel": 2,
>> +# "disabled": false,
>> +# "vhost-started": true,
>> +# "use-started": true
>> +# }
>> +# }
>> +#
>> +##
>> +
>> +{ 'command': 'x-debug-virtio-status',
>> + 'data': { 'path': 'str' },
>> + 'returns': 'VirtioStatus'
>> +}
> Unstable commands now need to be marked with
>
> 'features': [ 'unstable' ]
>
> If you do that, the QAPI generator will demand documentation. So add
>
> # Features:
> # @unstable: This command is meant for debugging.
>
> You may want to grep for examples. See also commit 9fb49daabf "qapi:
> Mark unstable QMP parts with feature 'unstable'".
Got it. I will add this in for all 'x-' related commands.
>
> Hmm, this command starts with x-debug-virtio-, wheras the one added in
> the previous commit starts with x-debug-query-virtio-.
>
> By conventions, commands that just return information on FOO are named
> query-FOO. I recommend an x-query-virtio- prefix for your query
> commands. We can leave their purpose (debug) to documentation.
Sure thing! I'll make this change.
>
Jonah
[-- Attachment #2: Type: text/html, Size: 11892 bytes --]
next prev parent reply other threads:[~2021-11-05 8:37 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-27 11:41 [PATCH v8 0/8] hmp,qmp: Add commands to introspect virtio devices Jonah Palmer
2021-10-27 11:41 ` [PATCH v8 1/8] virtio: drop name parameter for virtio_init() Jonah Palmer
2021-10-27 11:41 ` [PATCH v8 2/8] virtio: add vhost support for virtio devices Jonah Palmer
2021-10-27 11:41 ` [PATCH v8 3/8] qmp: add QMP command x-debug-query-virtio Jonah Palmer
2021-11-04 15:15 ` Markus Armbruster
2021-11-05 8:24 ` Jonah Palmer
2021-10-27 11:41 ` [PATCH v8 4/8] qmp: add QMP command x-debug-virtio-status Jonah Palmer
2021-11-04 15:37 ` Markus Armbruster
2021-11-05 8:36 ` Jonah Palmer [this message]
2021-10-27 11:41 ` [PATCH v8 5/8] qmp: decode feature & status bits in virtio-status Jonah Palmer
2021-10-27 11:59 ` David Hildenbrand
2021-10-27 12:18 ` Laurent Vivier
2021-10-28 7:56 ` Jonah Palmer
2021-10-28 7:57 ` David Hildenbrand
2021-10-27 11:41 ` [PATCH v8 6/8] qmp: add QMP commands for virtio/vhost queue-status Jonah Palmer
2021-10-27 11:41 ` [PATCH v8 7/8] qmp: add QMP command x-debug-virtio-queue-element Jonah Palmer
2021-10-27 11:41 ` [PATCH v8 8/8] hmp: add virtio commands Jonah Palmer
2021-11-05 7:23 ` Markus Armbruster
2021-11-05 8:40 ` Jonah Palmer
2021-10-27 11:55 ` [PATCH v8 0/8] hmp, qmp: Add commands to introspect virtio devices Daniel P. Berrangé
2021-10-28 7:54 ` Jonah Palmer
2021-10-28 9:04 ` Dr. David Alan Gilbert
2021-11-05 7:26 ` Markus Armbruster
2021-11-05 8:58 ` Jonah Palmer
2021-11-05 8:50 ` Markus Armbruster
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=69536f67-1399-e95b-6dc7-a2fe5237c609@oracle.com \
--to=jonah.palmer@oracle.com \
--cc=arei.gonglei@huawei.com \
--cc=armbru@redhat.com \
--cc=boris.ostrovsky@oracle.com \
--cc=david@redhat.com \
--cc=dgilbert@redhat.com \
--cc=eblake@redhat.com \
--cc=eric.auger@redhat.com \
--cc=groug@kaod.org \
--cc=joao.m.martins@oracle.com \
--cc=kraxel@redhat.com \
--cc=kwolf@redhat.com \
--cc=lvivier@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mathieu.poirier@linaro.org \
--cc=michael.roth@amd.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu_oss@crudebyte.com \
--cc=raphael.norwitz@nutanix.com \
--cc=si-wei.liu@oracle.com \
--cc=stefanha@redhat.com \
--cc=thuth@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).