From patchwork Wed Mar 19 18:32:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dr. David Alan Gilbert" X-Patchwork-Id: 331828 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 22A102C009C for ; Thu, 20 Mar 2014 05:34:26 +1100 (EST) Received: from localhost ([::1]:43205 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQLJn-0008Sh-Te for incoming@patchwork.ozlabs.org; Wed, 19 Mar 2014 14:34:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32966) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQLIB-0006hJ-R7 for qemu-devel@nongnu.org; Wed, 19 Mar 2014 14:32:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WQLI5-0003Sh-Jf for qemu-devel@nongnu.org; Wed, 19 Mar 2014 14:32:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2709) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQLI5-0003SW-BK for qemu-devel@nongnu.org; Wed, 19 Mar 2014 14:32:37 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s2JIWZTt010754 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 19 Mar 2014 14:32:35 -0400 Received: from dgilbert-t530.home.treblig.org (vpn1-6-243.ams2.redhat.com [10.36.6.243]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s2JIWVSP028553; Wed, 19 Mar 2014 14:32:33 -0400 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Wed, 19 Mar 2014 18:32:30 +0000 Message-Id: <1395253951-14524-2-git-send-email-dgilbert@redhat.com> In-Reply-To: <1395253951-14524-1-git-send-email-dgilbert@redhat.com> References: <1395253951-14524-1-git-send-email-dgilbert@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: arei.gonglei@huawei.com, armbru@redhat.com, quintela@redhat.com Subject: [Qemu-devel] [PATCH v2 1/2] Provide init function for ram migration X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: "Dr. David Alan Gilbert" Provide ram_mig_init (like blk_mig_init) for vl.c to initialise stuff to do with ram migration (currently in arch_init.c). Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Gonglei --- arch_init.c | 7 ++++++- include/migration/migration.h | 2 -- include/sysemu/arch_init.h | 1 + vl.c | 3 +-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/arch_init.c b/arch_init.c index 60c975d..0d2bf84 100644 --- a/arch_init.c +++ b/arch_init.c @@ -1095,7 +1095,7 @@ done: return ret; } -SaveVMHandlers savevm_ram_handlers = { +static SaveVMHandlers savevm_ram_handlers = { .save_live_setup = ram_save_setup, .save_live_iterate = ram_save_iterate, .save_live_complete = ram_save_complete, @@ -1104,6 +1104,11 @@ SaveVMHandlers savevm_ram_handlers = { .cancel = ram_migration_cancel, }; +void ram_mig_init(void) +{ + register_savevm_live(NULL, "ram", 0, 4, &savevm_ram_handlers, NULL); +} + struct soundhw { const char *name; const char *descr; diff --git a/include/migration/migration.h b/include/migration/migration.h index 3e1e6c7..31fbf17 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -113,8 +113,6 @@ void free_xbzrle_decoded_buf(void); void acct_update_position(QEMUFile *f, size_t size, bool zero); -extern SaveVMHandlers savevm_ram_handlers; - uint64_t dup_mig_bytes_transferred(void); uint64_t dup_mig_pages_transferred(void); uint64_t skipped_mig_bytes_transferred(void); diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h index be71bca..182d48d 100644 --- a/include/sysemu/arch_init.h +++ b/include/sysemu/arch_init.h @@ -29,6 +29,7 @@ extern const uint32_t arch_type; void select_soundhw(const char *optarg); void do_acpitable_option(const QemuOpts *opts); void do_smbios_option(QemuOpts *opts); +void ram_mig_init(void); void cpudef_init(void); void audio_init(void); int tcg_available(void); diff --git a/vl.c b/vl.c index f0fe48b..3358c98 100644 --- a/vl.c +++ b/vl.c @@ -4274,6 +4274,7 @@ int main(int argc, char **argv, char **envp) cpu_exec_init_all(); blk_mig_init(); + ram_mig_init(); /* open the virtual block devices */ if (snapshot) @@ -4288,8 +4289,6 @@ int main(int argc, char **argv, char **envp) default_drive(default_floppy, snapshot, IF_FLOPPY, 0, FD_OPTS); default_drive(default_sdcard, snapshot, IF_SD, 0, SD_OPTS); - register_savevm_live(NULL, "ram", 0, 4, &savevm_ram_handlers, NULL); - if (nb_numa_nodes > 0) { int i;