[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 04/40] hw/s390x/s390-stattrib: Don't call register_savevm_live() d
From: |
Juan Quintela |
Subject: |
[PULL 04/40] hw/s390x/s390-stattrib: Don't call register_savevm_live() during instance_init() |
Date: |
Thu, 2 Nov 2023 12:40:18 +0100 |
From: Thomas Huth <thuth@redhat.com>
We must not call register_savevm_live() from an instance_init() function
(since this could be called multiple times during device introspection).
Move this to the realize() function instead.
Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-ID: <20231020150554.664422-4-thuth@redhat.com>
---
hw/s390x/s390-stattrib.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/hw/s390x/s390-stattrib.c b/hw/s390x/s390-stattrib.c
index 4f1ab57437..c483b62a9b 100644
--- a/hw/s390x/s390-stattrib.c
+++ b/hw/s390x/s390-stattrib.c
@@ -331,6 +331,17 @@ static const TypeInfo qemu_s390_stattrib_info = {
/* Generic abstract object: */
+static SaveVMHandlers savevm_s390_stattrib_handlers = {
+ .save_setup = cmma_save_setup,
+ .save_live_iterate = cmma_save_iterate,
+ .save_live_complete_precopy = cmma_save_complete,
+ .state_pending_exact = cmma_state_pending,
+ .state_pending_estimate = cmma_state_pending,
+ .save_cleanup = cmma_save_cleanup,
+ .load_state = cmma_load,
+ .is_active = cmma_active,
+};
+
static void s390_stattrib_realize(DeviceState *dev, Error **errp)
{
bool ambiguous = false;
@@ -338,7 +349,11 @@ static void s390_stattrib_realize(DeviceState *dev, Error
**errp)
object_resolve_path_type("", TYPE_S390_STATTRIB, &ambiguous);
if (ambiguous) {
error_setg(errp, "storage_attributes device already exists");
+ return;
}
+
+ register_savevm_live(TYPE_S390_STATTRIB, 0, 0,
+ &savevm_s390_stattrib_handlers, dev);
}
static Property s390_stattrib_props[] = {
@@ -356,24 +371,10 @@ static void s390_stattrib_class_init(ObjectClass *oc,
void *data)
device_class_set_props(dc, s390_stattrib_props);
}
-static SaveVMHandlers savevm_s390_stattrib_handlers = {
- .save_setup = cmma_save_setup,
- .save_live_iterate = cmma_save_iterate,
- .save_live_complete_precopy = cmma_save_complete,
- .state_pending_exact = cmma_state_pending,
- .state_pending_estimate = cmma_state_pending,
- .save_cleanup = cmma_save_cleanup,
- .load_state = cmma_load,
- .is_active = cmma_active,
-};
-
static void s390_stattrib_instance_init(Object *obj)
{
S390StAttribState *sas = S390_STATTRIB(obj);
- register_savevm_live(TYPE_S390_STATTRIB, 0, 0,
- &savevm_s390_stattrib_handlers, sas);
-
sas->migration_cur_gfn = 0;
}
--
2.41.0
- [PULL 00/40] Migration 20231102 patches, Juan Quintela, 2023/11/02
- [PULL 01/40] hw/ipmi: Don't call vmstate_register() from instance_init() functions, Juan Quintela, 2023/11/02
- [PULL 02/40] hw/s390x/s390-skeys: Don't call register_savevm_live() during instance_init(), Juan Quintela, 2023/11/02
- [PULL 03/40] hw/s390x/s390-stattrib: Simplify handling of the "migration-enabled" property, Juan Quintela, 2023/11/02
- [PULL 04/40] hw/s390x/s390-stattrib: Don't call register_savevm_live() during instance_init(),
Juan Quintela <=
- [PULL 05/40] migration: Create vmstate_register_any(), Juan Quintela, 2023/11/02
- [PULL 06/40] migration: Use vmstate_register_any(), Juan Quintela, 2023/11/02
- [PULL 07/40] migration: Use vmstate_register_any() for isa-ide, Juan Quintela, 2023/11/02
- [PULL 09/40] migration: Hack to maintain backwards compatibility for ppc, Juan Quintela, 2023/11/02
- [PULL 08/40] migration: Use VMSTATE_INSTANCE_ID_ANY for slirp, Juan Quintela, 2023/11/02
- [PULL 12/40] migration: Use vmstate_register_any() for audio, Juan Quintela, 2023/11/02
- [PULL 10/40] migration: Check in savevm_state_handler_insert for dups, Juan Quintela, 2023/11/02
- [PULL 11/40] migration: Improve example and documentation of vmstate_register(), Juan Quintela, 2023/11/02
- [PULL 13/40] migration: Use vmstate_register_any() for eeprom93xx, Juan Quintela, 2023/11/02
- [PULL 14/40] migration: Use vmstate_register_any() for vmware_vga, Juan Quintela, 2023/11/02