From: Markus Armbruster <armbru@redhat.com>
To: Yong Huang <yong.huang@smartx.com>
Cc: qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>,
Eric Blake <eblake@redhat.com>
Subject: Re: [PATCH v3 1/3] qmp: Switch x-query-virtio-status back to numeric encoding
Date: Mon, 19 Feb 2024 16:32:12 +0100 [thread overview]
Message-ID: <87le7gii6b.fsf@pond.sub.org> (raw)
In-Reply-To: <CAK9dgmYu04F37==Ye4VgtmZjzh8-YXQ61FygtG5o_f0E=e6cmg@mail.gmail.com> (Yong Huang's message of "Thu, 15 Feb 2024 20:49:41 +0800")
Yong Huang <yong.huang@smartx.com> writes:
> On Tue, Feb 13, 2024 at 6:26 PM Michael S. Tsirkin <mst@redhat.com> wrote:
>
>> On Fri, Feb 02, 2024 at 10:32:15PM +0800, Hyman Huang wrote:
>> > x-query-virtio-status returns several sets of virtio feature and
>> > status flags. It goes back to v7.2.0.
>> >
>> > In the initial commit 90c066cd682 (qmp: add QMP command
>> > x-query-virtio-status), we returned them as numbers, using virtio's
>> > well-known binary encoding.
>> >
>> > The next commit f3034ad71fc (qmp: decode feature & status bits in
>> > virtio-status) replaced the numbers by objects. The objects represent
>> > bits QEMU knows symbolically, and any unknown bits numerically just like
>> > before.
>> >
>> > Commit 8a8287981d1 (hmp: add virtio commands) the matching HMP command
>> > "info virtio" (and a few more, which aren't relevant here).
>> >
>> > The symbolic representation uses lists of strings. The string format is
>> > undocumented. The strings look like "WELL_KNOWN_SYMBOL: human readable
>> > explanation".
>> >
>> > This symbolic representation is nice for humans. Machines it can save
>> > the trouble of decoding virtio's well-known binary encoding.
>> >
>> > However, we sometimes want to compare features and status bits without
>> > caring for their exact meaning. Say we want to verify the correctness
>> > of the virtio negotiation between guest, QEMU, and OVS-DPDK. We can use
>> > QMP command x-query-virtio-status to retrieve vhost-user net device
>> > features, and the "ovs-vsctl list interface" command to retrieve
>> > interface features. Without commit f3034ad71fc, we could then simply
>> > compare the numbers. With this commit, we first have to map from the
>> > strings back to the numeric encoding.
>> >
>> > Revert the decoding for QMP, but keep it for HMP.
>>
>> Is there a way to maybe have both decoded and numerical one?
>
> What if the next patch went back to this implementation in the following
> patch? All you need to do is add a matching xxx_bits entry for each feature
> and status.
>
> https://patchew.org/QEMU/cover.1700319559.git.yong.huang@smartx.com/3c7161a47b141af04b1f8272e8e24c5faa46ddb2.1700319559.git.yong.huang@smartx.com/
>
>
> E.g. I mostly use QMP even when I read it myself.
>>
>
> Thus, it is recommended that both numerical and decoded types be kept for
> QMP; this approach can be at odds with what was previously discussed.
> What do you think about this, Markus?
QMP is for machines.
That said, I won't object to adding development & debugging aids meant
for humans as long as
1. they're marked unstable, and
2. they either add only a modest amount of output, or the additional
output is off by default.
What exactly is a "modest amount" depends on how machines use the
command. If they use it all the time, even going from 8KiB to 64KiB
could be too much. If they use it just once per guest, we can afford
more waste.
In this particular case, we could add an unstable member of type ['str']
next to the int-valued bits. For each set bit in the int, add a string
to the list. If QEMU knows the bit, use the well-known name. I'd omit
the common prefix, though: use "GUEST_ANNOUNCE" or "guest-announce"
instead of "VIRTIO_NET_F_GUEST_ANNOUNCE". If QEMU doesn't know the bit,
you could use the bit's numeric value.
Recommend a separate patch, to avoid delaying this series.
Makes sense?
next prev parent reply other threads:[~2024-02-19 15:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-02 14:32 [PATCH v3 0/3] Adjust the output of x-query-virtio-status Hyman Huang
2024-02-02 14:32 ` [PATCH v3 1/3] qmp: Switch x-query-virtio-status back to numeric encoding Hyman Huang
2024-02-13 10:26 ` Michael S. Tsirkin
2024-02-15 12:49 ` Yong Huang
2024-02-19 15:32 ` Markus Armbruster [this message]
2024-02-20 1:27 ` Yong Huang
2024-02-19 15:18 ` Markus Armbruster
2024-02-02 14:32 ` [PATCH v3 2/3] virtio: Declare the decoding functions to static Hyman Huang
2024-02-19 15:38 ` Markus Armbruster
2024-02-21 3:59 ` Yong Huang
2024-02-02 14:32 ` [PATCH v3 3/3] qapi: Define VhostDeviceProtocols and VirtioDeviceFeatures as plain C types Hyman Huang
2024-02-19 15:33 ` Markus Armbruster
2024-02-13 10:25 ` [PATCH v3 0/3] Adjust the output of x-query-virtio-status Michael S. Tsirkin
2024-02-13 13:30 ` 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=87le7gii6b.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=yong.huang@smartx.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.