VFIO update 2020-11-23

* Enable pre-copy dirty page tracking by default (Kirti Wankhede)
 
  * Mark migration as experimental (Alex Williamson)
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.14 (GNU/Linux)
 
 iQIcBAABAgAGBQJfu+0iAAoJECObm247sIsii0wP/A5Vq0NnF8WilOrlo9uRTKN3
 HnCt1Ipb41MBz/pByIHxBJMoRmLVXOL6QmlhH1rKHtoBnwnQc7mh5Rtl6vHQnTrZ
 AYnLopINQKMpKKuIaPH3BMaOjqmepm64pM3tpE8l3EYr/4RUnolZTJF6wNNMg6/l
 PC6BpmxXt/YUb9Why/SyUEDciQHsIyLTehn/1SEdssg9HSwncYBXqfntipKUAbUD
 7n4THj0gmH1ymZkSaVqNCkuAdm1+BT37u7LrZxlGxNL/3sRNYynDN1QCSImRrRI0
 Fv9/lbA/n7HkwUIkk7aYfTO0jhqdUVEVjTm5TRkyQYw0Qp4W0cXv4qUZXLa+sI+K
 TIwYQzjew9npwTdtChNXBYHIEd8xRdaxXcUJgiDNzbQu02yCxuWLFJkDjQbKhH7W
 XCqvTMKPtQ4mAZDkYAsKM/1XJ7H0QgwSrWjTK/J1QKjM8CRN45VxlsuUfdCwnGep
 ajClAbBiuFkHc8HESHqWCFGuC6OGVnGLgo9g787NXIKTYi5O7nnUMwS57L6laF7B
 K/MG6wjG3V0qSNOcuiVfBccLJotdR+zYgXOfoMJpEVcFVWrjPrlLikLQk6IaTlSE
 2Zy4qT8YiyfEnMhQ2TLXypBiG4n6cTPsw6Jqx9zoO2Wr9m0D/d05o5Dvx/2VaQeL
 svaZ5O348LK1lHJsQvdX
 =Hmnj
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/awilliam/tags/vfio-update-20201123.0' into staging

VFIO update 2020-11-23

 * Enable pre-copy dirty page tracking by default (Kirti Wankhede)

 * Mark migration as experimental (Alex Williamson)

# gpg: Signature made Mon 23 Nov 2020 17:10:58 GMT
# gpg:                using RSA key 239B9B6E3BB08B22
# gpg: Good signature from "Alex Williamson <alex.williamson@redhat.com>" [full]
# gpg:                 aka "Alex Williamson <alex@shazbot.org>" [full]
# gpg:                 aka "Alex Williamson <alwillia@redhat.com>" [full]
# gpg:                 aka "Alex Williamson <alex.l.williamson@gmail.com>" [full]
# Primary key fingerprint: 42F6 C04E 540B D1A9 9E7B  8A90 239B 9B6E 3BB0 8B22

* remotes/awilliam/tags/vfio-update-20201123.0:
  vfio: Change default dirty pages tracking behavior during migration
  vfio: Make migration support experimental

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2020-11-23 18:51:13 +00:00
commit 23895cbd82
4 changed files with 15 additions and 5 deletions

View file

@ -311,7 +311,7 @@ bool vfio_mig_active(void)
return true; return true;
} }
static bool vfio_devices_all_stopped_and_saving(VFIOContainer *container) static bool vfio_devices_all_saving(VFIOContainer *container)
{ {
VFIOGroup *group; VFIOGroup *group;
VFIODevice *vbasedev; VFIODevice *vbasedev;
@ -329,8 +329,11 @@ static bool vfio_devices_all_stopped_and_saving(VFIOContainer *container)
return false; return false;
} }
if ((migration->device_state & VFIO_DEVICE_STATE_SAVING) && if (migration->device_state & VFIO_DEVICE_STATE_SAVING) {
!(migration->device_state & VFIO_DEVICE_STATE_RUNNING)) { if ((vbasedev->pre_copy_dirty_page_tracking == ON_OFF_AUTO_OFF)
&& (migration->device_state & VFIO_DEVICE_STATE_RUNNING)) {
return false;
}
continue; continue;
} else { } else {
return false; return false;
@ -1125,7 +1128,7 @@ static void vfio_listerner_log_sync(MemoryListener *listener,
return; return;
} }
if (vfio_devices_all_stopped_and_saving(container)) { if (vfio_devices_all_saving(container)) {
vfio_sync_dirty_bitmap(container, section); vfio_sync_dirty_bitmap(container, section);
} }
} }

View file

@ -882,7 +882,7 @@ int vfio_migration_probe(VFIODevice *vbasedev, Error **errp)
Error *local_err = NULL; Error *local_err = NULL;
int ret = -ENOTSUP; int ret = -ENOTSUP;
if (!container->dirty_pages_supported) { if (!vbasedev->enable_migration || !container->dirty_pages_supported) {
goto add_blocker; goto add_blocker;
} }

View file

@ -3182,6 +3182,9 @@ static void vfio_instance_init(Object *obj)
static Property vfio_pci_dev_properties[] = { static Property vfio_pci_dev_properties[] = {
DEFINE_PROP_PCI_HOST_DEVADDR("host", VFIOPCIDevice, host), DEFINE_PROP_PCI_HOST_DEVADDR("host", VFIOPCIDevice, host),
DEFINE_PROP_STRING("sysfsdev", VFIOPCIDevice, vbasedev.sysfsdev), DEFINE_PROP_STRING("sysfsdev", VFIOPCIDevice, vbasedev.sysfsdev),
DEFINE_PROP_ON_OFF_AUTO("x-pre-copy-dirty-page-tracking", VFIOPCIDevice,
vbasedev.pre_copy_dirty_page_tracking,
ON_OFF_AUTO_ON),
DEFINE_PROP_ON_OFF_AUTO("display", VFIOPCIDevice, DEFINE_PROP_ON_OFF_AUTO("display", VFIOPCIDevice,
display, ON_OFF_AUTO_OFF), display, ON_OFF_AUTO_OFF),
DEFINE_PROP_UINT32("xres", VFIOPCIDevice, display_xres, 0), DEFINE_PROP_UINT32("xres", VFIOPCIDevice, display_xres, 0),
@ -3194,6 +3197,8 @@ static Property vfio_pci_dev_properties[] = {
VFIO_FEATURE_ENABLE_REQ_BIT, true), VFIO_FEATURE_ENABLE_REQ_BIT, true),
DEFINE_PROP_BIT("x-igd-opregion", VFIOPCIDevice, features, DEFINE_PROP_BIT("x-igd-opregion", VFIOPCIDevice, features,
VFIO_FEATURE_ENABLE_IGD_OPREGION_BIT, false), VFIO_FEATURE_ENABLE_IGD_OPREGION_BIT, false),
DEFINE_PROP_BOOL("x-enable-migration", VFIOPCIDevice,
vbasedev.enable_migration, false),
DEFINE_PROP_BOOL("x-no-mmap", VFIOPCIDevice, vbasedev.no_mmap, false), DEFINE_PROP_BOOL("x-no-mmap", VFIOPCIDevice, vbasedev.no_mmap, false),
DEFINE_PROP_BOOL("x-balloon-allowed", VFIOPCIDevice, DEFINE_PROP_BOOL("x-balloon-allowed", VFIOPCIDevice,
vbasedev.ram_block_discard_allowed, false), vbasedev.ram_block_discard_allowed, false),

View file

@ -123,12 +123,14 @@ typedef struct VFIODevice {
bool needs_reset; bool needs_reset;
bool no_mmap; bool no_mmap;
bool ram_block_discard_allowed; bool ram_block_discard_allowed;
bool enable_migration;
VFIODeviceOps *ops; VFIODeviceOps *ops;
unsigned int num_irqs; unsigned int num_irqs;
unsigned int num_regions; unsigned int num_regions;
unsigned int flags; unsigned int flags;
VFIOMigration *migration; VFIOMigration *migration;
Error *migration_blocker; Error *migration_blocker;
OnOffAuto pre_copy_dirty_page_tracking;
} VFIODevice; } VFIODevice;
struct VFIODeviceOps { struct VFIODeviceOps {