qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Eric Blake" <eblake@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Corey Minyard" <minyard@acm.org>,
	"Li Zhijian" <lizhijian@fujitsu.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Hanna Reitz" <hreitz@redhat.com>, "John Snow" <jsnow@redhat.com>,
	"David Gibson" <david@gibson.dropbear.id.au>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Halil Pasic" <pasic@linux.ibm.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Corey Minyard" <cminyard@mvista.com>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"Kevin Wolf" <kwolf@redhat.com>,
	qemu-s390x@nongnu.org, "Cédric Le Goater" <clg@kaod.org>,
	qemu-arm@nongnu.org, libvir-list@redhat.com,
	"Stefan Weil" <sw@weilnetz.de>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Daniel Henrique Barboza" <danielhb413@gmail.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Peter Xu" <peterx@redhat.com>,
	"Leonardo Bras" <leobras@redhat.com>,
	"Jason Wang" <jasowang@redhat.com>, "Fam Zheng" <fam@euphon.net>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	"David Hildenbrand" <david@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Fabiano Rosas" <farosas@suse.de>,
	"Ilya Leoshkevich" <iii@linux.ibm.com>,
	"Harsh Prateek Bora" <harshpb@linux.ibm.com>,
	"Samuel Thibault" <samuel.thibault@ens-lyon.org>,
	"Eric Farman" <farman@linux.ibm.com>,
	"Juan Quintela" <quintela@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Stefan Berger" <stefanb@linux.vnet.ibm.com>,
	qemu-ppc@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
	qemu-block@nongnu.org
Subject: [PULL 21/39] hw/s390x/s390-stattrib: Don't call register_savevm_live() during instance_init()
Date: Tue, 24 Oct 2023 15:12:47 +0200	[thread overview]
Message-ID: <20231024131305.87468-22-quintela@redhat.com> (raw)
In-Reply-To: <20231024131305.87468-1-quintela@redhat.com>

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 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



  parent reply	other threads:[~2023-10-24 13:24 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-24 13:12 [PULL 00/39] Migration 20231024 patches Juan Quintela
2023-10-24 13:12 ` [PULL 01/39] migration/doc: Add contents Juan Quintela
2023-10-24 13:12 ` [PULL 02/39] migration/doc: Add documentation for backwards compatiblity Juan Quintela
2023-10-24 13:12 ` [PULL 03/39] migration/doc: How to migrate when hosts have different features Juan Quintela
2023-10-24 13:12 ` [PULL 04/39] migration/doc: We broke backwards compatibility Juan Quintela
2023-10-24 13:12 ` [PULL 05/39] migration: Receiving a zero page non zero is an error Juan Quintela
2023-10-24 13:12 ` [PULL 06/39] migration: Rename ram_handle_compressed() to ram_handle_zero() Juan Quintela
2023-10-24 13:12 ` [PULL 07/39] migration: Give one error if trying to set MULTIFD and XBZRLE Juan Quintela
2023-10-24 13:12 ` [PULL 08/39] migration: Give one error if trying to set COMPRESSION " Juan Quintela
2023-10-24 13:12 ` [PULL 09/39] migration: Remove save_page_use_compression() Juan Quintela
2023-10-24 13:12 ` [PULL 10/39] migration: Make compress_data_with_multithreads return bool Juan Quintela
2023-10-24 13:12 ` [PULL 11/39] migration: Simplify compress_page_with_multithread() Juan Quintela
2023-10-24 13:12 ` [PULL 12/39] migration: Move busy++ to migrate_with_multithread Juan Quintela
2023-10-24 13:12 ` [PULL 13/39] migration: Create compress_update_rates() Juan Quintela
2023-10-24 13:12 ` [PULL 14/39] migration: Export send_queued_data() Juan Quintela
2023-10-24 13:12 ` [PULL 15/39] migration: Move ram_flush_compressed_data() to ram-compress.c Juan Quintela
2023-10-24 13:12 ` [PULL 16/39] migration: Merge flush_compressed_data() and compress_flush_data() Juan Quintela
2023-10-24 13:12 ` [PULL 17/39] migration: Rename ram_compressed_pages() to compress_ram_pages() Juan Quintela
2023-10-24 13:12 ` [PULL 18/39] hw/ipmi: Don't call vmstate_register() from instance_init() functions Juan Quintela
2023-10-24 13:12 ` [PULL 19/39] hw/s390x/s390-skeys: Don't call register_savevm_live() during instance_init() Juan Quintela
2023-10-26 15:35   ` Thomas Huth
2023-10-24 13:12 ` [PULL 20/39] hw/s390x/s390-stattrib: Simplify handling of the "migration-enabled" property Juan Quintela
2023-10-26 15:37   ` Thomas Huth
2023-10-24 13:12 ` Juan Quintela [this message]
2023-10-24 13:12 ` [PULL 22/39] migration/ram: Fix compilation with -Wshadow=local Juan Quintela
2023-10-24 13:12 ` [PULL 23/39] migration: rename vmstate_save_needed->vmstate_section_needed Juan Quintela
2023-10-24 13:12 ` [PULL 24/39] migration: set file error on subsection loading Juan Quintela
2023-10-24 13:12 ` [PULL 25/39] migration: Create vmstate_register_any() Juan Quintela
2023-10-24 13:12 ` [PULL 26/39] migration: Use vmstate_register_any() Juan Quintela
2023-10-24 13:12 ` [PULL 27/39] migration: Use vmstate_register_any() for isa-ide Juan Quintela
2023-10-24 13:12 ` [PULL 28/39] migration: Use VMSTATE_INSTANCE_ID_ANY for slirp Juan Quintela
2023-10-24 13:12 ` [PULL 29/39] migration: Hack to maintain backwards compatibility for ppc Juan Quintela
2023-10-24 13:12 ` [PULL 30/39] migration: Check in savevm_state_handler_insert for dups Juan Quintela
2023-10-24 13:12 ` [PULL 31/39] migration: Improve example and documentation of vmstate_register() Juan Quintela
2023-10-24 13:12 ` [PULL 32/39] migration: Use vmstate_register_any() for audio Juan Quintela
2023-10-24 13:12 ` [PULL 33/39] migration: Use vmstate_register_any() for eeprom93xx Juan Quintela
2023-10-24 13:13 ` [PULL 34/39] migration: Use vmstate_register_any() for vmware_vga Juan Quintela
2023-10-24 13:13 ` [PULL 35/39] qemu-iotests: Filter warnings about block migration being deprecated Juan Quintela
2023-10-24 13:13 ` [PULL 36/39] migration: migrate 'inc' command option is deprecated Juan Quintela
2023-10-24 13:13 ` [PULL 37/39] migration: migrate 'blk' " Juan Quintela
2023-10-24 13:13 ` [PULL 38/39] migration: Deprecate block migration Juan Quintela
2023-10-24 13:13 ` [PULL 39/39] migration: Deprecate old compression method Juan Quintela
2023-10-26  0:50 ` [PULL 00/39] Migration 20231024 patches Stefan Hajnoczi
2023-10-26 15:25   ` Juan Quintela
2023-10-27  0:41     ` Stefan Hajnoczi

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=20231024131305.87468-22-quintela@redhat.com \
    --to=quintela@redhat.com \
    --cc=armbru@redhat.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=clg@kaod.org \
    --cc=cminyard@mvista.com \
    --cc=danielhb413@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=david@redhat.com \
    --cc=eblake@redhat.com \
    --cc=fam@euphon.net \
    --cc=farman@linux.ibm.com \
    --cc=farosas@suse.de \
    --cc=harshpb@linux.ibm.com \
    --cc=hreitz@redhat.com \
    --cc=iii@linux.ibm.com \
    --cc=jasowang@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=leobras@redhat.com \
    --cc=libvir-list@redhat.com \
    --cc=lizhijian@fujitsu.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=minyard@acm.org \
    --cc=mst@redhat.com \
    --cc=npiggin@gmail.com \
    --cc=pasic@linux.ibm.com \
    --cc=peter.maydell@linaro.org \
    --cc=peterx@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=samuel.thibault@ens-lyon.org \
    --cc=stefanb@linux.vnet.ibm.com \
    --cc=stefanha@redhat.com \
    --cc=sw@weilnetz.de \
    --cc=thuth@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).