non-migratable devices
PATCH 1/3 vmstate: add no_migrate flag to VMStateDescription
In reply to Gerd HoffmannThis allows to easily tag devices as non-migratable, so any attempt to migrate a virtual machine with the device in question active will make migration fail.
--- hw/hw.h | 1 + savevm.c | 1 + 2 files changed, 2 insertions(+), 0 deletions(-)
hw/hw.h +1 -0
@@ -324,6 +324,7 @@ typedef struct VMStateSubsection {struct VMStateDescription {const char *name; +int no_migrate;int version_id;int minimum_version_id;int minimum_version_id_old;
savevm.c +1 -0
@@ -1234,6 +1234,7 @@ int vmstate_register_with_alias_id(DeviceState *dev, int instance_id, se->opaque = opaque; se->vmsd = vmsd; se->alias_id = alias_id; + se->no_migrate = vmsd->no_migrate;if (dev && dev->parent_bus && dev->parent_bus->info->get_dev_path) {char *id = dev->parent_bus->info->get_dev_path (dev);
Signature · 1 line
1.7.1
PATCH 2/3 ahci doesn't support migration
In reply to Gerd Hoffmann--- hw/ide/ich.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
hw/ide/ich.c +6 -0
@@ -72,6 +72,11 @@#include <hw/ide/pci.h> #include <hw/ide/ahci.h> +static const VMStateDescription vmstate_ahci = { + .name ="ahci" , + .no_migrate =1 , +}; +static int pci_ich9_ahci_init (PCIDevice *dev) {struct AHCIPCIState *d;
@@ -123,6 +128,7 @@ static PCIDeviceInfo ich_ahci_info[] = { .qdev.name = "ich9-ahci", .qdev.alias = "ahci", .qdev.size = sizeof(AHCIPCIState), + .qdev.vmsd = &vmstate_ahci, .init = pci_ich9_ahci_init, .exit = pci_ich9_uninit, .config_write = pci_ich9_write_config,
Signature · 1 line
1.7.1
cover non-migratable devices
Hi,
This patch series adds an easy way to tag devices as non-migratable puts it into use for ahci and ehci.
Gerd Hoffmann (3):
vmstate: add no_migrate flag to VMStateDescription ahci doesn't support migration
ehci doesn't support migration
hw/hw.h | 1 + hw/ide/ich.c | 6 ++++++ hw/usb-ehci.c | 6 ++++++ savevm.c | 1 + 4 files changed, 14 insertions(+), 0 deletions(-)
PATCH 3/3 ehci doesn't support migration
--- hw/usb-ehci.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
hw/usb-ehci.c +6 -0
@@ -2136,9 +2136,15 @@ static USBBusOps ehci_bus_ops = { .device_destroy = ehci_device_destroy, }; +static const VMStateDescription vmstate_ehci = { + .name ="ehci" , + .no_migrate =1 , +}; +static PCIDeviceInfo ehci_info = { .qdev.name ="usb-ehci" , .qdev.size =sizeof (EHCIState), + .qdev.vmsd = &vmstate_ehci, .init = usb_ehci_initfn, .vendor_id =PCI_VENDOR_ID_INTEL , .device_id =PCI_DEVICE_ID_INTEL_82801D ,
Signature · 1 line
1.7.1
Quoted 10 lines · Gerd Hoffmann
Hi,This patch series adds an easy way to tag devices as non-migratable puts it into use for ahci and ehci.
Gerd Hoffmann (3):
vmstate: addno_migrateflag to VMStateDescription ahci doesn't support migration
ehci doesn't support migration
Quoted 8 lines
hw/hw.h | 1 + hw/ide/ich.c | 6 ++++++ hw/usb-ehci.c | 6 ++++++ savevm.c | 1 + 4 files changed, 14 insertions(+), 0 deletions(-)
ACK series
For scsi-cd and other empty-but-generally-migratable devices we should probably add an empty vmstate, so that any further addition can be done as subsections.
Paolo
Hi,
Quoted 3 lines
For scsi-cd and other empty-but-generally-migratable devices we should probably add an empty vmstate, so that any further addition can be done as subsections.
That will break migration to older versions which don't know about the new sections, even if they are empty ...
cheers,
Gerd
Quoted 8 lines · Gerd Hoffmann
Quoted 5 lines
For scsi-cd and other empty-but-generally-migratable devices we should probably add an empty vmstate, so that any further addition can be done as subsections.
That will break migration to older versions which don't know about the new sections, even if they are empty ...
scsi-cd is new in 0.15, older versions have scsi-disk only. That's why we should take the occasion to add the empty vmstate at least to it.
For other devices, it's better to make the breakage in a single version.
It also allows to make 0.15 the "flag day" where each device shall
have a VMState or the entire VM will not be migratable. If desired, in the future we can revert this behavior for pc-0.14 and earlier machines.
Paolo
Quoted 8 lines · Gerd Hoffmann
Hi,
Quoted 3 lines
For scsi-cd and other empty-but-generally-migratable devices we should probably add an empty vmstate, so that any further addition can be done as subsections.
That will break migration to older versions which don't know about the new sections, even if they are empty ...
Send them only when running a sufficiently recent -M?
Hi,
Quoted 2 lines
scsi-cd is new in 0.15, older versions have scsi-disk only. That's why we should take the occasion to add the empty vmstate at least to it.
Ok, good opportunity in that specific case.
Quoted 3 lines
For other devices, it's better to make the breakage in a single version. It also allows to make 0.15 the "flag day" where each device shall have a VMState or the entire VM will not be migratable.
Not that easy given that we didn't fully migrate to vmstate yet, otherwise we could simply fail migration in case we find any device with qdev->vmsd == NULL.
Quoted 2 lines
If desired, in the
future we can revert this behavior for pc-0.14 and earlier machines.
And I'm still looking for a sane way to handle *this*.
cheers,
Gerd
Quoted 7 lines · Gerd Hoffmann
Quoted 4 lines
scsi-cd is new in 0.15, older versions have scsi-disk only. That's why we should take the occasion to add the empty vmstate at least to it.
Ok, good opportunity in that specific case.
Quoted 7 lines
Quoted 3 lines
For other devices, it's better to make the breakage in a single version. It also allows to make 0.15 the "flag day" where each device shall have a VMState or the entire VM will not be migratable.
Not that easy given that we didn't fully migrate to vmstate yet, otherwise we could simply fail migration in case we find any device with
qdev->vmsd== NULL.
You can always add
#define VMSD_NONE ((const VMStateDescription *) 1)
Quoted 4 lines
Quoted 2 lines
If desired, in the
future we can revert this behavior for pc-0.14 and earlier machines.And I'm still looking for a sane way to handle *this*.
One possibility is to add device name remapping to machine types, like "ide is actually ide-0.14 when using pc-0.14" and put a different VMState in ide-0.14.
Paolo
Hi,
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
If desired, in the
future we can revert this behavior for pc-0.14 and earlier machines.And I'm still looking for a sane way to handle *this*.
One possibility is to add device name remapping to machine types, like "ide is actually ide-0.14 when using pc-0.14" and put a different VMState in ide-0.14.
That isn't very different from subsections.
Problem is that the old qemu version doesn't have the section at all, not that it looks somehow different.
cheers,
Gerd
Quoted 9 lines · Gerd Hoffmann
Quoted 4 lines
One possibility is to add device name remapping to machine types, like "ide is actually ide-0.14 when using pc-0.14" and put a different VMState in ide-0.14.
That isn't very different from subsections.
Problem is that the old qemu version doesn't have the section at all, not that it looks somehow different.
No, I meant a different qdev name, i.e. mapping the same device name to a different DeviceInfo.
Paolo
Quoted 6 lines · Paolo Bonzini
Quoted 5 lines · Gerd Hoffmann
Quoted 4 lines
One possibility is to add device name remapping to machine types, like "ide is actually ide-0.14 when using pc-0.14" and put a different VMState in ide-0.14.
Quoted 7 lines
Quoted 4 lines
That isn't very different from subsections.
Problem is that the old qemu version doesn't have the section at all, not that it looks somehow different.
No, I meant a different qdev name, i.e. mapping the same device name to a different DeviceInfo.
That is an idea. This could also replace compat properties (by giving ide-0.14 different default values for the properties) and thereby move the compat info from hw/pc.c to hw/ide/xxx.c.
cheers,
Gerd
[Qemu-devel] [PATCH 4/3] vmstate: complain about devices without vmstate
In reply to Gerd Hoffmann--- hw/hw.h | 2 ++ hw/qdev.c | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletions(-)
hw/hw.h +2 -0
@@ -336,6 +336,8 @@ struct VMStateDescription {const VMStateSubsection *subsections; }; +#define VMSD_NONE ((const VMStateDescription*)1) +extern const VMStateInfo vmstate_info_bool;extern const VMStateInfo vmstate_info_int8;
hw/qdev.c +6 -1
@@ -283,7 +283,12 @@ int qdev_init(DeviceState *dev)qdev_free (dev);return rc; } -if (dev->info->vmsd) { +if (dev->info->vmsd ==NULL ) { +/* TODO: fixup qemu source code, then make this an assert() */ +error_report ("WARNING: device %s has no vmstate\n" , dev->info->name); + }else if (dev->info->vmsd ==VMSD_NONE ) { +/* device doesn't need vmstate */ ; + }else {vmstate_register_with_alias_id (dev,-1 , dev->info->vmsd, dev, dev->instance_id_alias, dev->alias_required_for_version);
Signature · 1 line
1.7.1
Re: [Qemu-devel] [PATCH 1/3] vmstate: add no_migrate flag to VMStateDescription
In reply to Gerd HoffmannQuoted 5 lines · Gerd Hoffmann
This allows to easily tag devices as non-migratable, so any attempt to migrate a virtual machine with the device in question active will make migration fail.
Signed-off-by Gerd Hoffmann<[email protected]>
register_device_unmigratable()?
Regards,
Anthony Liguori
Quoted 29 lines
--- hw/hw.h | 1 + savevm.c | 1 + 2 files changed, 2 insertions(+), 0 deletions(-)hw/hw.h +1
-0@@ -324,6 +324,7 @@ typedef struct VMStateSubsection {struct VMStateDescription {const char *name; +int no_migrate;int version_id;int minimum_version_id;int minimum_version_id_old;savevm.c +1
-0@@ -1234,6 +1234,7 @@ int vmstate_register_with_alias_id(DeviceState *dev, int instance_id, se->opaque = opaque; se->vmsd = vmsd; se->alias_id = alias_id; + se->no_migrate = vmsd->no_migrate;if (dev&& dev->parent_bus&& dev->parent_bus->info->get_dev_path) {char *id = dev->parent_bus->info->get_dev_path (dev);
Re: [Qemu-devel] [PATCH 1/3] vmstate: add no_migrate flag to VMStateDescription
Quoted 8 lines · Anthony Liguori
Quoted 5 lines · Gerd Hoffmann
This allows to easily tag devices as non-migratable, so any attempt to migrate a virtual machine with the device in question active will make migration fail.
Signed-off-by Gerd Hoffmann<[email protected]>
register_device_unmigratable()?
That is just a more complicated way to do the same ;) Wanna have a patch to zap it?
cheers,
Gerd
Re: [Qemu-devel] [PATCH 1/3] vmstate: add no_migrate flag to VMStateDescription
Quoted 4 lines · Gerd Hoffmann
Quoted 1 line · Anthony Liguori
register_device_unmigratable()?Wanna have a patch to zap it?
Ah, no, we can't, for ivshmem this isn't fixed but depends on the configuration, so a static flag in the VMStateDescription doesn't cut it.
cheers,
Gerd
Re: [Qemu-devel] [PATCH 1/3] vmstate: add no_migrate flag to VMStateDescription
Quoted 8 lines · Gerd Hoffmann
Quoted 4 lines · Gerd Hoffmann
Quoted 1 line · Anthony Liguori
register_device_unmigratable()?Wanna have a patch to zap it?
Ah, no, we can't, for ivshmem this isn't fixed but depends on the configuration, so a static flag in the VMStateDescription doesn't cut it.
Right, but can we have some continuity at least between the two interfaces?
At least make the vmstate flag 'unmigratable' or rename the function to qdev_set_no_migrate().
BTW, should this be a vmstate flag or a qdev flag?
Regards,
Anthony Liguori
Quoted 4 lines
cheers,
Gerd
Re: [Qemu-devel] [PATCH 1/3] vmstate: add no_migrate flag to VMStateDescription
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
register_device_unmigratable()?Right, but can we have some continuity at least between the two interfaces?
At least make the vmstate flag 'unmigratable' or rename the function to
qdev_set_no_migrate().
Will rename the flag.
Quoted 1 line
BTW, should this be a vmstate flag or a qdev flag?
vmstate. savevm.c doesn't look at the qdev tree.
cheers,
Gerd