From: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
To: Paolo Abeni <pabeni@redhat.com>, qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Dmitry Fleytman <dmitry.fleytman@gmail.com>,
Jason Wang <jasowang@redhat.com>,
Sriram Yagnaraman <sriram.yagnaraman@ericsson.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Stefano Garzarella <sgarzare@redhat.com>,
Cornelia Huck <cohuck@redhat.com>,
Luigi Rizzo <lrizzo@google.com>,
Giuseppe Lettieri <g.lettieri@iet.unipi.it>,
Vincenzo Maffione <v.maffione@gmail.com>,
Eric Blake <eblake@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
kvm@vger.kernel.org
Subject: Re: [PATCH RFC v2 04/13] virtio: serialize extended features state
Date: Wed, 16 Jul 2025 20:52:58 +0900 [thread overview]
Message-ID: <07b09740-9e20-43df-a128-83e62e7a34a2@rsg.ci.i.u-tokyo.ac.jp> (raw)
In-Reply-To: <efd96b88-284c-4853-93ea-9e1b81b1ffe7@redhat.com>
On 2025/07/16 0:40, Paolo Abeni wrote:
> On 7/15/25 9:24 AM, Akihiko Odaki wrote:
>> On 2025/07/11 22:02, Paolo Abeni wrote:
>>> + */
>>> + QEMU_BUILD_BUG_ON(VIRTIO_FEATURES_DWORDS != 2);
>>> + if (virtio_128bit_features_needed(vdev)) {
>>
>> There is no need to distinguish virtio_128bit_features_needed() and
>> virtio_64bit_features_needed() here.
>
> Double checking I'm reading the above correctly. Are you suggesting to
> replace this chunk with something alike:
>
> if (virtio_64bit_features_needed(vdev)) {
This condition is not right as virtio_64bit_features_needed() doesn't
return true when the some of bits [64, 128) is set while bits [32, 64)
are cleared. I see two options to fix:
- Check: virtio_64bit_features_needed(vdev) ||
virtio_128bit_features_needed(vdev)
- Ensure that virtio_64bit_features_needed(vdev) returns true when a bit
more significant than bit 31 is set.
> /* The 64 highest bit has been cleared by the previous
> * virtio_features_from_u64() and ev.
> * initialized as needed when loading
> * "virtio/128bit_features"*/
> uint64_t *val = vdev->guest_features_array;
>
> if (virtio_set_128bit_features_nocheck_maybe_co(vdev, val) < 0)
> // ...> >> For the 32-bit case, it will be simpler to have an array here and use
>> virtio_set_128bit_features_nocheck_maybe_co() instead of having
>> virtio_set_features_nocheck_maybe_co().
>
> Again double checking I'm parsing the above correctly. You are
> suggesting to dismiss the virtio_set_features_nocheck_maybe_co() helper
> entirely and use virtio_set_128bit_features_nocheck_maybe_co() even when
> only 32bit features are loaded. Am I correct?
Yes, but now I found it is unnecessary to special-case even the 32-bit case.
Commit 019a3edbb25f ("virtio: make features 64bit wide") had to add a
conditional to distinguish the 64-bit and 32-bit cases because
vdev->guest_features was not set before executing this part of code.
However, commit 62cee1a28aad ("virtio: set low features early on load")
later added preceding code to set vdev->guest_features. In summary, this
part of code can be simply replaced with:
if (virtio_set_128bit_features_nocheck_maybe_co(vdev,
vdev->guest_features_array) < 0) {
error_report("Features 0x" VIRTIO_FEATURES_FMT " unsupported. "
"Allowed features: 0x" VIRTIO_FEATURES_FMT,
VIRTIO_FEATURES_PR(val),
VIRTIO_FEATURES_PR(vdev->host_features_array));
return -1;
}
There is no need of virtio_64bit_features_needed(vdev) or
virtio_128bit_features_needed(vdev) at all.
I have another finding by the way; there are three phrases that refers
to the new extension: array (e.g., guest_features_array), _ex (e.g.,
virtio_add_feature_ex), 128bit (e.g., virtio_128bit_features_needed).
It makes sense to make "128bit" an exception in the migration code
because the migration format is fixed and will require e.g., "192bit"
for a future extension. But two suffixes, _ex and _array, can be unified.
Regards,
Akihiko Odaki
next prev parent reply other threads:[~2025-07-16 11:53 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-11 13:02 [PATCH RFC v2 00/13] virtio: introduce support for GSO over UDP tunnel Paolo Abeni
2025-07-11 13:02 ` [PATCH RFC v2 01/13] net: bundle all offloads in a single struct Paolo Abeni
2025-07-15 6:36 ` Akihiko Odaki
2025-07-15 14:52 ` Paolo Abeni
2025-07-16 11:32 ` Akihiko Odaki
2025-07-11 13:02 ` [PATCH RFC v2 02/13] linux-headers: Update to Linux ~v6.16-rc5 net-next Paolo Abeni
2025-07-11 13:02 ` [PATCH RFC v2 03/13] virtio: introduce extended features type Paolo Abeni
2025-07-15 6:57 ` Akihiko Odaki
2025-07-11 13:02 ` [PATCH RFC v2 04/13] virtio: serialize extended features state Paolo Abeni
2025-07-15 7:24 ` Akihiko Odaki
2025-07-15 15:40 ` Paolo Abeni
2025-07-16 11:52 ` Akihiko Odaki [this message]
2025-07-11 13:02 ` [PATCH RFC v2 05/13] virtio: add support for negotiating extended features Paolo Abeni
2025-07-11 13:02 ` [PATCH RFC v2 06/13] virtio-pci: implement support for " Paolo Abeni
2025-07-15 7:42 ` Akihiko Odaki
2025-07-15 16:21 ` Paolo Abeni
2025-07-16 9:14 ` Paolo Abeni
2025-07-16 11:55 ` Akihiko Odaki
2025-07-11 13:02 ` [PATCH RFC v2 07/13] vhost: add support for negotiating " Paolo Abeni
2025-07-11 13:02 ` [PATCH RFC v2 08/13] qmp: update virtio features map to support " Paolo Abeni
2025-07-15 7:59 ` Akihiko Odaki
2025-07-15 15:43 ` Paolo Abeni
2025-07-16 12:00 ` Akihiko Odaki
2025-07-11 13:02 ` [PATCH RFC v2 09/13] vhost-backend: implement extended features support Paolo Abeni
2025-07-11 13:02 ` [PATCH RFC v2 10/13] vhost-net: " Paolo Abeni
2025-07-11 13:02 ` [PATCH RFC v2 11/13] virtio-net: " Paolo Abeni
2025-07-11 13:02 ` [PATCH RFC v2 12/13] net: implement tunnel probing Paolo Abeni
2025-07-15 8:05 ` Akihiko Odaki
2025-07-15 15:49 ` Paolo Abeni
2025-07-18 4:38 ` Akihiko Odaki
2025-07-11 13:02 ` [PATCH RFC v2 13/13] net: implement UDP tunnel features offloading Paolo Abeni
2025-07-15 8:07 ` Akihiko Odaki
2025-07-16 10:13 ` Paolo Abeni
2025-07-16 12:04 ` Akihiko Odaki
2025-07-14 8:43 ` [PATCH RFC v2 00/13] virtio: introduce support for GSO over UDP tunnel Lei Yang
2025-07-14 9:05 ` Paolo Abeni
2025-07-14 9:09 ` Lei Yang
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=07b09740-9e20-43df-a128-83e62e7a34a2@rsg.ci.i.u-tokyo.ac.jp \
--to=odaki@rsg.ci.i.u-tokyo.ac.jp \
--cc=armbru@redhat.com \
--cc=cohuck@redhat.com \
--cc=dmitry.fleytman@gmail.com \
--cc=eblake@redhat.com \
--cc=g.lettieri@iet.unipi.it \
--cc=jasowang@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=lrizzo@google.com \
--cc=mst@redhat.com \
--cc=pabeni@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.com \
--cc=sriram.yagnaraman@ericsson.com \
--cc=v.maffione@gmail.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).