From patchwork Fri Jul 4 17:41:39 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: 367170 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 910C41400DF for ; Sat, 5 Jul 2014 03:53:38 +1000 (EST) Received: from localhost ([::1]:37455 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X37g0-00046K-Kf for incoming@patchwork.ozlabs.org; Fri, 04 Jul 2014 13:53:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32807) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X37Vg-0007uH-K8 for qemu-devel@nongnu.org; Fri, 04 Jul 2014 13:43:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X37Va-0000Nx-4g for qemu-devel@nongnu.org; Fri, 04 Jul 2014 13:42:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34258) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X37VZ-0000Ml-Q3 for qemu-devel@nongnu.org; Fri, 04 Jul 2014 13:42:50 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s64Hgkcw013854 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 4 Jul 2014 13:42:46 -0400 Received: from dgilbert-t530.home.treblig.org (vpn1-7-141.ams2.redhat.com [10.36.7.141]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s64HfvTv030576; Fri, 4 Jul 2014 13:42:45 -0400 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Fri, 4 Jul 2014 18:41:39 +0100 Message-Id: <1404495717-4239-29-git-send-email-dgilbert@redhat.com> In-Reply-To: <1404495717-4239-1-git-send-email-dgilbert@redhat.com> References: <1404495717-4239-1-git-send-email-dgilbert@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: aarcange@redhat.com, yamahata@private.email.ne.jp, lilei@linux.vnet.ibm.com, quintela@redhat.com Subject: [Qemu-devel] [PATCH 28/46] postcopy: Incoming initialisation 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" Signed-off-by: Dr. David Alan Gilbert --- arch_init.c | 11 +++++++++++ include/migration/migration.h | 1 + migration.c | 2 ++ 3 files changed, 14 insertions(+) diff --git a/arch_init.c b/arch_init.c index 134ea7e..fd7399c 100644 --- a/arch_init.c +++ b/arch_init.c @@ -1234,6 +1234,17 @@ void ram_handle_compressed(void *host, uint8_t ch, uint64_t size) } } +/* + * Allocate data structures etc needed by incoming migration with postcopy-ram + * postcopy-ram's similarly names postcopy_ram_incoming_init does the work + */ +int ram_postcopy_incoming_init(MigrationIncomingState *mis) +{ + size_t ram_pages = last_ram_offset() >> TARGET_PAGE_BITS; + + return postcopy_ram_incoming_init(mis, ram_pages); +} + static int ram_load(QEMUFile *f, void *opaque, int version_id) { ram_addr_t addr; diff --git a/include/migration/migration.h b/include/migration/migration.h index 722c846..397f41c 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -194,6 +194,7 @@ int ram_postcopy_each_ram_discard(MigrationState *ms); int ram_discard_range(MigrationIncomingState *mis, const char *block_name, int source_target_page_bits, uint64_t start, uint64_t end); +int ram_postcopy_incoming_init(MigrationIncomingState *mis); /** * @migrate_add_blocker - prevent migration from proceeding diff --git a/migration.c b/migration.c index ca0fd7b..55bb767 100644 --- a/migration.c +++ b/migration.c @@ -139,6 +139,8 @@ MigrationIncomingState *migration_incoming_state_init(QEMUFile* f) void migration_incoming_state_destroy(MigrationIncomingState *mis) { + postcopy_pmi_destroy(mis); + g_free(mis); }