[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 07/14] migration: allow unplug during migration for failover devic
From: |
Michael S. Tsirkin |
Subject: |
[PULL 07/14] migration: allow unplug during migration for failover devices |
Date: |
Tue, 29 Oct 2019 19:00:37 -0400 |
From: Jens Freimann <address@hidden>
In "b06424de62 migration: Disable hotplug/unplug during migration" we
added a check to disable unplug for all devices until we have figured
out what works. For failover primary devices qdev_unplug() is called
from the migration handler, i.e. during migration.
This patch adds a flag to DeviceState which is set to false for all
devices and makes an exception for PCI devices that are also
primary devices in a failover pair.
Signed-off-by: Jens Freimann <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/core/qdev.c | 1 +
hw/pci/pci.c | 1 +
include/hw/qdev-core.h | 1 +
qdev-monitor.c | 2 +-
4 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 3b8d43d0fd..cf1ba28fe3 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -996,6 +996,7 @@ static void device_initfn(Object *obj)
dev->instance_id_alias = -1;
dev->realized = false;
+ dev->allow_unplug_during_migration = false;
object_property_add_bool(obj, "realized",
device_get_realized, device_set_realized, NULL);
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 824ab4ed7b..c68498c0de 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -2130,6 +2130,7 @@ static void pci_qdev_realize(DeviceState *qdev, Error
**errp)
pci_qdev_unrealize(DEVICE(pci_dev), NULL);
return;
}
+ qdev->allow_unplug_during_migration = true;
}
/* rom loading */
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 710981af36..1518495b1e 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -156,6 +156,7 @@ struct DeviceState {
bool pending_deleted_event;
QemuOpts *opts;
int hotplugged;
+ bool allow_unplug_during_migration;
BusState *parent_bus;
QLIST_HEAD(, NamedGPIOList) gpios;
QLIST_HEAD(, BusState) child_bus;
diff --git a/qdev-monitor.c b/qdev-monitor.c
index ffa08c670f..e6b112eb0a 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -851,7 +851,7 @@ void qdev_unplug(DeviceState *dev, Error **errp)
return;
}
- if (!migration_is_idle()) {
+ if (!migration_is_idle() && !dev->allow_unplug_during_migration) {
error_setg(errp, "device_del not allowed while migrating");
return;
}
--
MST
- [PULL 00/14] virtio: features, cleanups, Michael S. Tsirkin, 2019/10/29
- [PULL 01/14] qdev/qbus: add hidden device support, Michael S. Tsirkin, 2019/10/29
- [PULL 02/14] pci: add option for net failover, Michael S. Tsirkin, 2019/10/29
- [PULL 03/14] pci: mark devices partially unplugged, Michael S. Tsirkin, 2019/10/29
- [PULL 04/14] pci: mark device having guest unplug request pending, Michael S. Tsirkin, 2019/10/29
- [PULL 05/14] qapi: add unplug primary event, Michael S. Tsirkin, 2019/10/29
- [PULL 06/14] qapi: add failover negotiated event, Michael S. Tsirkin, 2019/10/29
- [PULL 07/14] migration: allow unplug during migration for failover devices,
Michael S. Tsirkin <=
- [PULL 08/14] migration: add new migration state wait-unplug, Michael S. Tsirkin, 2019/10/29
- [PULL 09/14] libqos: tolerate wait-unplug migration state, Michael S. Tsirkin, 2019/10/29
- [PULL 11/14] vfio: unplug failover primary device before migration, Michael S. Tsirkin, 2019/10/29
- [PULL 12/14] virtio/vhost: Use auto_rcu_read macros, Michael S. Tsirkin, 2019/10/29
- [PULL 13/14] virtio_net: use RCU_READ_LOCK_GUARD, Michael S. Tsirkin, 2019/10/29
- [PULL 10/14] net/virtio: add failover support, Michael S. Tsirkin, 2019/10/29
- [PULL 14/14] virtio: Use auto rcu_read macros, Michael S. Tsirkin, 2019/10/29
- Re: [PULL 00/14] virtio: features, cleanups, Peter Maydell, 2019/10/30