From: Jonah Palmer <jonah.palmer@oracle.com>
To: Eugenio Perez Martin <eperezma@redhat.com>
Cc: qemu-devel@nongnu.org, eduardo@habkost.net,
marcel.apfelbaum@gmail.com, philmd@linaro.org,
wangyanan55@huawei.com, zhao1.liu@intel.com, mst@redhat.com,
sgarzare@redhat.com, jasowang@redhat.com, leiyang@redhat.com,
si-wei.liu@oracle.com, boris.ostrovsky@oracle.com,
armbru@redhat.com
Subject: Re: [RFC v2 05/14] virtio-net: detect VirtIODevice config buffer mid-migration change
Date: Tue, 24 Mar 2026 11:25:54 -0400 [thread overview]
Message-ID: <7fc80296-acf4-467a-b37c-ef390448c068@oracle.com> (raw)
In-Reply-To: <CAJaqyWfNABTMcg8UUS5GaSs9C3uUMWC17auV76dAYeK8fEWxcA@mail.gmail.com>
On 3/24/26 6:48 AM, Eugenio Perez Martin wrote:
> On Fri, Mar 20, 2026 at 3:21 PM Jonah Palmer <jonah.palmer@oracle.com> wrote:
>>
>> This patch saves the config buffer and its length of a virtio-net
>> device's VirtIODevice to compare with later during the stop-and-copy
>> phase.
>>
>> Signed-off-by: Jonah Palmer <jonah.palmer@oracle.com>
>> ---
>> hw/net/virtio-net.c | 21 +++++++++++++++++++++
>> include/hw/virtio/virtio.h | 4 ++++
>> 2 files changed, 25 insertions(+)
>>
>> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
>> index 2733e0130c..ca4385df1a 100644
>> --- a/hw/net/virtio-net.c
>> +++ b/hw/net/virtio-net.c
>> @@ -3871,6 +3871,15 @@ static int virtio_net_early_pre_save(void *opaque)
>> VirtIODevMigration *vdev_mig = vdev->migration;
>>
>> vdev_mig->status_early = vdev->status;
>> +
>> + /* VirtIODevice config buffer snapshot */
>> + g_free(vdev_mig->config_early);
>> + vdev_mig->config_len_early = vdev->config_len;
>> + if (vdev->config_len) {
>> + vdev_mig->config_early = g_memdup2(vdev->config, vdev->config_len);
>> + } else {
>> + vdev_mig->config_early = NULL;
>> + }
>> return 0;
>> }
>>
>> @@ -4150,6 +4159,9 @@ static void virtio_net_device_unrealize(DeviceState *dev)
>> virtio_cleanup(vdev);
>>
>> if (n->early_mig) {
>> + g_free(vdev->migration->config_early);
>> + vdev->migration->config_early = NULL;
>> +
>> g_free(vdev->migration);
>> vdev->migration = NULL;
>>
>> @@ -4251,6 +4263,15 @@ static bool virtio_net_has_delta(VirtIONet *n, VirtIODevice *vdev)
>> return true;
>> }
>>
>> + /* Has the VirtIODevice's config buffer changed? */
>> + if (vdev->config_len != vdev_mig->config_len_early) {
>> + return true;
>> + }
>> + if (vdev->config_len && memcmp(vdev->config, vdev_mig->config_early,
>> + vdev->config_len) != 0) {
>
> I'm happy with this but maybe a comparison to the config generation is enough?
>
A change in vdev->generation would only tell us that
virtio_notify_config ran. It wouldn't tell us which field changed or
what exactly needs to be updated.
And although this RFC series currently just aims to detect a change and,
if found, signal for a full reload, an actual follow-up PATCH series for
this will handle sending the required change to the destination instead
of doing this full reload. For that, we'll need actual per-field deltas.
>> + return true;
>> + }
>> +
>> /*
>> * Always return true for now until we're able to detect all possible
>> * changes to a VirtIONet device.
>> diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
>> index 752c46ce53..9949b94b64 100644
>> --- a/include/hw/virtio/virtio.h
>> +++ b/include/hw/virtio/virtio.h
>> @@ -103,10 +103,14 @@ enum virtio_device_endian {
>> * struct VirtIODevMigration - Common VirtIODevice migration structure
>> * @early_load: Flag to indicate an early virtio_load for the device.
>> * @status_early: Device status at the time it was sent early.
>> + * @config_len_early: Length of the config buffer at the time it was sent early.
>> + * @config_early: Config buffer at the time it was sent early.
>> */
>> typedef struct VirtIODevMigration {
>> bool early_load;
>> uint8_t status_early;
>> + size_t config_len_early;
>> + uint8_t *config_early;
>> } VirtIODevMigration;
>>
>> /**
>> --
>> 2.51.0
>>
>
next prev parent reply other threads:[~2026-03-24 15:26 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-20 14:20 [RFC v2 00/14] virtio-net: early VMStateDescription live migration support Jonah Palmer
2026-03-20 14:20 ` [RFC v2 01/14] machine,virtio-net: add early-mig property Jonah Palmer
2026-03-23 10:25 ` Eugenio Perez Martin
2026-03-24 14:07 ` Jonah Palmer
2026-03-26 8:02 ` Eugenio Perez Martin
2026-03-20 14:20 ` [RFC v2 02/14] virtio, virtio-net: add initial early VMSD for setup-phase migration Jonah Palmer via qemu development
2026-03-24 9:27 ` [RFC v2 02/14] virtio,virtio-net: " Eugenio Perez Martin
2026-03-24 14:28 ` Jonah Palmer
2026-03-24 14:38 ` Eugenio Perez Martin
2026-03-24 17:16 ` Jonah Palmer
2026-03-20 14:20 ` [RFC v2 03/14] virtio,virtio-net: virtio-delta VMSD - VQ state Jonah Palmer
2026-03-20 14:20 ` [RFC v2 04/14] virtio-net: detect VirtIODevice status mid-migration change Jonah Palmer
2026-03-24 10:45 ` Eugenio Perez Martin
2026-03-24 15:01 ` Jonah Palmer
2026-03-26 10:08 ` Eugenio Perez Martin
2026-03-20 14:20 ` [RFC v2 05/14] virtio-net: detect VirtIODevice config buffer " Jonah Palmer
2026-03-24 10:48 ` Eugenio Perez Martin
2026-03-24 15:25 ` Jonah Palmer [this message]
2026-03-20 14:20 ` [RFC v2 06/14] virtio-net: detect VirtIONet MAC addr " Jonah Palmer
2026-03-20 14:20 ` [RFC v2 07/14] virtio-net: detect VirtIONet MAC table mid-migration changes Jonah Palmer
2026-03-20 14:20 ` [RFC v2 08/14] virtio-net: detect VirtIONet status mid-migration change Jonah Palmer
2026-03-24 11:26 ` Eugenio Perez Martin
2026-03-24 16:23 ` Jonah Palmer
2026-03-26 10:20 ` Eugenio Perez Martin
2026-03-20 14:20 ` [RFC v2 09/14] virtio-net: detect VirtIONet Rx filter mid-migration changes Jonah Palmer
2026-03-20 14:20 ` [RFC v2 10/14] virtio-net: detect VirtIONet VLAN filter table changes Jonah Palmer
2026-03-20 14:20 ` [RFC v2 11/14] virtio-net: detect VirtIONet guest offload & MQ mid-migration changes Jonah Palmer
2026-03-20 14:20 ` [RFC v2 12/14] virtio-net: detect RSS state " Jonah Palmer
2026-03-20 14:20 ` [RFC v2 13/14] virtio-net: detect pending Tx work for VQs " Jonah Palmer
2026-03-24 11:35 ` Eugenio Perez Martin
2026-03-24 16:47 ` Jonah Palmer
2026-03-26 10:30 ` Eugenio Perez Martin
2026-03-20 14:20 ` [RFC v2 14/14] virtio-net, vhost-net: early migration support for vhost-net Jonah Palmer via qemu development
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=7fc80296-acf4-467a-b37c-ef390448c068@oracle.com \
--to=jonah.palmer@oracle.com \
--cc=armbru@redhat.com \
--cc=boris.ostrovsky@oracle.com \
--cc=eduardo@habkost.net \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=leiyang@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.com \
--cc=si-wei.liu@oracle.com \
--cc=wangyanan55@huawei.com \
--cc=zhao1.liu@intel.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