cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
eb5a2f
From 8928f6a2f77e167b7602c3f3bb071641134e544e Mon Sep 17 00:00:00 2001
eb5a2f
From: Dr. David Alan Gilbert (git) <dgilbert@redhat.com>
eb5a2f
Date: Thu, 8 May 2014 10:58:40 +0200
eb5a2f
Subject: [PATCH 18/30] Provide init function for ram migration
eb5a2f
eb5a2f
RH-Author: Dr. David Alan Gilbert (git) <dgilbert@redhat.com>
eb5a2f
Message-id: <1399546722-6350-3-git-send-email-dgilbert@redhat.com>
eb5a2f
Patchwork-id: 58742
eb5a2f
O-Subject: [RHEL7.1/RHEL7.0.z qemu-kvm PATCH 2/4] Provide init function for ram migration
eb5a2f
Bugzilla: 1110191
eb5a2f
RH-Acked-by: Juan Quintela <quintela@redhat.com>
eb5a2f
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
eb5a2f
RH-Acked-by: Amit Shah <amit.shah@redhat.com>
eb5a2f
eb5a2f
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
eb5a2f
eb5a2f
Provide ram_mig_init (like blk_mig_init) for vl.c to initialise stuff
eb5a2f
to do with ram migration (currently in arch_init.c).
eb5a2f
eb5a2f
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
eb5a2f
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
eb5a2f
Reviewed-by: Markus Armbruster <armbru@redhat.com>
eb5a2f
Signed-off-by: Juan Quintela <quintela@redhat.com>
eb5a2f
(cherry picked from commit 0d6ab3ab9149767eba192ec5ad659fd34e55a291)
eb5a2f
---
eb5a2f
 arch_init.c                   | 7 ++++++-
eb5a2f
 include/migration/migration.h | 2 --
eb5a2f
 include/sysemu/arch_init.h    | 1 +
eb5a2f
 vl.c                          | 3 +--
eb5a2f
 4 files changed, 8 insertions(+), 5 deletions(-)
eb5a2f
eb5a2f
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
eb5a2f
---
eb5a2f
 arch_init.c                   |    7 ++++++-
eb5a2f
 include/migration/migration.h |    2 --
eb5a2f
 include/sysemu/arch_init.h    |    1 +
eb5a2f
 vl.c                          |    3 +--
eb5a2f
 4 files changed, 8 insertions(+), 5 deletions(-)
eb5a2f
eb5a2f
diff --git a/arch_init.c b/arch_init.c
eb5a2f
index 8641afa..37c9f6d 100644
eb5a2f
--- a/arch_init.c
eb5a2f
+++ b/arch_init.c
eb5a2f
@@ -1099,7 +1099,7 @@ done:
eb5a2f
     return ret;
eb5a2f
 }
eb5a2f
 
eb5a2f
-SaveVMHandlers savevm_ram_handlers = {
eb5a2f
+static SaveVMHandlers savevm_ram_handlers = {
eb5a2f
     .save_live_setup = ram_save_setup,
eb5a2f
     .save_live_iterate = ram_save_iterate,
eb5a2f
     .save_live_complete = ram_save_complete,
eb5a2f
@@ -1108,6 +1108,11 @@ SaveVMHandlers savevm_ram_handlers = {
eb5a2f
     .cancel = ram_migration_cancel,
eb5a2f
 };
eb5a2f
 
eb5a2f
+void ram_mig_init(void)
eb5a2f
+{
eb5a2f
+    register_savevm_live(NULL, "ram", 0, 4, &savevm_ram_handlers, NULL);
eb5a2f
+}
eb5a2f
+
eb5a2f
 struct soundhw {
eb5a2f
     const char *name;
eb5a2f
     const char *descr;
eb5a2f
diff --git a/include/migration/migration.h b/include/migration/migration.h
eb5a2f
index 9314511..c99a67c 100644
eb5a2f
--- a/include/migration/migration.h
eb5a2f
+++ b/include/migration/migration.h
eb5a2f
@@ -102,8 +102,6 @@ void free_xbzrle_decoded_buf(void);
eb5a2f
 
eb5a2f
 void acct_update_position(QEMUFile *f, size_t size, bool zero);
eb5a2f
 
eb5a2f
-extern SaveVMHandlers savevm_ram_handlers;
eb5a2f
-
eb5a2f
 uint64_t dup_mig_bytes_transferred(void);
eb5a2f
 uint64_t dup_mig_pages_transferred(void);
eb5a2f
 uint64_t skipped_mig_bytes_transferred(void);
eb5a2f
diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h
eb5a2f
index be71bca..182d48d 100644
eb5a2f
--- a/include/sysemu/arch_init.h
eb5a2f
+++ b/include/sysemu/arch_init.h
eb5a2f
@@ -29,6 +29,7 @@ extern const uint32_t arch_type;
eb5a2f
 void select_soundhw(const char *optarg);
eb5a2f
 void do_acpitable_option(const QemuOpts *opts);
eb5a2f
 void do_smbios_option(QemuOpts *opts);
eb5a2f
+void ram_mig_init(void);
eb5a2f
 void cpudef_init(void);
eb5a2f
 void audio_init(void);
eb5a2f
 int tcg_available(void);
eb5a2f
diff --git a/vl.c b/vl.c
eb5a2f
index 51300e7..6ff06cc 100644
eb5a2f
--- a/vl.c
eb5a2f
+++ b/vl.c
eb5a2f
@@ -4133,6 +4133,7 @@ int main(int argc, char **argv, char **envp)
eb5a2f
     cpu_exec_init_all();
eb5a2f
 
eb5a2f
     blk_mig_init();
eb5a2f
+    ram_mig_init();
eb5a2f
 
eb5a2f
     /* open the virtual block devices */
eb5a2f
     if (snapshot)
eb5a2f
@@ -4147,8 +4148,6 @@ int main(int argc, char **argv, char **envp)
eb5a2f
     default_drive(default_floppy, snapshot, IF_FLOPPY, 0, FD_OPTS);
eb5a2f
     default_drive(default_sdcard, snapshot, IF_SD, 0, SD_OPTS);
eb5a2f
 
eb5a2f
-    register_savevm_live(NULL, "ram", 0, 4, &savevm_ram_handlers, NULL);
eb5a2f
-
eb5a2f
     if (nb_numa_nodes > 0) {
eb5a2f
         int i;
eb5a2f
 
eb5a2f
-- 
eb5a2f
1.7.1
eb5a2f