[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 17/47] vfio/migration: Don't emit STOP_COPY VFIO migration QAPI ev
From: |
Cédric Le Goater |
Subject: |
[PULL 17/47] vfio/migration: Don't emit STOP_COPY VFIO migration QAPI event twice |
Date: |
Wed, 22 May 2024 11:54:12 +0200 |
From: Avihai Horon <avihaih@nvidia.com>
When migrating a VFIO device that supports pre-copy, it is transitioned
to STOP_COPY twice: once in vfio_vmstate_change() and second time in
vfio_save_complete_precopy().
The second transition is harmless, as it's a STOP_COPY->STOP_COPY no-op
transition. However, with the newly added VFIO migration QAPI event, the
STOP_COPY event is undesirably emitted twice.
Prevent this by returning early in vfio_migration_set_state() if
new_state is the same as current device state.
Note that the STOP_COPY transition in vfio_save_complete_precopy() is
essential for VFIO devices that don't support pre-copy, for migrating an
already stopped guest and for snapshots.
Signed-off-by: Avihai Horon <avihaih@nvidia.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
hw/vfio/migration.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index
af579b868d7caa726fde1eeb73c832ebc3136a7a..56edffaf6251e28e39ef32991394697abb1b9e55
100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -150,6 +150,10 @@ static int vfio_migration_set_state(VFIODevice *vbasedev,
g_strdup_printf("%s: Failed setting device state to %s.",
vbasedev->name, mig_state_to_str(new_state));
+ if (new_state == migration->device_state) {
+ return 0;
+ }
+
feature->argsz = sizeof(buf);
feature->flags =
VFIO_DEVICE_FEATURE_SET | VFIO_DEVICE_FEATURE_MIG_DEVICE_STATE;
--
2.45.1
- [PULL 13/47] vfio/ccw: Make vfio_ccw_register_irq_notifier() return a bool, (continued)
- [PULL 13/47] vfio/ccw: Make vfio_ccw_register_irq_notifier() return a bool, Cédric Le Goater, 2024/05/22
- [PULL 22/47] vfio: Make VFIOIOMMUClass::setup() return bool, Cédric Le Goater, 2024/05/22
- [PULL 24/47] vfio/container: Make vfio_connect_container() return bool, Cédric Le Goater, 2024/05/22
- [PULL 23/47] vfio: Make VFIOIOMMUClass::add_window() and its wrapper return bool, Cédric Le Goater, 2024/05/22
- [PULL 30/47] vfio/display: Fix error path in call site of ramfb_setup(), Cédric Le Goater, 2024/05/22
- [PULL 25/47] vfio/container: Make vfio_set_iommu() return bool, Cédric Le Goater, 2024/05/22
- [PULL 31/47] vfio/display: Make vfio_display_*() return bool, Cédric Le Goater, 2024/05/22
- [PULL 32/47] vfio/helpers: Use g_autofree in vfio_set_irq_signaling(), Cédric Le Goater, 2024/05/22
- [PULL 28/47] vfio/cpr: Make vfio_cpr_register_container() return bool, Cédric Le Goater, 2024/05/22
- [PULL 29/47] backends/iommufd: Make iommufd_backend_*() return bool, Cédric Le Goater, 2024/05/22
- [PULL 17/47] vfio/migration: Don't emit STOP_COPY VFIO migration QAPI event twice,
Cédric Le Goater <=
- [PULL 38/47] vfio/pci: Make vfio_pci_relocate_msix() and vfio_msix_early_setup() return a bool, Cédric Le Goater, 2024/05/22
- [PULL 34/47] vfio/helpers: Make vfio_device_get_name() return bool, Cédric Le Goater, 2024/05/22
- [PULL 36/47] vfio/ccw: Make vfio_ccw_get_region() return a bool, Cédric Le Goater, 2024/05/22
- [PULL 26/47] vfio/container: Make vfio_get_device() return bool, Cédric Le Goater, 2024/05/22
- [PULL 27/47] vfio/iommufd: Make iommufd_cdev_*() return bool, Cédric Le Goater, 2024/05/22
- [PULL 33/47] vfio/helpers: Make vfio_set_irq_signaling() return bool, Cédric Le Goater, 2024/05/22
- [PULL 37/47] vfio/pci: Make vfio_intx_enable_kvm() return a bool, Cédric Le Goater, 2024/05/22
- [PULL 39/47] vfio/pci: Make vfio_populate_device() return a bool, Cédric Le Goater, 2024/05/22
- [PULL 42/47] vfio/pci: Make capability related functions return bool, Cédric Le Goater, 2024/05/22
- [PULL 41/47] vfio/pci: Make vfio_populate_vga() return bool, Cédric Le Goater, 2024/05/22