Skip to contentSkip to conversation

non-migratable devices

GIT PULL In review Gerd Hoffmann 4 participants 17 messages Jul 20, 2011 – Jul 29, 2011

lore
Share & tools
lore
#0 lore raw

Hi,

This patch series adds an easy way to tag devices as non-migratable and puts it into use for ahci, ehci and a number of usb devices.

cheers,
Gerd

The following changes since commit 03ff09580ef6cbc4a893b6e3e6bbff33180ec70a:

Merge remote-tracking branch 'agraf/xen-next' into staging (2011-07-19 08:04:35 -0500)

are available in the git repository at:

git://git.kraxel.org/qemu migration.1

Gerd Hoffmann (9):
vmstate: add no_migrate flag to VMStateDescription
vmstate: complain about devices without vmstate ahci doesn't support migration
ehci doesn't support migration
usb storage: first migration support bits. usb-wacom doesn't support migration usb-bt doesn't support migration
usb-net doesn't support migration usb-serial doesn't support migration

 hw/hw.h         |    3 +++
 hw/ide/ich.c    |    6 ++++++
 hw/qdev.c       |    7 ++++++-
 hw/usb-bt.c     |    6 ++++++
 hw/usb-ehci.c   |    7 +++++++
 hw/usb-msd.c    |   12 ++++++++++++
 hw/usb-net.c    |    6 ++++++
 hw/usb-serial.c |    7 +++++++
 hw/usb-wacom.c  |    6 ++++++
 savevm.c        |    1 +
 10 files changed, 60 insertions(+), 1 deletions(-)
#1 lore raw

PATCH 1/9 vmstate: add no_migrate flag to VMStateDescription

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.

---
 hw/hw.h  |    1 +
 savevm.c |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
hw/hw.h +1 -0
index 9dd7096..df6ca65 100644
@@ -324,6 +324,7 @@ typedef struct VMStateSubsection {
 
 struct VMStateDescription {
     const char *name;
+    int unmigratable;
     int version_id;
     int minimum_version_id;
     int minimum_version_id_old;
savevm.c +1 -0
index 8139bc7..1c5abe2 100644
@@ -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->unmigratable;
 
     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
#2 lore raw

PATCH 2/9 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
index df6ca65..d839af1 100644
@@ -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
index 292b52f..fafbbae 100644
@@ -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
#3 lore raw

Re: [Qemu-devel] [PATCH 2/9] vmstate: complain about devices without vmstate

hw/qdev.c int qdev_init(DeviceState *dev) · line 291

Quoted 13 lines · Gerd Hoffmann
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 {

I would prefer it if we didn't add this sort of targeted-at-qemu-developers warning unless there was a reasonable period of time before the next release where devices which provoke the warning message can be fixed. In particular, should we postpone putting in the warning message until after 0.15 branches?

-- PMM

#4 lore raw

Re: [Qemu-devel] [PATCH 2/9] vmstate: complain about devices without vmstate

Quoted 11 lines · Peter Maydell
Quoted 10 lines · Gerd Hoffmann
hw/qdev.c +3 -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);
Quoted 8 lines

hw/qdev.c int qdev_init(DeviceState *dev) · line 291

Quoted 3 lines
hw/qdev.c +3 -0
+    } else if (dev->info->vmsd == VMSD_NONE) {
+        /* device doesn't need vmstate */;
+    } else {

I would prefer it if we didn't add this sort of targeted-at-qemu-developers warning unless there was a reasonable period of time before the next release where devices which provoke the warning message can be fixed. In particular, should we postpone putting in the warning message until after 0.15 branches?

Agree, makes sense to postpone that one to 0.16-devel, otherwise we'll just bug the users for no reason.

Pushed migration.2 branch with that patch dropped.

cheers,
Gerd

#5 lore raw

PATCH 3/9 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
index 054e073..d241ea8 100644
@@ -72,6 +72,11 @@
 #include <hw/ide/pci.h>
 #include <hw/ide/ahci.h>
 
+static const VMStateDescription vmstate_ahci = {
+    .name = "ahci",
+    .unmigratable = 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
#6 lore raw

PATCH 4/9 ehci doesn't support migration

In reply to Gerd Hoffmann
---
 hw/usb-ehci.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
hw/usb-ehci.c +7 -0
index a4758f9..8b0dcc3 100644
@@ -2244,6 +2244,11 @@ static USBBusOps ehci_bus_ops = {
     .register_companion = ehci_register_companion,
 };
 
+static const VMStateDescription vmstate_ehci = {
+    .name = "ehci",
+    .unmigratable = 1,
+};
+
 static Property ehci_properties[] = {
     DEFINE_PROP_UINT32("freq",      EHCIState, freq, FRAME_TIMER_FREQ),
     DEFINE_PROP_UINT32("maxframes", EHCIState, maxframes, 128),
@@ -2254,6 +2259,7 @@ 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, /* ich4 */
@@ -2263,6 +2269,7 @@ static PCIDeviceInfo ehci_info[] = {
     },{
         .qdev.name    = "ich9-usb-ehci1",
         .qdev.size    = sizeof(EHCIState),
+        .qdev.vmsd    = &vmstate_ehci,
         .init         = usb_ehci_initfn,
         .vendor_id    = PCI_VENDOR_ID_INTEL,
         .device_id    = PCI_DEVICE_ID_INTEL_82801I_EHCI1,
Signature · 1 line
1.7.1
#7 lore raw

PATCH 5/9 usb storage: first migration support bits.

In reply to Gerd Hoffmann

Tag vmstate as unmigratable for the time being,
to be removed when mgration support is finished.

---
 hw/usb-msd.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
hw/usb-msd.c +12 -0
index 86582cc..8ed8594 100644
@@ -623,11 +623,23 @@ static USBDevice *usb_msd_init(const char *filename)
     return dev;
 }
 
+static const VMStateDescription vmstate_usb_msd = {
+    .name = "usb-storage",
+    .unmigratable = 1, /* FIXME: handle transactions which are in flight */
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .fields = (VMStateField []) {
+        VMSTATE_USB_DEVICE(dev, MSDState),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 static struct USBDeviceInfo msd_info = {
     .product_desc   = "QEMU USB MSD",
     .qdev.name      = "usb-storage",
     .qdev.fw_name      = "storage",
     .qdev.size      = sizeof(MSDState),
+    .qdev.vmsd      = &vmstate_usb_msd,
     .usb_desc       = &desc,
     .init           = usb_msd_initfn,
     .handle_packet  = usb_generic_handle_packet,
Signature · 1 line
1.7.1
#8 lore raw

Re: [Qemu-devel] [PATCH 5/9] usb storage: first migration support bits.

Quoted 2 lines · Gerd Hoffmann

Tag vmstate as unmigratable for the time being,
to be removed when mgration support is finished.

I'm going to handle this at the SCSI level by canceling all transactions on pre-load. Expect patches next week.

Paolo

#9 lore raw

PATCH 6/9 usb-wacom doesn't support migration

In reply to Gerd Hoffmann
---
 hw/usb-wacom.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
hw/usb-wacom.c +6 -0
index 9d348e1..d76ee97 100644
@@ -349,6 +349,11 @@ static int usb_wacom_initfn(USBDevice *dev)
     return 0;
 }
 
+static const VMStateDescription vmstate_usb_wacom = {
+    .name = "usb-wacom",
+    .unmigratable = 1,
+};
+
 static struct USBDeviceInfo wacom_info = {
     .product_desc   = "QEMU PenPartner Tablet",
     .qdev.name      = "usb-wacom-tablet",
@@ -356,6 +361,7 @@ static struct USBDeviceInfo wacom_info = {
     .usbdevice_name = "wacom-tablet",
     .usb_desc       = &desc_wacom,
     .qdev.size      = sizeof(USBWacomState),
+    .qdev.vmsd      = &vmstate_usb_wacom,
     .init           = usb_wacom_initfn,
     .handle_packet  = usb_generic_handle_packet,
     .handle_reset   = usb_wacom_handle_reset,
Signature · 1 line
1.7.1
#10 lore raw

Re: [Qemu-devel] [PATCH 6/9] usb-wacom doesn't support migration

Quoted 22 lines · Gerd Hoffmann
---
  hw/usb-wacom.c |    6 ++++++
  1 files changed, 6 insertions(+), 0 deletions(-)
hw/usb-wacom.c +5 -0
index 9d348e1..d76ee97 100644
@@ -349,6 +349,11 @@ static int usb_wacom_initfn(USBDevice *dev)
      return 0;
  }
 
+static const VMStateDescription vmstate_usb_wacom = {
+    .name = "usb-wacom",
+    .unmigratable = 1,
+};
+
  static struct USBDeviceInfo wacom_info = {
      .product_desc   = "QEMU PenPartner Tablet",
      .qdev.name      = "usb-wacom-tablet",

hw/usb-wacom.c static struct USBDeviceInfo wacom_info = { · line 367

Quoted 7 lines
hw/usb-wacom.c +1 -0
@@ -356,6 +361,7 @@ static struct USBDeviceInfo wacom_info = {
      .usbdevice_name = "wacom-tablet",
      .usb_desc       =&desc_wacom,
      .qdev.size      = sizeof(USBWacomState),
+    .qdev.vmsd      =&vmstate_usb_wacom,
      .init           = usb_wacom_initfn,
      .handle_packet  = usb_generic_handle_packet,
      .handle_reset   = usb_wacom_handle_reset,

Since usb_wacom does not support auto-wakeup, it should actually kinda sorta work like usb-tablet used to, right?

Paolo

#11 lore raw

PATCH 7/9 usb-bt doesn't support migration

In reply to Gerd Hoffmann
---
 hw/usb-bt.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
hw/usb-bt.c +6 -0
index e364513..4557802 100644
@@ -548,10 +548,16 @@ USBDevice *usb_bt_init(HCIInfo *hci)
     return dev;
 }
 
+static const VMStateDescription vmstate_usb_bt = {
+    .name = "usb-bt",
+    .unmigratable = 1,
+};
+
 static struct USBDeviceInfo bt_info = {
     .product_desc   = "QEMU BT dongle",
     .qdev.name      = "usb-bt-dongle",
     .qdev.size      = sizeof(struct USBBtState),
+    .qdev.vmsd      = &vmstate_usb_bt,
     .usb_desc       = &desc_bluetooth,
     .init           = usb_bt_initfn,
     .handle_packet  = usb_generic_handle_packet,
Signature · 1 line
1.7.1
#12 lore raw

PATCH 8/9 usb-net doesn't support migration

In reply to Gerd Hoffmann
---
 hw/usb-net.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
hw/usb-net.c +6 -0
index 9be709f..4212e5b 100644
@@ -1414,11 +1414,17 @@ static USBDevice *usb_net_init(const char *cmdline)
     return dev;
 }
 
+static const VMStateDescription vmstate_usb_net = {
+    .name = "usb-net",
+    .unmigratable = 1,
+};
+
 static struct USBDeviceInfo net_info = {
     .product_desc   = "QEMU USB Network Interface",
     .qdev.name      = "usb-net",
     .qdev.fw_name    = "network",
     .qdev.size      = sizeof(USBNetState),
+    .qdev.vmsd      = &vmstate_usb_net,
     .usb_desc       = &desc_net,
     .init           = usb_net_initfn,
     .handle_packet  = usb_generic_handle_packet,
Signature · 1 line
1.7.1
#13 lore raw

PATCH 9/9 usb-serial doesn't support migration

In reply to Gerd Hoffmann
---
 hw/usb-serial.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
hw/usb-serial.c +7 -0
index 59cb0fb..70d694d 100644
@@ -566,10 +566,16 @@ static USBDevice *usb_braille_init(const char *unused)
     return dev;
 }
 
+static const VMStateDescription vmstate_usb_serial = {
+    .name = "usb-serial",
+    .unmigratable = 1,
+};
+
 static struct USBDeviceInfo serial_info = {
     .product_desc   = "QEMU USB Serial",
     .qdev.name      = "usb-serial",
     .qdev.size      = sizeof(USBSerialState),
+    .qdev.vmsd      = &vmstate_usb_serial,
     .usb_desc       = &desc_serial,
     .init           = usb_serial_initfn,
     .handle_packet  = usb_generic_handle_packet,
@@ -589,6 +595,7 @@ static struct USBDeviceInfo braille_info = {
     .product_desc   = "QEMU USB Braille",
     .qdev.name      = "usb-braille",
     .qdev.size      = sizeof(USBSerialState),
+    .qdev.vmsd      = &vmstate_usb_serial,
     .usb_desc       = &desc_braille,
     .init           = usb_serial_initfn,
     .handle_packet  = usb_generic_handle_packet,
Signature · 1 line
1.7.1
#14 lore raw
In reply to Gerd Hoffmann
Quoted 12 lines · Gerd Hoffmann
   Hi,

This patch series adds an easy way to tag devices as non-migratable and puts it into use for ahci, ehci and a number of usb devices.

cheers,
Gerd

The following changes since commit 03ff09580ef6cbc4a893b6e3e6bbff33180ec70a:

   Merge remote-tracking branch 'agraf/xen-next' into staging (2011-07-19 08:04:35 -0500)
Quoted 7 lines

are available in the git repository at:

git://git.kraxel.org/qemu migration.1

Gerd Hoffmann (9):
vmstate: add no_migrate flag to VMStateDescription
vmstate: complain about devices without vmstate

I appreciate the sentiment of this patch but this cannot go into 0.15. Lots of tools parse the output of QEMU and introducing something like this is going to create problems for those tools.

I'm not really sure this is totally appropriate for the development branch either. I think something like a migration tainted flag that showed in info migrate would be much more appropriate.

Regards,

Anthony Liguori

Quoted 21 lines

ahci doesn't support migration
ehci doesn't support migration
usb storage: first migration support bits.
usb-wacom doesn't support migration
usb-bt doesn't support migration
usb-net doesn't support migration
usb-serial doesn't support migration

  hw/hw.h         |    3 +++
  hw/ide/ich.c    |    6 ++++++
  hw/qdev.c       |    7 ++++++-
  hw/usb-bt.c     |    6 ++++++
  hw/usb-ehci.c   |    7 +++++++
  hw/usb-msd.c    |   12 ++++++++++++
  hw/usb-net.c    |    6 ++++++
  hw/usb-serial.c |    7 +++++++
  hw/usb-wacom.c  |    6 ++++++
  savevm.c        |    1 +
  10 files changed, 60 insertions(+), 1 deletions(-)
#15 lore raw

Hi,

Quoted 3 lines
Quoted 1 line

vmstate: complain about devices without vmstate

I appreciate the sentiment of this patch but this cannot go into 0.15.

Peter Maydell noted that too, thats why there already is a migration.2 branch with this patch dropped which you can pull instead.

Quoted 3 lines

I'm not really sure this is totally appropriate for the development branch either. I think something like a migration tainted flag that showed in info migrate would be much more appropriate.

We can discuss that after 0.15 is out of the door. I'm certainly open to suggestions how to handle that in a better way.

cheers,
Gerd

#16 lore raw
In reply to Gerd Hoffmann
Quoted 4 lines · Gerd Hoffmann
   Hi,

This patch series adds an easy way to tag devices as non-migratable and puts it into use for ahci, ehci and a number of usb devices.

Pulled. Thanks.

Regards,

Anthony Liguori

Quoted 36 lines

cheers,
Gerd

The following changes since commit 03ff09580ef6cbc4a893b6e3e6bbff33180ec70a:

   Merge remote-tracking branch 'agraf/xen-next' into staging (2011-07-19 08:04:35 -0500)

are available in the git repository at:

git://git.kraxel.org/qemu migration.1

Gerd Hoffmann (9):
vmstate: add no_migrate flag to VMStateDescription
vmstate: complain about devices without vmstate ahci doesn't support migration
ehci doesn't support migration
usb storage: first migration support bits. usb-wacom doesn't support migration usb-bt doesn't support migration
usb-net doesn't support migration usb-serial doesn't support migration

  hw/hw.h         |    3 +++
  hw/ide/ich.c    |    6 ++++++
  hw/qdev.c       |    7 ++++++-
  hw/usb-bt.c     |    6 ++++++
  hw/usb-ehci.c   |    7 +++++++
  hw/usb-msd.c    |   12 ++++++++++++
  hw/usb-net.c    |    6 ++++++
  hw/usb-serial.c |    7 +++++++
  hw/usb-wacom.c  |    6 ++++++
  savevm.c        |    1 +
  10 files changed, 60 insertions(+), 1 deletions(-)