From patchwork Tue Dec 1 14:19:55 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 39910 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3D01F1007D4 for ; Wed, 2 Dec 2009 01:20:41 +1100 (EST) Received: from localhost ([127.0.0.1]:53861 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NFTao-00038l-1I for incoming@patchwork.ozlabs.org; Tue, 01 Dec 2009 09:20:38 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NFTaH-00037N-7a for qemu-devel@nongnu.org; Tue, 01 Dec 2009 09:20:05 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NFTaB-000331-Aq for qemu-devel@nongnu.org; Tue, 01 Dec 2009 09:20:04 -0500 Received: from [199.232.76.173] (port=56912 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NFTaA-00032u-TX for qemu-devel@nongnu.org; Tue, 01 Dec 2009 09:19:58 -0500 Received: from david.siemens.de ([192.35.17.14]:24326) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NFTaA-0005cR-HG for qemu-devel@nongnu.org; Tue, 01 Dec 2009 09:19:58 -0500 Received: from mail1.siemens.de (localhost [127.0.0.1]) by david.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id nB1EJuvG024616; Tue, 1 Dec 2009 15:19:56 +0100 Received: from [139.25.109.167] (mchn012c.mchp.siemens.de [139.25.109.167] (may be forged)) by mail1.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id nB1EJtWL014978; Tue, 1 Dec 2009 15:19:55 +0100 Message-ID: <4B15260B.9050104@siemens.com> Date: Tue, 01 Dec 2009 15:19:55 +0100 From: Jan Kiszka User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Anthony Liguori X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 Cc: qemu-devel , Liran Schour , Pierre Riteau Subject: [Qemu-devel] [PATCH] live migration: Serialize vmstate saving in stage 2 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The effect of this patch with current block migration is that its stage 2, ie. the first full walk-through of the block devices will be performed completely before RAM migration starts. This ensures that continuously changing RAM pages are not re-synchronized all the time while block migration is not completed. Future versions of block migration which will respect the specified downtime will generate a different pattern: After RAM migration has started as well, block migration may also continue to inject dirty blocks into the RAM stream once it detects that the number of pending blocks would extend the downtime unacceptably. Note that all this relies on the current registration order: block before RAM migration. Signed-off-by: Jan Kiszka --- savevm.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/savevm.c b/savevm.c index 3fee38c..930543e 100644 --- a/savevm.c +++ b/savevm.c @@ -1293,7 +1293,14 @@ int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f) qemu_put_byte(f, QEMU_VM_SECTION_PART); qemu_put_be32(f, se->section_id); - ret &= !!se->save_live_state(mon, f, QEMU_VM_SECTION_PART, se->opaque); + ret = se->save_live_state(mon, f, QEMU_VM_SECTION_PART, se->opaque); + if (!ret) { + /* Do not proceed to the next vmstate before this one reported + completion of the current stage. This serializes the migration + and reduces the probability that a faster changing state is + synchronized over and over again. */ + break; + } } if (ret)