This series is an RFC initial implementation of iterative live migration for virtio-net devices.
The main motivation behind implementing iterative migration for virtio-net devices is to start on heavy, time-consuming operations for the destination while the source is still active (i.e. before the stop-and-copy phase). The motivation behind this RFC series specifically is to provide an initial framework for such an implementation and get feedback on the design and direction. ------- This implementation of iterative live migration for a virtio-net device is enabled via setting the migration capability 'virtio-iterative' to on for both the source & destination, e.g. (HMP): (qemu) migrate_set_capability virtio-iterative on The virtio-net device's SaveVMHandlers hooks are registered/unregistered during the device's realize/unrealize phase. Currently, this series only sends and loads the vmstate at the start of migration. The vmstate is still sent (again) during the stop-and-copy phase, as it is today, to handle any deltas in the state since it was initially sent. A future patch in this series could avoid having to re-send and re-load the entire state again and instead focus only on the deltas. There is a slight, modest improvement in guest-visible downtime from this series. More specifically, when using iterative live migration with a virtio-net device, the downtime contributed by migrating a virtio-net device decreased from ~3.2ms to ~1.4ms on average: Before: ------- vmstate_downtime_load type=non-iterable idstr=0000:00:03.0/virtio-net instance_id=0 downtime=3594 After: ------ vmstate_downtime_load type=non-iterable idstr=0000:00:03.0/virtio-net instance_id=0 downtime=1607 This slight improvement is likely due to the initial vmstate_load_state call "warming up" pages in memory such that, when it's called a second time during the stop-and-copy phase, allocation and page-fault latencies are reduced. ------- Comments, suggestions, etc. are welcome here. Jonah Palmer (6): migration: Add virtio-iterative capability virtio-net: Reorder vmstate_virtio_net and helpers virtio-net: Add SaveVMHandlers for iterative migration virtio-net: iter live migration - migrate vmstate virtio,virtio-net: skip consistency check in virtio_load for iterative migration virtio-net: skip vhost_started assertion during iterative migration hw/net/virtio-net.c | 246 +++++++++++++++++++++++++++------ hw/virtio/virtio.c | 32 +++-- include/hw/virtio/virtio-net.h | 8 ++ include/hw/virtio/virtio.h | 7 + migration/savevm.c | 1 + qapi/migration.json | 7 +- 6 files changed, 247 insertions(+), 54 deletions(-) -- 2.47.1