From patchwork Mon Oct 21 01:14:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: mrhines@linux.vnet.ibm.com X-Patchwork-Id: 285063 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A3D3E2C014B for ; Mon, 21 Oct 2013 12:20:47 +1100 (EST) Received: from localhost ([::1]:37929 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VY4An-0003gJ-6v for incoming@patchwork.ozlabs.org; Sun, 20 Oct 2013 21:20:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50587) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VY45V-0004RH-3q for qemu-devel@nongnu.org; Sun, 20 Oct 2013 21:15:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VY45M-0004OB-6y for qemu-devel@nongnu.org; Sun, 20 Oct 2013 21:15:17 -0400 Received: from e33.co.us.ibm.com ([32.97.110.151]:41488) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VY45M-0004Nz-0G for qemu-devel@nongnu.org; Sun, 20 Oct 2013 21:15:08 -0400 Received: from /spool/local by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 20 Oct 2013 19:15:07 -0600 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e33.co.us.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sun, 20 Oct 2013 19:15:06 -0600 Received: from d03relay03.boulder.ibm.com (d03relay03.boulder.ibm.com [9.17.195.228]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 2CD2A19D803E for ; Sun, 20 Oct 2013 19:15:03 -0600 (MDT) Received: from d03av06.boulder.ibm.com (d03av06.boulder.ibm.com [9.17.195.245]) by d03relay03.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r9L1F4qQ035228 for ; Sun, 20 Oct 2013 19:15:05 -0600 Received: from d03av06.boulder.ibm.com (loopback [127.0.0.1]) by d03av06.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r9L1IH7w001325 for ; Sun, 20 Oct 2013 19:18:17 -0600 Received: from mahler.ibm.com ([9.80.101.39]) by d03av06.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r9L1HikZ032531; Sun, 20 Oct 2013 19:18:13 -0600 From: mrhines@linux.vnet.ibm.com To: qemu-devel@nongnu.org Date: Mon, 21 Oct 2013 01:14:22 +0000 Message-Id: <1382318062-6288-13-git-send-email-mrhines@linux.vnet.ibm.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1382318062-6288-1-git-send-email-mrhines@linux.vnet.ibm.com> References: <1382318062-6288-1-git-send-email-mrhines@linux.vnet.ibm.com> X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13102101-0928-0000-0000-000002A10002 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 32.97.110.151 Cc: aliguori@us.ibm.com, quintela@redhat.com, owasserm@redhat.com, onom@us.ibm.com, abali@us.ibm.com, mrhines@us.ibm.com, gokul@us.ibm.com, pbonzini@redhat.com Subject: [Qemu-devel] [RFC PATCH v1: 12/12] mc: activate and use MC core logic if requested 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: "Michael R. Hines" Building on the previous patches, this finally actually activates protection of the VM by kicking off an MC thread after the initial live migration completes. The live migration thread will get destroyed and the MC thread will run and never die. Signed-off-by: Michael R. Hines --- migration.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/migration.c b/migration.c index 8e0827e..15ad264 100644 --- a/migration.c +++ b/migration.c @@ -94,6 +94,9 @@ static void process_incoming_migration_co(void *opaque) int ret; ret = qemu_loadvm_state(f); + if (ret >= 0) { + mc_process_incoming_checkpoints_if_requested(f); + } qemu_fclose(f); if (ret < 0) { fprintf(stderr, "load of migration failed\n"); @@ -670,11 +673,27 @@ static void *migration_thread(void *opaque) s->downtime = end_time - start_time; runstate_set(RUN_STATE_POSTMIGRATE); } else { + if(migrate_use_mc()) { + qemu_fflush(s->file); + if (migrate_use_mc_net()) { + if (mc_enable_buffering() < 0 || + mc_start_buffer() < 0) { + migrate_set_state(s, MIG_STATE_ACTIVE, MIG_STATE_ERROR); + } + } + } + if (old_vm_running) { vm_start(); } } - qemu_bh_schedule(s->cleanup_bh); + + if (migrate_use_mc() && s->state != MIG_STATE_ERROR) { + mc_init_checkpointer(s); + } else { + qemu_bh_schedule(s->cleanup_bh); + } + qemu_mutex_unlock_iothread(); return NULL;