On 2025/07/21 16:51, Paolo Abeni wrote:
7/20/25 12:44 PM, Akihiko Odaki wrote:
On 2025/07/18 17:52, Paolo Abeni wrote:
@@ -3333,26 +3362,23 @@ virtio_load(VirtIODevice *vdev, QEMUFile *f, int
version_id)
vdev->device_endian = virtio_default_endian();
}
- if (virtio_64bit_features_needed(vdev)) {
- /*
- * Subsection load filled vdev->guest_features. Run them
- * through virtio_set_features to sanity-check them against
- * host_features.
- */
- uint64_t features64 = vdev->guest_features;
- if (virtio_set_features_nocheck_maybe_co(vdev, features64) < 0) {
- error_report("Features 0x%" PRIx64 " unsupported. "
- "Allowed features: 0x%" PRIx64,
- features64, vdev->host_features);
- return -1;
- }
- } else {
- if (virtio_set_features_nocheck_maybe_co(vdev, features) < 0) {
- error_report("Features 0x%x unsupported. "
- "Allowed features: 0x%" PRIx64,
- features, vdev->host_features);
- return -1;
- }
+ /*
+ * Avoid silently breaking migration should the feature space increase
+ * even more in the (far away) future
+ */
+ QEMU_BUILD_BUG_ON(VIRTIO_FEATURES_DWORDS != 2);
This should be moved to around virtio_128bit_features_needed() and
vmstate_virtio_128bit_features as they make assumptions on the feature
space while virtio_load() doesn't.
Please allow me the following dumb question to try to avoid more
iterations for small changes. I guess moving the above inside
virtio_128bit_features_needed() would suffice?
Thinking more carefully, now I think it should be moved before or after
vmstate_virtio.
virtio_128bit_features_needed() and vmstate_virtio_128bit_features will
work fine even if the feature bitmask becomes 196-bit. But
vmstate_virtio will need to be updated to contain
vmstate_virtio_196bit_features. So this assertion should be around
vmstate_virtio.
Regards,
Akihiko Odaki