From: Bharata B Rao <bharata@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au,
sam.bobroff@au1.ibm.com, rnsastry@linux.vnet.ibm.com,
Bharata B Rao <bharata@linux.vnet.ibm.com>
Subject: [Qemu-devel] [RFC PATCH v1 2/6] migration: Introduce unregister_savevm_live()
Date: Wed, 17 May 2017 09:19:18 +0530 [thread overview]
Message-ID: <1494992962-6929-3-git-send-email-bharata@linux.vnet.ibm.com> (raw)
In-Reply-To: <1494992962-6929-1-git-send-email-bharata@linux.vnet.ibm.com>
Introduce a new function unregister_savevm_live() to unregister the vmstate
handlers registered via register_savevm_live().
register_savevm() allocates SaveVMHandlers while register_savevm_live()
gets passed with SaveVMHandlers. During unregistration, we want to
free SaveVMHandlers in the former case but not free in the latter case.
Hence this new API is needed to differentiate this.
This new API will be needed by PowerPC to unregister the HTAB savevm
handlers.
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
---
hw/net/vmxnet3.c | 2 +-
hw/s390x/s390-skeys.c | 2 +-
include/migration/vmstate.h | 4 +++-
migration/savevm.c | 12 ++++++++++--
slirp/slirp.c | 2 +-
5 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
index 8b1fab2..2b923be 100644
--- a/hw/net/vmxnet3.c
+++ b/hw/net/vmxnet3.c
@@ -2350,7 +2350,7 @@ static void vmxnet3_pci_uninit(PCIDevice *pci_dev)
VMW_CBPRN("Starting uninit...");
- unregister_savevm(dev, "vmxnet3-msix", s);
+ unregister_savevm(dev, "vmxnet3-msix", s, false);
vmxnet3_net_uninit(s);
diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c
index e2d4e1a..32b6435 100644
--- a/hw/s390x/s390-skeys.c
+++ b/hw/s390x/s390-skeys.c
@@ -379,7 +379,7 @@ static inline void s390_skeys_set_migration_enabled(Object *obj, bool value,
register_savevm(NULL, TYPE_S390_SKEYS, 0, 1, s390_storage_keys_save,
s390_storage_keys_load, ss);
} else {
- unregister_savevm(DEVICE(ss), TYPE_S390_SKEYS, ss);
+ unregister_savevm(DEVICE(ss), TYPE_S390_SKEYS, ss, false);
}
}
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index f4bf3f1..ba81b3e 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -78,7 +78,9 @@ int register_savevm_live(DeviceState *dev,
SaveVMHandlers *ops,
void *opaque);
-void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque);
+void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque,
+ bool live);
+void unregister_savevm_live(DeviceState *dev, const char *idstr, void *opaque);
typedef struct VMStateInfo VMStateInfo;
typedef struct VMStateDescription VMStateDescription;
diff --git a/migration/savevm.c b/migration/savevm.c
index 7a268ec..fa7c3db 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -630,7 +630,8 @@ int register_savevm(DeviceState *dev,
ops, opaque);
}
-void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque)
+void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque,
+ bool live)
{
SaveStateEntry *se, *new_se;
char id[256] = "";
@@ -651,12 +652,19 @@ void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque)
if (dev) {
g_free(se->compat);
}
- g_free(se->ops);
+ if (!live) {
+ g_free(se->ops);
+ }
g_free(se);
}
}
}
+void unregister_savevm_live(DeviceState *dev, const char *idstr, void *opaque)
+{
+ unregister_savevm(dev, idstr, opaque, true);
+}
+
int vmstate_register_with_alias_id(DeviceState *dev, int instance_id,
const VMStateDescription *vmsd,
void *opaque, int alias_id,
diff --git a/slirp/slirp.c b/slirp/slirp.c
index 2f2ec2c..108e669 100644
--- a/slirp/slirp.c
+++ b/slirp/slirp.c
@@ -333,7 +333,7 @@ void slirp_cleanup(Slirp *slirp)
{
QTAILQ_REMOVE(&slirp_instances, slirp, entry);
- unregister_savevm(NULL, "slirp", slirp);
+ unregister_savevm(NULL, "slirp", slirp, false);
ip_cleanup(slirp);
ip6_cleanup(slirp);
--
2.7.4
next prev parent reply other threads:[~2017-05-17 3:50 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-17 3:49 [Qemu-devel] [RFC PATCH v1 0/6] ppc/spapr: Fix migration of radix guests Bharata B Rao
2017-05-17 3:49 ` [Qemu-devel] [RFC PATCH v1 1/6] migration: Fix unregister_savevm() Bharata B Rao
2017-05-17 6:43 ` David Gibson
2017-05-17 10:12 ` Bharata B Rao
2017-05-17 3:49 ` Bharata B Rao [this message]
2017-05-17 6:45 ` [Qemu-devel] [RFC PATCH v1 2/6] migration: Introduce unregister_savevm_live() David Gibson
2017-05-17 7:21 ` Bharata B Rao
2017-05-17 3:49 ` [Qemu-devel] [RFC PATCH v1 3/6] spapr: Make h_register_process_table hcall flags global Bharata B Rao
2017-05-17 3:49 ` [Qemu-devel] [RFC PATCH v1 4/6] spapr: Consolidate HPT freeing code into a routine Bharata B Rao
2017-05-17 6:55 ` David Gibson
2017-05-17 3:49 ` [Qemu-devel] [RFC PATCH v1 5/6] spapr: Unregister HPT savevm handlers for radix guests Bharata B Rao
2017-05-17 6:59 ` David Gibson
2017-05-17 7:18 ` Bharata B Rao
2017-05-17 7:23 ` David Gibson
2017-05-17 3:49 ` [Qemu-devel] [RFC PATCH v1 6/6] spapr: Fix migration of Radix guests Bharata B Rao
2017-05-17 7:00 ` David Gibson
2017-05-17 7:15 ` Bharata B Rao
2017-05-17 7:20 ` David Gibson
2017-05-18 5:03 ` Bharata B Rao
2017-05-18 5:50 ` David Gibson
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=1494992962-6929-3-git-send-email-bharata@linux.vnet.ibm.com \
--to=bharata@linux.vnet.ibm.com \
--cc=david@gibson.dropbear.id.au \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=rnsastry@linux.vnet.ibm.com \
--cc=sam.bobroff@au1.ibm.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).