hw: Mark the device with no migratable fields
Subsystems (3)
cover hw: Mark the device with no migratable fields
This is a proof-of-concept after chatting with Peter Maydell on IRC earlier.
Introduce the vmstate_no_state_to_migrate structure, and a reference to it: vmstate_qdev_no_state_to_migrate. Use this reference in devices with no fields to migrate.
This is useful to catch devices missing vmstate, such:
- ads7846
- mcf-uart
- mcf-fec
- versatile_i2c
- ...
I am not sure about:
- gpex-pcihost
Philippe Mathieu-Daudé (18):
migration/vmstate: Document vmstate_dummy migration/vmstate: Introduce vmstate_no_state_to_migrate hw/core/qdev: Add vmstate_qdev_no_state_to_migrate hw/arm/armv7m: Mark the device with no migratable fields hw/arm/aspeed_soc: Mark the device with no migratable fields hw/arm/bcm283x: Mark devices with no migratable fields hw/arm/msf2-soc: Mark the device with no migratable fields hw/core/split-irq: Mark the device with no migratable fields hw/cpu/a9mpcore: Mark the device with no migratable fields hw/cpu/cluster: Mark the device with no migratable fields hw/usb/hcd-ohci: Mark the device with no migratable fields hw/intc/arm_gicv2m: Mark the device with no migratable fields hw/misc/armsse-cpuid: Mark the device with no migratable fields hw/misc/iotkit-sysinfo: Mark the device with no migratable fields hw/misc/unimp: Mark the device with no migratable fields hw/nubus/mac-nubus-bridge: Mark the device with no migratable fields hw/sparc64/sun4u: Mark devices with no migratable fields hw/core/qdev: Display warning for devices missing migration state
configure | 9 +++++++++ hw/usb/hcd-ohci.h | 2 ++ include/hw/arm/bcm2836.h | 7 ++++--- include/hw/arm/msf2-soc.h | 11 ++++++----- include/hw/cpu/a9mpcore.h | 3 ++- include/hw/qdev-core.h | 2 ++ include/migration/vmstate.h | 3 ++- hw/arm/armv7m.c | 1 + hw/arm/aspeed_soc.c | 1 + hw/arm/bcm2835_peripherals.c | 1 + hw/arm/bcm2836.c | 1 + hw/arm/msf2-soc.c | 1 + hw/core/qdev.c | 8 ++++++++ hw/core/split-irq.c | 1 + hw/cpu/a9mpcore.c | 1 + hw/cpu/cluster.c | 1 + hw/intc/arm_gicv2m.c | 2 ++ hw/misc/armsse-cpuid.c | 1 + hw/misc/iotkit-sysinfo.c | 1 + hw/misc/unimp.c | 1 + hw/nubus/mac-nubus-bridge.c | 1 + hw/sparc64/sun4u.c | 7 ++++++- hw/usb/hcd-ohci.c | 1 + migration/vmstate.c | 7 +++++++ 24 files changed, 63 insertions(+), 11 deletions(-)
Signature · 1 line
2.21.3
PATCH 1/18 migration/vmstate: Document vmstate_dummy
vmstate_dummy is special and restricted to linux-user. See commit c71c3e99b8 ("Add a vmstate_dummy struct for CONFIG_USER_ONLY").
--- include/migration/vmstate.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/migration/vmstate.h +1 -1
@@ -194,7 +194,7 @@ struct VMStateDescription {const VMStateDescription **subsections; }; -extern const VMStateDescription vmstate_dummy; +extern const VMStateDescription vmstate_dummy;/* Exclusively for linux-user */ extern const VMStateInfo vmstate_info_bool;
Signature · 1 line
2.21.3
Re: [PATCH 01/18] migration/vmstate: Document vmstate_dummy
Quoted 13 lines · * Philippe Mathieu-Daudé ([email protected]) wrote:
vmstate_dummyis special and restricted to linux-user. See commitc71c3e99b8("Add avmstate_dummystruct forCONFIG_USER_ONLY").Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/migration/vmstate.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/migration/vmstate.h +0
-0
include/migration/vmstate.h struct VMStateDescription { · line 197
Quoted 5 lines
include/migration/vmstate.h +1
-1@@ -194,7 +194,7 @@ struct VMStateDescription {const VMStateDescription **subsections; }; -extern const VMStateDescription vmstate_dummy; +extern const VMStateDescription vmstate_dummy;/* Exclusively for linux-user */
Which does mean it's a unfortunate name I guess for something so specific.
(It's also very weird having a vmsd defined with no VMSTATE_END_OF_LIST marker).
Dave
Quoted 5 lines
include/migration/vmstate.h +0
-0extern const VMStateInfo vmstate_info_bool;Signature · 1 line
2.21.3
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Re: [PATCH 01/18] migration/vmstate: Document vmstate_dummy
In reply to Philippe Mathieu-DaudéQuoted 13 lines · Philippe Mathieu-Daudé
vmstate_dummyis special and restricted to linux-user. See commitc71c3e99b8("Add avmstate_dummystruct forCONFIG_USER_ONLY").Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/migration/vmstate.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/migration/vmstate.h +0
-0
include/migration/vmstate.h struct VMStateDescription { · line 197
Quoted 5 lines
include/migration/vmstate.h +1
-1@@ -194,7 +194,7 @@ struct VMStateDescription {const VMStateDescription **subsections; }; -extern const VMStateDescription vmstate_dummy; +extern const VMStateDescription vmstate_dummy;/* Exclusively for linux-user */
Originally in the commit mentioned above, this was enforced at build time:
+#ifdef CONFIG_USER_ONLY
+extern const VMStateDescription vmstate_dummy;
+#endif
but this was removed in
commit 6afc14e92ac81b29c25f097468f7751d5df1b5bc
Author: Stefan Weil <[email protected]>
Date: Fri Feb 6 22:43:10 2015 +0100
migration: Fix warning caused by missing declaration of vmstate_dummy
Warning from the Sparse static analysis tool:
stubs/vmstate.c:4:26: warning:
symbol 'vmstate_dummy' was not declared. Should it be static?
So if this is really intended to only be used by linux-user, then I suggest we put CONFIG_USER_ONLY back, and figure out a different way to address the undeclared symbol problem. I guess the problem was that stub code is shared both both user/softmmu builds. So perhaps we need to stub this in linux-user only code, instead of having it in the main stub library that is common.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [PATCH 01/18] migration/vmstate: Document vmstate_dummy
Quoted 41 lines · Daniel P. Berrangé
Quoted 13 lines · Philippe Mathieu-Daudé
vmstate_dummyis special and restricted to linux-user. See commitc71c3e99b8("Add avmstate_dummystruct forCONFIG_USER_ONLY").Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/migration/vmstate.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/migration/vmstate.h +0
-0include/migration/vmstate.h struct VMStateDescription { · line 197
Quoted 5 lines
include/migration/vmstate.h +1
-1@@ -194,7 +194,7 @@ struct VMStateDescription {const VMStateDescription **subsections; }; -extern const VMStateDescription vmstate_dummy; +extern const VMStateDescription vmstate_dummy;/* Exclusively for linux-user */ Originally in the commit mentioned above, this was enforced at build time:
+#ifdef
CONFIG_USER_ONLY
+extern const VMStateDescriptionvmstate_dummy;
+#endifbut this was removed in
commit
6afc14e92ac81b29c25f097468f7751d5df1b5bc
Author: Stefan Weil <[email protected]>
Date: Fri Feb 6 22:43:10 2015 +0100migration: Fix warning caused by missing declaration of
vmstate_dummyWarning from the Sparse static analysis tool:
stubs/vmstate.c:4:26: warning:
symbol 'vmstate_dummy' was not declared. Should it be static?
Quoted 6 lines
So if this is really intended to only be used by linux-user, then I suggest we put
CONFIG_USER_ONLYback, and figure out a different way to address the undeclared symbol problem. I guess the problem was that stub code is shared both both user/softmmu builds. So perhaps we need to stub this in linux-user only code, instead of having it in the main stub library that is common.
Good idea, I'll look at it.
Thanks,
Phil.
PATCH 2/18 migration/vmstate: Introduce vmstate_no_state_to_migrate
In reply to Philippe Mathieu-DaudéIntroduce a special state to indicate when an object doesn't have anything in its state to migrate.
--- include/migration/vmstate.h | 1 + migration/vmstate.c | 7 +++++++ 2 files changed, 8 insertions(+)
include/migration/vmstate.h +1 -0
@@ -195,6 +195,7 @@ struct VMStateDescription { };extern const VMStateDescription vmstate_dummy;/* Exclusively for linux-user */ +extern const VMStateDescription vmstate_no_state_to_migrate;extern const VMStateInfo vmstate_info_bool;
migration/vmstate.c +7 -0
@@ -20,6 +20,13 @@#include "trace.h" #include "qjson.h" +const VMStateDescription vmstate_no_state_to_migrate = { + .name ="empty-state" , + .fields = (VMStateField []) { +VMSTATE_END_OF_LIST () + } +}; +static int vmstate_subsection_save (QEMUFile *f,const VMStateDescription *vmsd,void *opaque,QJSON *vmdesc); static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd,
Signature · 1 line
2.21.3
Re: [PATCH 02/18] migration/vmstate: Introduce vmstate_no_state_to_migrate
Quoted 28 lines · Philippe Mathieu-Daudé
Introduce a special state to indicate when an object doesn't have anything in its state to migrate.
Suggested-by Peter Maydell <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/migration/vmstate.h | 1 + migration/vmstate.c | 7 +++++++ 2 files changed, 8 insertions(+)include/migration/vmstate.h +1
-0@@ -195,6 +195,7 @@ struct VMStateDescription { };extern const VMStateDescription vmstate_dummy;/* Exclusively for linux-user */ +extern const VMStateDescription vmstate_no_state_to_migrate;extern const VMStateInfo vmstate_info_bool;migration/vmstate.c +0
-0
migration/vmstate.c line 28
Quoted 9 lines
migration/vmstate.c +6
-0@@ -20,6 +20,13 @@#include "trace.h" #include "qjson.h" +const VMStateDescription vmstate_no_state_to_migrate = { + .name ="empty-state" , + .fields = (VMStateField []) { +VMSTATE_END_OF_LIST () + } +};
Does this definitely not put any data into the migration stream? We don't want to change what's on the wire for machines that use devices that start using this. (If it does by default, it would be easy to make the migration code special case the magic symbol to act like "no vmsd specified").
thanks
-- PMM
Re: [PATCH 02/18] migration/vmstate: Introduce vmstate_no_state_to_migrate
Quoted 32 lines · * Peter Maydell ([email protected]) wrote:
Quoted 31 lines · Philippe Mathieu-Daudé
Introduce a special state to indicate when an object doesn't have anything in its state to migrate.
Suggested-by Peter Maydell <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/migration/vmstate.h | 1 + migration/vmstate.c | 7 +++++++ 2 files changed, 8 insertions(+)include/migration/vmstate.h +1
-0@@ -195,6 +195,7 @@ struct VMStateDescription { };extern const VMStateDescription vmstate_dummy;/* Exclusively for linux-user */ +extern const VMStateDescription vmstate_no_state_to_migrate;extern const VMStateInfo vmstate_info_bool;migration/vmstate.c +0
-0@@ -20,6 +20,13 @@#include "trace.h" #include "qjson.h"
Quoted 12 lines
migration/vmstate.c line 28
Quoted 6 lines
migration/vmstate.c +6
-0+const VMStateDescription vmstate_no_state_to_migrate = { + .name ="empty-state" , + .fields = (VMStateField []) { +VMSTATE_END_OF_LIST () + } +};Does this definitely not put any data into the migration stream? We don't want to change what's on the wire for machines that use devices that start using this. (If it does by default, it would be easy to make the migration code special case the magic symbol to act like "no vmsd specified").
I'd need to test it to be sure, but I think if we added a .needed to vmstate_no_state_to_migrate with a function that always returned false, then I think the stream would stay unchanged.
Dave
Quoted 3 lines
thanks
-- PMM
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
PATCH 3/18 hw/core/qdev: Add vmstate_qdev_no_state_to_migrate
In reply to Philippe Mathieu-DaudéAdd vmstate_qdev_no_state_to_migrate, which is simply a pointer to vmstate_no_state_to_migrate. This way all qdev devices (including "hw/qdev-core.h") don't have to include "migration/vmstate.h".
--- include/hw/qdev-core.h | 2 ++ hw/core/qdev.c | 3 +++ 2 files changed, 5 insertions(+)
include/hw/qdev-core.h +2 -0
@@ -139,6 +139,8 @@ typedef struct DeviceClass {const char *bus_type; } DeviceClass; +extern const VMStateDescription *vmstate_qdev_no_state_to_migrate; +typedef struct NamedGPIOList NamedGPIOList ;struct NamedGPIOList {
hw/core/qdev.c +3 -0
@@ -45,6 +45,9 @@ bool qdev_hotplug = false;static bool qdev_hot_added = false;bool qdev_hot_removed = false; +const VMStateDescription *vmstate_qdev_no_state_to_migrate = + &vmstate_no_state_to_migrate; +const VMStateDescription *qdev_get_vmsd (DeviceState *dev) {DeviceClass *dc =DEVICE_GET_CLASS (dev);
Signature · 1 line
2.21.3
PATCH 4/18 hw/arm/armv7m: Mark the device with no migratable fields
In reply to Philippe Mathieu-DaudéThis device doesn't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.
--- hw/arm/armv7m.c | 1 + 1 file changed, 1 insertion(+)
hw/arm/armv7m.c +1 -0
@@ -366,6 +366,7 @@ static void bitband_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass); dc->realize = bitband_realize; + dc->vmsd = vmstate_qdev_no_state_to_migrate;device_class_set_props (dc, bitband_properties); }
Signature · 1 line
2.21.3
Re: [PATCH 04/18] hw/arm/armv7m: Mark the device with no migratable fields
Quoted 14 lines · Philippe Mathieu-Daudé
This device doesn't have fields to migrate. Be explicit by using
vmstate_qdev_no_state_to_migrate.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/arm/armv7m.c | 1 + 1 file changed, 1 insertion(+)hw/arm/armv7m.c +0
-0
hw/arm/armv7m.c static void bitband_class_init(ObjectClass *klass, void *data) · line 371
Quoted 6 lines
hw/arm/armv7m.c +1
-0@@ -366,6 +366,7 @@ static void bitband_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass); dc->realize = bitband_realize; + dc->vmsd = vmstate_qdev_no_state_to_migrate;device_class_set_props (dc, bitband_properties); }
The commit message implies that this is changing the TYPE_ARMV7M device, but it's actually affecting TYPE_BITBAND. Code change looks good.
thanks
-- PMM
PATCH 5/18 hw/arm/aspeed_soc: Mark the device with no migratable fields
In reply to Philippe Mathieu-DaudéThis device doesn't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.
--- hw/arm/aspeed_soc.c | 1 + 1 file changed, 1 insertion(+)
hw/arm/aspeed_soc.c +1 -0
@@ -442,6 +442,7 @@ static void aspeed_soc_class_init(ObjectClass *oc, void *data) dc->realize = aspeed_soc_realize;/* Reason: Uses serial_hds and nd_table in realize() directly */ dc->user_creatable = false; + dc->vmsd = vmstate_qdev_no_state_to_migrate;device_class_set_props (dc, aspeed_soc_properties); }
Signature · 1 line
2.21.3
PATCH 6/18 hw/arm/bcm283x: Mark devices with no migratable fields
In reply to Philippe Mathieu-DaudéThese devices don't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.
Add a more descriptive comment to keep a clear separation between static property vs runtime changeable.
--- include/hw/arm/bcm2836.h | 7 ++++--- hw/arm/bcm2835_peripherals.c | 1 + hw/arm/bcm2836.c | 1 + 3 files changed, 6 insertions(+), 3 deletions(-)
include/hw/arm/bcm2836.h +4 -3
@@ -33,14 +33,15 @@ typedef struct BCM283XState {DeviceState parent_obj;/*< public >*/ -char *cpu_type; -uint32_t enabled_cpus; -struct {ARMCPU core; } cpu[BCM283X_NCPUS ];BCM2836ControlState control;BCM2835PeripheralState peripherals; + +/* Properties */ +char *cpu_type; +uint32_t enabled_cpus; } BCM283XState;typedef struct BCM283XInfo BCM283XInfo ;
hw/arm/bcm2835_peripherals.c +1 -0
@@ -401,6 +401,7 @@ static void bcm2835_peripherals_class_init(ObjectClass *oc, void *data)DeviceClass *dc =DEVICE_CLASS (oc); dc->realize = bcm2835_peripherals_realize; + dc->vmsd = vmstate_qdev_no_state_to_migrate; }static const TypeInfo bcm2835_peripherals_type_info = {
hw/arm/bcm2836.c +1 -0
@@ -173,6 +173,7 @@ static void bcm283x_class_init(ObjectClass *oc, void *data)device_class_set_props (dc, bcm2836_props);/* Reason: Must be wired up in code (see raspi_init() function) */ dc->user_creatable = false; + dc->vmsd = vmstate_qdev_no_state_to_migrate; }static const TypeInfo bcm283x_type_info = {
Signature · 1 line
2.21.3
PATCH 7/18 hw/arm/msf2-soc: Mark the device with no migratable fields
In reply to Philippe Mathieu-DaudéThis device doesn't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.
Add a more descriptive comment to keep a clear separation between static property vs runtime changeable.
--- include/hw/arm/msf2-soc.h | 11 ++++++----- hw/arm/msf2-soc.c | 1 + 2 files changed, 7 insertions(+), 5 deletions(-)
include/hw/arm/msf2-soc.h +6 -5
@@ -51,6 +51,12 @@ typedef struct MSF2State {ARMv7MState armv7m; +MSF2SysregState sysreg; +MSSTimerState timer; +MSSSpiState spi[MSF2_NUM_SPIS ]; +MSF2EmacState emac; + +/* Properties */ char *cpu_type;char *part_name;uint64_t envm_size;
@@ -59,11 +65,6 @@ typedef struct MSF2State {uint32_t m3clk;uint8_t apb0div; uint8_t apb1div; - -MSF2SysregState sysreg; -MSSTimerState timer; -MSSSpiState spi[MSF2_NUM_SPIS ]; - MSF2EmacState emac; } MSF2State;#endif
hw/arm/msf2-soc.c +1 -0
@@ -245,6 +245,7 @@ static void m2sxxx_soc_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass); dc->realize = m2sxxx_soc_realize; + dc->vmsd = vmstate_qdev_no_state_to_migrate;device_class_set_props (dc, m2sxxx_soc_properties); }
Signature · 1 line
2.21.3
PATCH 8/18 hw/core/split-irq: Mark the device with no migratable fields
In reply to Philippe Mathieu-DaudéThis device doesn't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.
--- hw/core/split-irq.c | 1 + 1 file changed, 1 insertion(+)
hw/core/split-irq.c +1 -0
@@ -71,6 +71,7 @@ static void split_irq_class_init(ObjectClass *klass, void *data)/* No state to reset or migrate */ device_class_set_props (dc, split_irq_properties); dc->realize = split_irq_realize; + dc->vmsd = vmstate_qdev_no_state_to_migrate;/* Reason: Needs to be wired up to work */ dc->user_creatable = false;
Signature · 1 line
2.21.3
Re: [PATCH 08/18] hw/core/split-irq: Mark the device with no migratable fields
Quoted 8 lines · Philippe Mathieu-Daudé
This device doesn't have fields to migrate. Be explicit by using
vmstate_qdev_no_state_to_migrate.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/core/split-irq.c | 1 + 1 file changed, 1 insertion(+)
thanks
-- PMM
PATCH 9/18 hw/cpu/a9mpcore: Mark the device with no migratable fields
In reply to Philippe Mathieu-DaudéThis device doesn't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.
Add a more descriptive comment to keep a clear separation between static property vs runtime changeable.
--- include/hw/cpu/a9mpcore.h | 3 ++- hw/cpu/a9mpcore.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
include/hw/cpu/a9mpcore.h +2 -1
@@ -25,10 +25,11 @@ typedef struct A9MPPrivState {SysBusDevice parent_obj;/*< public >*/ +/* Properties */ uint32_t num_cpu; -MemoryRegion container;uint32_t num_irq; +MemoryRegion container;A9SCUState scu;GICState gic;A9GTimerState gtimer;
hw/cpu/a9mpcore.c +1 -0
@@ -176,6 +176,7 @@ static void a9mp_priv_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass); dc->realize = a9mp_priv_realize; + dc->vmsd = vmstate_qdev_no_state_to_migrate;device_class_set_props (dc, a9mp_priv_properties); }
Signature · 1 line
2.21.3
PATCH 10/18 hw/cpu/cluster: Mark the device with no migratable fields
In reply to Philippe Mathieu-DaudéThis device doesn't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.
--- hw/cpu/cluster.c | 1 + 1 file changed, 1 insertion(+)
hw/cpu/cluster.c +1 -0
@@ -80,6 +80,7 @@ static void cpu_cluster_class_init(ObjectClass *klass, void *data)device_class_set_props (dc, cpu_cluster_properties); dc->realize = cpu_cluster_realize; + dc->vmsd = vmstate_qdev_no_state_to_migrate;/* This is not directly for users, CPU children must be attached by code */ dc->user_creatable = false;
Signature · 1 line
2.21.3
PATCH 11/18 hw/usb/hcd-ohci: Mark the device with no migratable fields
In reply to Philippe Mathieu-DaudéThis device doesn't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.
Add a more descriptive comment to keep a clear separation between static property vs runtime changeable.
--- hw/usb/hcd-ohci.h | 2 ++ hw/usb/hcd-ohci.c | 1 + 2 files changed, 3 insertions(+)
hw/usb/hcd-ohci.h +2 -0
@@ -100,6 +100,8 @@ typedef struct {/*< public >*/ OHCIState ohci; + +/* Properties */ char *masterbus;uint32_t num_ports;uint32_t firstport;
hw/usb/hcd-ohci.c +1 -0
@@ -1983,6 +1983,7 @@ static void ohci_sysbus_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass); dc->realize = ohci_realize_pxa; + dc->vmsd = vmstate_qdev_no_state_to_migrate;set_bit (DEVICE_CATEGORY_USB , dc->categories); dc->desc ="OHCI USB Controller" ;device_class_set_props (dc, ohci_sysbus_properties);
Signature · 1 line
2.21.3
PATCH 12/18 hw/intc/arm_gicv2m: Mark the device with no migratable fields
In reply to Philippe Mathieu-DaudéThis device doesn't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.
Add a more descriptive comment to keep a clear separation between static property vs runtime changeable.
--- hw/intc/arm_gicv2m.c | 2 ++ 1 file changed, 2 insertions(+)
hw/intc/arm_gicv2m.c +2 -0
@@ -54,6 +54,7 @@ typedef struct ARMGICv2mState {MemoryRegion iomem;qemu_irq spi[GICV2M_NUM_SPI_MAX ]; +/* Properties */ uint32_t base_spi;uint32_t num_spi; } ARMGICv2mState;
@@ -181,6 +182,7 @@ static void gicv2m_class_init(ObjectClass *klass, void *data)device_class_set_props (dc, gicv2m_properties); dc->realize = gicv2m_realize; + dc->vmsd = vmstate_qdev_no_state_to_migrate; }static const TypeInfo gicv2m_info = {
Signature · 1 line
2.21.3
PATCH 13/18 hw/misc/armsse-cpuid: Mark the device with no migratable fields
In reply to Philippe Mathieu-DaudéThis device doesn't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.
--- hw/misc/armsse-cpuid.c | 1 + 1 file changed, 1 insertion(+)
hw/misc/armsse-cpuid.c +1 -0
@@ -115,6 +115,7 @@ static void armsse_cpuid_class_init(ObjectClass *klass, void *data)* This device has no guest-modifiable state and so it * does not need a reset function or VMState. */ + dc->vmsd = vmstate_qdev_no_state_to_migrate;device_class_set_props (dc, armsse_cpuid_props); }
Signature · 1 line
2.21.3
PATCH 14/18 hw/misc/iotkit-sysinfo: Mark the device with no migratable fields
In reply to Philippe Mathieu-DaudéThis device doesn't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.
--- hw/misc/iotkit-sysinfo.c | 1 + 1 file changed, 1 insertion(+)
hw/misc/iotkit-sysinfo.c +1 -0
@@ -120,6 +120,7 @@ static void iotkit_sysinfo_class_init(ObjectClass *klass, void *data)* This device has no guest-modifiable state and so it * does not need a reset function or VMState. */ + dc->vmsd = vmstate_qdev_no_state_to_migrate;device_class_set_props (dc, iotkit_sysinfo_props); }
Signature · 1 line
2.21.3
PATCH 15/18 hw/misc/unimp: Mark the device with no migratable fields
In reply to Philippe Mathieu-DaudéThis device doesn't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.
--- hw/misc/unimp.c | 1 + 1 file changed, 1 insertion(+)
hw/misc/unimp.c +1 -0
@@ -79,6 +79,7 @@ static void unimp_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass); dc->realize = unimp_realize; + dc->vmsd = vmstate_qdev_no_state_to_migrate;device_class_set_props (dc, unimp_properties); }
Signature · 1 line
2.21.3
PATCH 16/18 hw/nubus/mac-nubus-bridge: Mark the device with no migratable fields
In reply to Philippe Mathieu-DaudéThis device doesn't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.
--- hw/nubus/mac-nubus-bridge.c | 1 + 1 file changed, 1 insertion(+)
hw/nubus/mac-nubus-bridge.c +1 -0
@@ -27,6 +27,7 @@ static void mac_nubus_bridge_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass); dc->desc ="Nubus bridge" ; + dc->vmsd = vmstate_qdev_no_state_to_migrate; }static const TypeInfo mac_nubus_bridge_info = {
Signature · 1 line
2.21.3
PATCH 17/18 hw/sparc64/sun4u: Mark devices with no migratable fields
In reply to Philippe Mathieu-DaudéThese devices don't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.
Add a more descriptive comment to keep a clear separation between static property vs runtime changeable.
--- hw/sparc64/sun4u.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
hw/sparc64/sun4u.c +6 -1
@@ -82,12 +82,15 @@ struct hwdef {typedef struct EbusState {/*< private >*/ PCIDevice parent_obj; +/*< public >*/ ISABus *isa_bus;qemu_irq isa_bus_irqs[ISA_NUM_IRQS ]; -uint64_t console_serial_base;MemoryRegion bar0;MemoryRegion bar1; + +/* Properties */ +uint64_t console_serial_base; }EbusState ;#define TYPE_EBUS "ebus"
@@ -384,6 +387,7 @@ static void ebus_class_init(ObjectClass *klass, void *data) k->device_id =PCI_DEVICE_ID_SUN_EBUS ; k->revision =0x01 ; k->class_id =PCI_CLASS_BRIDGE_OTHER ; + dc->vmsd = vmstate_qdev_no_state_to_migrate;device_class_set_props (dc, ebus_properties); }
@@ -476,6 +480,7 @@ static void prom_class_init(ObjectClass *klass, void *data)device_class_set_props (dc, prom_properties); dc->realize = prom_realize; + dc->vmsd = vmstate_qdev_no_state_to_migrate; }static const TypeInfo prom_info = {
Signature · 1 line
2.21.3
RFC PATCH 18/18 hw/core/qdev: Display warning for devices missing migration state
In reply to Philippe Mathieu-DaudéWhen built with --enable-qdev-debug, QEMU displays warnings listing devices missing migration state:
$ qemu-system-arm -S -M spitz qemu-system-arm: warning: missing migration state for type: 'pxa270-c0-arm-cpu' qemu-system-arm: warning: missing migration state for type: 'serial' qemu-system-arm: warning: missing migration state for type: 'pxa2xx-pcmcia' qemu-system-arm: warning: missing migration state for type: 'pxa2xx-pcmcia' qemu-system-arm: warning: missing migration state for type: 'pxa2xx-i2c-slave' qemu-system-arm: warning: missing migration state for type: 'pxa2xx-i2c-slave' qemu-system-arm: warning: missing migration state for type: 'ads7846' qemu-system-arm: warning: missing migration state for type: 'max1111'
---
RFC because there might be something simpler than --enable-qdev-debug.
configure | 9 +++++++++ hw/core/qdev.c | 5 +++++ 2 files changed, 14 insertions(+)
configure +9 -0
@@ -441,6 +441,7 @@ edk2_blobs="no" pkgversion="" pie="" qom_cast_debug="yes" +qdev_debug="no" trace_backends="log" trace_file="trace" spice=""
@@ -1124,6 +1125,10 @@ for opt do ;; --enable-qom-cast-debug) qom_cast_debug="yes" ;; + --disable-qdev-debug) qdev_debug="no" + ;; + --enable-qdev-debug) qdev_debug="yes" + ;; --disable-virtfs) virtfs="no" ;; --enable-virtfs) virtfs="yes"
@@ -6966,6 +6971,7 @@ echo "gcov enabled $gcov" echo "TPM support $tpm" echo "libssh support $libssh" echo "QOM debugging $qom_cast_debug" +echo "QDEV debugging $qdev_debug" echo "Live block migration $live_block_migration" echo "lzo support $lzo" echo "snappy support $snappy"
@@ -7594,6 +7600,9 @@ fi if test "$qom_cast_debug" = "yes" ; then echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak fi +if test "$qdev_debug" = "yes" ; then + echo "CONFIG_QDEV_DEBUG=y" >> $config_host_mak +fi if test "$rbd" = "yes" ; then echo "CONFIG_RBD=m" >> $config_host_mak echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak
hw/core/qdev.c +5 -0
@@ -932,6 +932,11 @@ static void device_set_realized(Object *obj, bool value, Error **errp) &local_err) < 0) { goto post_realize_fail; } + }else { +#ifdef CONFIG_QDEV_DEBUG +warn_report ("missing migration state for type: '%s'" , +object_get_typename (OBJECT (dev))); +#endif }/*
Signature · 1 line
2.21.3
Re: [RFC PATCH 18/18] hw/core/qdev: Display warning for devices missing migration state
Quoted 14 lines · Philippe Mathieu-Daudé
When built with --enable-qdev-debug, QEMU displays warnings listing devices missing migration state:
$ qemu-system-arm -S -M spitz qemu-system-arm: warning: missing migration state for type: 'pxa270-c0-arm-cpu' qemu-system-arm: warning: missing migration state for type: 'serial' qemu-system-arm: warning: missing migration state for type: 'pxa2xx-pcmcia' qemu-system-arm: warning: missing migration state for type: 'pxa2xx-pcmcia' qemu-system-arm: warning: missing migration state for type: 'pxa2xx-i2c-slave' qemu-system-arm: warning: missing migration state for type: 'pxa2xx-i2c-slave' qemu-system-arm: warning: missing migration state for type: 'ads7846' qemu-system-arm: warning: missing migration state for type: 'max1111'
Quoted 3 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
RFC because there might be something simpler than --enable-qdev-debug.
I think where we'd like to get to is installing a migration blocker if the machine has any devices which don't have a vmsd. But for that we'd need to be pretty sure we'd got all the devices on machines where we care about migration, and we're clearly a fair way from that (eg we need to do something about the devices like the CPU which don't have a vmsd but handle their migration some other way so they don't trigger the condition for warning/migration-blocker).
I don't have a strong objection to this --enable-qdev-debug, I guess. Another option halfway between this and a full migration-blocker would be do a warn_report() for the relevant devices when savevm tries to migrate them.
thanks
-- PMM
Re: [RFC PATCH 18/18] hw/core/qdev: Display warning for devices missing migration state
Quoted 19 lines · Peter Maydell
Quoted 14 lines · Philippe Mathieu-Daudé
When built with --enable-qdev-debug, QEMU displays warnings listing devices missing migration state:
$ qemu-system-arm -S -M spitz qemu-system-arm: warning: missing migration state for type: 'pxa270-c0-arm-cpu' qemu-system-arm: warning: missing migration state for type: 'serial' qemu-system-arm: warning: missing migration state for type: 'pxa2xx-pcmcia' qemu-system-arm: warning: missing migration state for type: 'pxa2xx-pcmcia' qemu-system-arm: warning: missing migration state for type: 'pxa2xx-i2c-slave' qemu-system-arm: warning: missing migration state for type: 'pxa2xx-i2c-slave' qemu-system-arm: warning: missing migration state for type: 'ads7846' qemu-system-arm: warning: missing migration state for type: 'max1111'Quoted 3 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
RFC because there might be something simpler than --enable-qdev-debug.
Quoted 8 lines
I think where we'd like to get to is installing a migration blocker if the machine has any devices which don't have a vmsd. But for that we'd need to be pretty sure we'd got all the devices on machines where we care about migration, and we're clearly a fair way from that (eg we need to do something about the devices like the CPU which don't have a vmsd but handle their migration some other way so they don't trigger the condition for warning/migration-blocker).
Dave made a comment about it, I'd rather let him have a look.
Quoted 4 lines
I don't have a strong objection to this --enable-qdev-debug, I guess. Another option halfway between this and a full migration-blocker would be do a
warn_report()for the relevant devices when savevm tries to migrate them.
OK. The problem is vmstate_save_state() is not qdev specific, it migrates a blob, which we can not report much about. I'll repost using 2 warnings.
Thanks for your review,
Phil.
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series failed the docker-quick@centos7 build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally.
=== TEST SCRIPT BEGIN ===
#!/bin/bash
make docker-image-centos7 V=1 NETWORK=1
time make docker-test-quick@centos7 SHOW_ENV=1 J=14 NETWORK=1 === TEST SCRIPT END ===
LINK tests/test-io-task
LINK tests/test-io-channel-socket
hw/core/qdev.o:(.data.rel+0x0): undefined reference to `vmstate_no_state_to_migrate'
collect2: error: ld returned 1 exit status
make: *** [tests/test-qdev-global-props] Error 1
make: *** Waiting for unfinished jobs....
TEST iotest-qcow2: 002
TEST iotest-qcow2: 003
---
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', '-n', 'docker', 'run', '--label', 'com.qemu.instance.uuid=ba983f0b8bc94d39a0a649a449a91f08', '-u', '1001', '--security-opt', 'seccomp=unconfined', '--rm', '-e', 'TARGET_LIST=', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=14', '-e', 'DEBUG=', '-e', 'SHOW_ENV=1', '-e', 'CCACHE_DIR=/var/tmp/ccache', '-v', '/home/patchew/.cache/qemu-docker-ccache:/var/tmp/ccache:z', '-v', '/var/tmp/patchew-tester-tmp-mg_r93vd/src/docker-src.2020-07-03-16.46.29.22759:/var/tmp/qemu:z,ro', 'qemu:centos7', '/var/tmp/qemu/run', 'test-quick']' returned non-zero exit status 2. filter=--filter=label=com.qemu.instance.uuid=ba983f0b8bc94d39a0a649a449a91f08
make[1]: *** [docker-run] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-mg_r93vd/src'
make: *** [docker-run-test-quick@centos7] Error 2
real 16m8.994s
user 0m8.902s
The full log is available at
http://patchew.org/logs/[email protected]/testing.docker-quick@centos7/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]
Quoted 15 lines · Philippe Mathieu-Daudé
This is a proof-of-concept after chatting with Peter Maydell on IRC earlier.
Introduce the
vmstate_no_state_to_migratestructure, and a reference to it:vmstate_qdev_no_state_to_migrate. Use this reference in devices with no fields to migrate.This is useful to catch devices missing vmstate, such:
- ads7846
- mcf-uart
- mcf-fec
-versatile_i2c
- ...
Quoted 2 lines
I am not sure about:
- gpex-pcihost
I think it's correct that this has no internal state:
the only interesting state is in the GPEXRootState, which is a TYPE_GPEX_ROOT_DEVICE which migrates itself.
I made some comments on the "meaty" bits of the patchset, and reviewed one or two of the "mark this device as having no migration state" patches, but it doesn't seem worth reviewing all of them until the migration submaintainers have a chance to weigh in on whether they like the concept (I expect they're busy right now with freeze-related stuff :-))
thanks
-- PMM
Quoted 23 lines · Peter Maydell
Quoted 15 lines · Philippe Mathieu-Daudé
This is a proof-of-concept after chatting with Peter Maydell on IRC earlier.
Introduce the
vmstate_no_state_to_migratestructure, and a reference to it:vmstate_qdev_no_state_to_migrate. Use this reference in devices with no fields to migrate.This is useful to catch devices missing vmstate, such:
- ads7846
- mcf-uart
- mcf-fec
-versatile_i2c
- ...Quoted 2 lines
I am not sure about:
- gpex-pcihostI think it's correct that this has no internal state:
the only interesting state is in the GPEXRootState, which is aTYPE_GPEX_ROOT_DEVICEwhich migrates itself.
Quoted 6 lines
I made some comments on the "meaty" bits of the patchset, and reviewed one or two of the "mark this device as having no migration state" patches, but it doesn't seem worth reviewing all of them until the migration submaintainers have a chance to weigh in on whether they like the concept (I expect they're busy right now with freeze-related stuff :-))
Now that we are far from freeze-date is a good time to ping again on this concept :)
Most of the devices are ARM except:
- cpu-cluster (Eduardo/Marcel)
- hcd-ohci (Gerd)
- mac-nubus-bridge (Laurent)
- generic QOM (Daniel, Paolo)
Is someone against this proposal?
Regards,
Phil.
Le 14/01/2021 à 16:49, Philippe Mathieu-Daudé a écrit :
Quoted 34 lines · Peter Maydell
Quoted 23 lines · Philippe Mathieu-Daudé
Quoted 15 lines
This is a proof-of-concept after chatting with Peter Maydell on IRC earlier.
Introduce the
vmstate_no_state_to_migratestructure, and a reference to it:vmstate_qdev_no_state_to_migrate. Use this reference in devices with no fields to migrate.This is useful to catch devices missing vmstate, such:
- ads7846
- mcf-uart
- mcf-fec
-versatile_i2c
- ...Quoted 2 lines
I am not sure about:
- gpex-pcihostI think it's correct that this has no internal state:
the only interesting state is in the GPEXRootState, which is aTYPE_GPEX_ROOT_DEVICEwhich migrates itself.Quoted 6 lines
I made some comments on the "meaty" bits of the patchset, and reviewed one or two of the "mark this device as having no migration state" patches, but it doesn't seem worth reviewing all of them until the migration submaintainers have a chance to weigh in on whether they like the concept (I expect they're busy right now with freeze-related stuff :-))
Now that we are far from freeze-date is a good time to ping again on this concept :)
Quoted 7 lines
Most of the devices are ARM except:
- cpu-cluster (Eduardo/Marcel)
- hcd-ohci (Gerd)
- mac-nubus-bridge (Laurent)
- generic QOM (Daniel, Paolo)Is someone against this proposal?
I'm not against the proposal, but I don't understand why we need this.
Thanks,
Laurent
Hi Laurent,
Quoted 41 lines · Laurent Vivier
Le 14/01/2021 à 16:49, Philippe Mathieu-Daudé a écrit :
Quoted 40 lines · Peter Maydell
Quoted 23 lines · Philippe Mathieu-Daudé
Quoted 15 lines
This is a proof-of-concept after chatting with Peter Maydell on IRC earlier.
Introduce the
vmstate_no_state_to_migratestructure, and a reference to it:vmstate_qdev_no_state_to_migrate. Use this reference in devices with no fields to migrate.This is useful to catch devices missing vmstate, such:
- ads7846
- mcf-uart
- mcf-fec
-versatile_i2c
- ...Quoted 2 lines
I am not sure about:
- gpex-pcihostI think it's correct that this has no internal state:
the only interesting state is in the GPEXRootState, which is aTYPE_GPEX_ROOT_DEVICEwhich migrates itself.Quoted 6 lines
I made some comments on the "meaty" bits of the patchset, and reviewed one or two of the "mark this device as having no migration state" patches, but it doesn't seem worth reviewing all of them until the migration submaintainers have a chance to weigh in on whether they like the concept (I expect they're busy right now with freeze-related stuff :-))
Now that we are far from freeze-date is a good time to ping again on this concept :)
Most of the devices are ARM except:
- cpu-cluster (Eduardo/Marcel)
- hcd-ohci (Gerd)
- mac-nubus-bridge (Laurent)
- generic QOM (Daniel, Paolo)
Quoted 3 lines
Quoted 1 line
Is someone against this proposal?
I'm not against the proposal, but I don't understand why we need this.
IIRC the IRC discussion followed this thread:
https://www.mail-archive.com/[email protected]/msg554453.html
Quoting Peter:
Quoted 10 lines
I think we should care about migration on all architectures and devices, in the sense that we want savevm/loadvm to work. This is a really useful debugging and user tool, and when I'm reviewing devices it's the minimum bar I think new devices should clear. You then get migration "for free" but I don't particularly expect it to be used compared to snapshot save/restore. (Of course some of our existing code doesn't support this, and we don't have a good way of testing so bugs creep in easily, but as a principle I think it's good.)
Currently there is no automatic way to catch missing vmstate, we rely on code review (mostly from Peter...).
To be able to add a code check to catch the future device added, we need to first clean the (old) devices missing VMState, justifying why each doesn't have any field to migrate.
Also IMO it is simpler to have an unified API, rather than explaining each experienced and new contributor why "old style qdev" are allowed to do things than "new introduced qdev" can't do anymore.
Regards,
Phil.