[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH RESEND 6/6] savevm: Remove register_device_unmigrata
From: |
Alex Williamson |
Subject: |
[Qemu-devel] [PATCH RESEND 6/6] savevm: Remove register_device_unmigratable() |
Date: |
Fri, 05 Nov 2010 15:16:55 -0600 |
User-agent: |
StGIT/0.14.3 |
Now that the save state handlers can return error, individual drivers
can cancel a migration if they hit an error or don't support it. This
makes the unmigratable callback redundant. Remove it and change the
only user to cancel the migration in a set_params callback, which
actually happens much earlier in the migration than the unmigratable
flag was checked.
Signed-off-by: Alex Williamson <address@hidden>
---
hw/hw.h | 2 --
hw/ivshmem.c | 20 ++++++++++++++------
savevm.c | 31 -------------------------------
3 files changed, 14 insertions(+), 39 deletions(-)
diff --git a/hw/hw.h b/hw/hw.h
index dac89c7..42bdb7f 100644
--- a/hw/hw.h
+++ b/hw/hw.h
@@ -264,8 +264,6 @@ int register_savevm_live(DeviceState *dev,
void *opaque);
void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque);
-void register_device_unmigratable(DeviceState *dev, const char *idstr,
- void *opaque);
typedef void QEMUResetHandler(void *opaque);
diff --git a/hw/ivshmem.c b/hw/ivshmem.c
index 3726a7f..4164861 100644
--- a/hw/ivshmem.c
+++ b/hw/ivshmem.c
@@ -616,6 +616,18 @@ static void ivshmem_setup_msi(IVShmemState * s) {
s->eventfd_table = qemu_mallocz(s->vectors * sizeof(EventfdEntry));
}
+static int ivshmem_set_param(int blk_enable, int shared, void *opaque)
+{
+ IVShmemState *proxy = opaque;
+
+ if (proxy->role_val == IVSHMEM_PEER) {
+ fprintf(stderr,
+ "ivshmem device in peer role, cannot be migrated or saved\n");
+ return -EINVAL;
+ }
+ return 0;
+}
+
static int ivshmem_save(QEMUFile* f, void *opaque)
{
IVShmemState *proxy = opaque;
@@ -683,8 +695,8 @@ static int pci_ivshmem_init(PCIDevice *dev)
s->ivshmem_size = ivshmem_get_size(s);
}
- register_savevm(&s->dev.qdev, "ivshmem", 0, 0, ivshmem_save, ivshmem_load,
- dev);
+ register_savevm_live(&s->dev.qdev, "ivshmem", 0, 0, ivshmem_set_param,
+ NULL, ivshmem_save, ivshmem_load, dev);
/* IRQFD requires MSI */
if (ivshmem_has_feature(s, IVSHMEM_IOEVENTFD) &&
@@ -707,10 +719,6 @@ static int pci_ivshmem_init(PCIDevice *dev)
s->role_val = IVSHMEM_MASTER; /* default */
}
- if (s->role_val == IVSHMEM_PEER) {
- register_device_unmigratable(&s->dev.qdev, "ivshmem", s);
- }
-
pci_conf = s->dev.config;
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_REDHAT_QUMRANET);
pci_conf[0x02] = 0x10;
diff --git a/savevm.c b/savevm.c
index 521edc8..17e4c2f 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1039,7 +1039,6 @@ typedef struct SaveStateEntry {
const VMStateDescription *vmsd;
void *opaque;
CompatEntry *compat;
- int no_migrate;
} SaveStateEntry;
@@ -1103,7 +1102,6 @@ int register_savevm_live(DeviceState *dev,
se->load_state = load_state;
se->opaque = opaque;
se->vmsd = NULL;
- se->no_migrate = 0;
if (dev && dev->parent_bus && dev->parent_bus->info->get_dev_path) {
char *id = dev->parent_bus->info->get_dev_path(dev);
@@ -1170,31 +1168,6 @@ void unregister_savevm(DeviceState *dev, const char
*idstr, void *opaque)
}
}
-/* mark a device as not to be migrated, that is the device should be
- unplugged before migration */
-void register_device_unmigratable(DeviceState *dev, const char *idstr,
- void *opaque)
-{
- SaveStateEntry *se;
- char id[256] = "";
-
- if (dev && dev->parent_bus && dev->parent_bus->info->get_dev_path) {
- char *path = dev->parent_bus->info->get_dev_path(dev);
- if (path) {
- pstrcpy(id, sizeof(id), path);
- pstrcat(id, sizeof(id), "/");
- qemu_free(path);
- }
- }
- pstrcat(id, sizeof(id), idstr);
-
- QTAILQ_FOREACH(se, &savevm_handlers, entry) {
- if (strcmp(se->idstr, id) == 0 && se->opaque == opaque) {
- se->no_migrate = 1;
- }
- }
-}
-
int vmstate_register_with_alias_id(DeviceState *dev, int instance_id,
const VMStateDescription *vmsd,
void *opaque, int alias_id,
@@ -1410,10 +1383,6 @@ static int vmstate_load(QEMUFile *f, SaveStateEntry *se,
int version_id)
static int vmstate_save(QEMUFile *f, SaveStateEntry *se)
{
- if (se->no_migrate) {
- return -1;
- }
-
if (!se->vmsd) { /* Old style */
return se->save_state(f, se->opaque);
}
- [Qemu-devel] [PATCH RESEND 0/6] Save state error handling (kill off no_migrate), Alex Williamson, 2010/11/05
- [Qemu-devel] [PATCH RESEND 1/6] savevm: Allow SaveStateHandler() to return error, Alex Williamson, 2010/11/05
- [Qemu-devel] [PATCH RESEND 2/6] savevm: Allow vmsd->pre_save to return error, Alex Williamson, 2010/11/05
- [Qemu-devel] [PATCH RESEND 3/6] pci: Allow pci_device_save() to return error, Alex Williamson, 2010/11/05
- [Qemu-devel] [PATCH RESEND 4/6] virtio: Allow virtio_save() errors, Alex Williamson, 2010/11/05
- [Qemu-devel] [PATCH RESEND 5/6] savevm: Allow set_params and save_live_state to error, Alex Williamson, 2010/11/05
- [Qemu-devel] [PATCH RESEND 6/6] savevm: Remove register_device_unmigratable(),
Alex Williamson <=