From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org, Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: qemu-s390x@nongnu.org, Halil Pasic <pasic@linux.ibm.com>,
Eric Farman <farman@linux.ibm.com>,
David Hildenbrand <david@redhat.com>,
Claudio Imbrenda <imbrenda@linux.ibm.com>,
Juan Quintela <quintela@redhat.com>
Subject: [PATCH v2 3/3] hw/s390x/s390-stattrib: Don't call register_savevm_live() during instance_init()
Date: Fri, 20 Oct 2023 17:05:54 +0200 [thread overview]
Message-ID: <20231020150554.664422-4-thuth@redhat.com> (raw)
In-Reply-To: <20231020150554.664422-1-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: Thomas Huth <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 52f9fc036e..54a138011c 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[] = {
@@ -355,24 +370,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
next prev parent reply other threads:[~2023-10-20 15:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-20 15:05 [PATCH v2 0/3] hw/s390x: Don't call register_savevm_live() during instance_init() Thomas Huth
2023-10-20 15:05 ` [PATCH v2 1/3] hw/s390x/s390-skeys: " Thomas Huth
2023-10-20 15:05 ` [PATCH v2 2/3] hw/s390x/s390-stattrib: Simplify handling of the "migration-enabled" property Thomas Huth
2023-10-20 15:05 ` Thomas Huth [this message]
2023-10-23 11:32 ` [PATCH v2 0/3] hw/s390x: Don't call register_savevm_live() during instance_init() Juan Quintela
2023-10-23 11:35 ` Thomas Huth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231020150554.664422-4-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=borntraeger@linux.ibm.com \
--cc=david@redhat.com \
--cc=farman@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=pasic@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=quintela@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).