From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Cc: dgilbert@redhat.com, lvivier@redhat.com, peterx@redhat.com
Subject: [Qemu-devel] [PULL 01/15] migration: Use savevm_handlers instead of loadvm copy
Date: Thu, 1 Jun 2017 21:23:13 +0200 [thread overview]
Message-ID: <20170601192327.29712-2-quintela@redhat.com> (raw)
In-Reply-To: <20170601192327.29712-1-quintela@redhat.com>
There is no reason for having the loadvm_handlers at all. There is
only one use, and we can use the savevm handlers.
We will remove the loadvm handlers on a following patch.
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
--
- Added load_version_id: version_id read from the stream (laurent)
- Added load_section_id: section_id read from the stream (dave)
---
migration/savevm.c | 32 +++++++++++++++++++-------------
1 file changed, 19 insertions(+), 13 deletions(-)
diff --git a/migration/savevm.c b/migration/savevm.c
index a2d4f9c..07646f4 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -272,7 +272,11 @@ typedef struct SaveStateEntry {
int instance_id;
int alias_id;
int version_id;
+ /* version id read from the stream */
+ int load_version_id;
int section_id;
+ /* section id read from the stream */
+ int load_section_id;
SaveVMHandlers *ops;
const VMStateDescription *vmsd;
void *opaque;
@@ -1813,7 +1817,7 @@ struct LoadStateEntry {
* Returns: true if the footer was good
* false if there is a problem (and calls error_report to say why)
*/
-static bool check_section_footer(QEMUFile *f, LoadStateEntry *le)
+static bool check_section_footer(QEMUFile *f, SaveStateEntry *se)
{
uint8_t read_mark;
uint32_t read_section_id;
@@ -1826,15 +1830,15 @@ static bool check_section_footer(QEMUFile *f, LoadStateEntry *le)
read_mark = qemu_get_byte(f);
if (read_mark != QEMU_VM_SECTION_FOOTER) {
- error_report("Missing section footer for %s", le->se->idstr);
+ error_report("Missing section footer for %s", se->idstr);
return false;
}
read_section_id = qemu_get_be32(f);
- if (read_section_id != le->section_id) {
+ if (read_section_id != se->load_section_id) {
error_report("Mismatched section id in footer for %s -"
" read 0x%x expected 0x%x",
- le->se->idstr, read_section_id, le->section_id);
+ se->idstr, read_section_id, se->load_section_id);
return false;
}
@@ -1887,6 +1891,8 @@ qemu_loadvm_section_start_full(QEMUFile *f, MigrationIncomingState *mis)
version_id, idstr, se->version_id);
return -EINVAL;
}
+ se->load_version_id = version_id;
+ se->load_section_id = section_id;
/* Validate if it is a device's state */
if (xen_enabled() && se->is_ram) {
@@ -1902,13 +1908,13 @@ qemu_loadvm_section_start_full(QEMUFile *f, MigrationIncomingState *mis)
le->version_id = version_id;
QLIST_INSERT_HEAD(&mis->loadvm_handlers, le, entry);
- ret = vmstate_load(f, le->se, le->version_id);
+ ret = vmstate_load(f, se, se->load_version_id);
if (ret < 0) {
error_report("error while loading state for instance 0x%x of"
" device '%s'", instance_id, idstr);
return ret;
}
- if (!check_section_footer(f, le)) {
+ if (!check_section_footer(f, se)) {
return -EINVAL;
}
@@ -1919,29 +1925,29 @@ static int
qemu_loadvm_section_part_end(QEMUFile *f, MigrationIncomingState *mis)
{
uint32_t section_id;
- LoadStateEntry *le;
+ SaveStateEntry *se;
int ret;
section_id = qemu_get_be32(f);
trace_qemu_loadvm_state_section_partend(section_id);
- QLIST_FOREACH(le, &mis->loadvm_handlers, entry) {
- if (le->section_id == section_id) {
+ QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
+ if (se->load_section_id == section_id) {
break;
}
}
- if (le == NULL) {
+ if (se == NULL) {
error_report("Unknown savevm section %d", section_id);
return -EINVAL;
}
- ret = vmstate_load(f, le->se, le->version_id);
+ ret = vmstate_load(f, se, se->load_version_id);
if (ret < 0) {
error_report("error while loading state section id %d(%s)",
- section_id, le->se->idstr);
+ section_id, se->idstr);
return ret;
}
- if (!check_section_footer(f, le)) {
+ if (!check_section_footer(f, se)) {
return -EINVAL;
}
--
2.9.4
next prev parent reply other threads:[~2017-06-01 19:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-01 19:23 [Qemu-devel] [PULL 00/15] Migration PULL request Juan Quintela
2017-06-01 19:23 ` Juan Quintela [this message]
2017-06-01 19:23 ` [Qemu-devel] [PULL 02/15] migration: loadvm handlers are not used Juan Quintela
2017-06-01 19:23 ` [Qemu-devel] [PULL 03/15] migration: Remove section_id parameter from vmstate_load Juan Quintela
2017-06-01 19:23 ` [Qemu-devel] [PULL 04/15] migration: fix leak of src file on dst Juan Quintela
2017-06-01 19:23 ` [Qemu-devel] [PULL 05/15] migration: shut src return path unconditionally Juan Quintela
2017-06-01 19:23 ` [Qemu-devel] [PULL 06/15] migration: Remove unneeded includes of migration/vmstate.h Juan Quintela
2017-06-01 19:23 ` [Qemu-devel] [PULL 07/15] migration: Split qemu-file.h Juan Quintela
2017-06-01 19:23 ` [Qemu-devel] [PULL 08/15] migration: Export exec.c functions in its own file Juan Quintela
2017-06-01 19:23 ` [Qemu-devel] [PULL 09/15] migration: Export fd.c " Juan Quintela
2017-06-01 19:23 ` [Qemu-devel] [PULL 10/15] migration: Export socket.c " Juan Quintela
2017-06-01 19:23 ` [Qemu-devel] [PULL 11/15] migration: Export tls.c " Juan Quintela
2017-06-01 19:23 ` [Qemu-devel] [PULL 12/15] migration: Export rdma.c " Juan Quintela
2017-06-01 19:23 ` [Qemu-devel] [PULL 13/15] migration: Create include for migration snapshots Juan Quintela
2017-06-01 19:23 ` [Qemu-devel] [PULL 14/15] migration: Export ram.c functions in its own file Juan Quintela
2017-06-01 19:23 ` [Qemu-devel] [PULL 15/15] migration: Move include/migration/block.h into migration/ Juan Quintela
2017-06-02 14:19 ` [Qemu-devel] [PULL 00/15] Migration PULL request Peter Maydell
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=20170601192327.29712-2-quintela@redhat.com \
--to=quintela@redhat.com \
--cc=dgilbert@redhat.com \
--cc=lvivier@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).