]> www.infradead.org Git - users/dwmw2/linux.git/commit
vfio/virtio: Add PRE_COPY support for live migration
authorYishai Hadas <yishaih@nvidia.com>
Wed, 13 Nov 2024 11:51:59 +0000 (13:51 +0200)
committerAlex Williamson <alex.williamson@redhat.com>
Wed, 13 Nov 2024 23:28:32 +0000 (16:28 -0700)
commit6cea64b1db8885b82c226f9f80c2325f39d9d309
tree47f23100bb756f422b2ca574ac7b0ba543c45d92
parent0bbc82e4ec79df437de49d45c512335d97f9c7ce
vfio/virtio: Add PRE_COPY support for live migration

Add PRE_COPY support for live migration.

This functionality may reduce the downtime upon STOP_COPY as of letting
the target machine to get some 'initial data' from the source once the
machine is still in its RUNNING state and let it prepares itself
pre-ahead to get the final STOP_COPY data.

As the Virtio specification does not support reading partial or
incremental device contexts. This means that during the PRE_COPY state,
the vfio-virtio driver reads the full device state.

As the device state can be changed and the benefit is highest when the
pre copy data closely matches the final data we read it in a rate
limiter mode.

This means we avoid reading new data from the device for a specified
time interval after the last read.

With PRE_COPY enabled, we observed a downtime reduction of approximately
70-75% in various scenarios compared to when PRE_COPY was disabled,
while keeping the total migration time nearly the same.

Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
Link: https://lore.kernel.org/r/20241113115200.209269-7-yishaih@nvidia.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/pci/virtio/common.h
drivers/vfio/pci/virtio/migrate.c