From patchwork Sun Aug 21 20:58:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Md Haris Iqbal X-Patchwork-Id: 9292713 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1F087607FF for ; Sun, 21 Aug 2016 21:03:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E0F528971 for ; Sun, 21 Aug 2016 21:03:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01FD828989; Sun, 21 Aug 2016 21:03:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 76FF928971 for ; Sun, 21 Aug 2016 21:03:41 +0000 (UTC) Received: from localhost ([::1]:38188 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bbZu8-00024L-L0 for patchwork-qemu-devel@patchwork.kernel.org; Sun, 21 Aug 2016 17:03:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bbZq0-0007Vd-Gl for qemu-devel@nongnu.org; Sun, 21 Aug 2016 16:59:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bbZpx-0005zn-C7 for qemu-devel@nongnu.org; Sun, 21 Aug 2016 16:59:24 -0400 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]:32777) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bbZpx-0005zh-5T for qemu-devel@nongnu.org; Sun, 21 Aug 2016 16:59:21 -0400 Received: by mail-pf0-x243.google.com with SMTP id i6so5031241pfe.0 for ; Sun, 21 Aug 2016 13:59:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0frpHvnhHD8FK4VOAIEuawqUOzJ6wTKl7W91ILtGAMA=; b=m7lFeFz+2kdmeUcDF+mBnnpZnZXBpV1WN+CQyJJyAZ7n3gOlJvQfFPwBS+Mi4SrXBr oW1YIY3+wlNyM49b6vyHdOQE40e9MrYRTjSZS3rn+BPwvWUR84kWMHyCFJ7RdorP2q7e y7OpKfXSBdtYgZkf/ZxN/HZBhi3/1g0Ct2ChxHEjtsVeXPIepw9a0Yo/HHU/Z3FgXAKs NZi13a1B6Eolj2xVt5qWVbTtr0dUb+r1ua/CtASvVMeNlV49Llv2VPwIpje6Idna549f XVEU5jgbem2OtmMoDbPOlNHVA98X8XWxq+ZssPMMrWEojB8TgaQ62g+6lpNhMkdx9GWq 0VoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0frpHvnhHD8FK4VOAIEuawqUOzJ6wTKl7W91ILtGAMA=; b=XvzgdS/aObIpCiC3USinYZJdarNB8W5uhMLjIFdsSAwWId4XsW+kVmompXwPmGfJjB 7nY9JZtrkgPC5XK/u8bcLRrXJSYPG5WuD3KnpqoUK3UhjAzUdEn8rDZkIfp5jepFVv/1 0mcHtPqsyk6RBgV8cd02SV0tjfzsgjXaE/NkVB1TKMLbK+0ZM92F2N1hmBT7f/TWYWaX smySYe/+gq9dpos2NI5MCHvUFnj+MjoHHPCSc2v3/Mb6cBFo4bplcISM76YoXoPV6N9Q xsRayRxp4JMEwKGwO2wsbDkT3kQGSiSZYIKgMEhELl3XarZ7ij3uvt6jaoiT7YhMREXn bkGQ== X-Gm-Message-State: AEkoousZ7Qu+wVYknOoGMyi4UZcFjjjvSwj/stAev68jzMCZeRH4dg3IIQZRQpPQR92NHQ== X-Received: by 10.98.96.193 with SMTP id u184mr36300486pfb.85.1471813160226; Sun, 21 Aug 2016 13:59:20 -0700 (PDT) Received: from deepak.domain.name ([103.252.25.179]) by smtp.googlemail.com with ESMTPSA id ra13sm27025890pac.29.2016.08.21.13.59.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 21 Aug 2016 13:59:19 -0700 (PDT) From: Md Haris Iqbal To: qemu-devel@nongnu.org Date: Mon, 22 Aug 2016 02:28:51 +0530 Message-Id: <1471813132-13836-6-git-send-email-haris.phnx@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1471813132-13836-1-git-send-email-haris.phnx@gmail.com> References: <1471813132-13836-1-git-send-email-haris.phnx@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c00::243 Subject: [Qemu-devel] [PATCH 5/6] Migration: Recovering pages lost due to n/w failure during pc migration (source) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Md Haris Iqbal , dgilbert@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Md Haris Iqbal --- include/migration/migration.h | 5 +++++ migration/migration.c | 2 ++ migration/savevm.c | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/include/migration/migration.h b/include/migration/migration.h index 4e4c0c8..5533832 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -145,6 +145,11 @@ struct MigrationState int state; /* Old style params from 'migrate' command */ MigrationParams params; + /* + * Don't need 2 variables for recovery. + * Clean this up, use a single variable with different states. + */ + bool recovered_once; bool in_recovery; /* State related to return path */ diff --git a/migration/migration.c b/migration/migration.c index 7cd3344..6faa483 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1042,6 +1042,7 @@ MigrationState *migrate_init(const MigrationParams *params) s->xfer_limit = 0; s->cleanup_bh = 0; s->to_dst_file = NULL; + s->recovered_once = false; s->in_recovery = false; s->state = MIGRATION_STATUS_NONE; s->params = *params; @@ -1925,6 +1926,7 @@ static void *migration_thread(void *opaque) if(ret == 0) { current_active_state = MIGRATION_STATUS_POSTCOPY_ACTIVE; runstate_set(RUN_STATE_FINISH_MIGRATE); + s->recovered_once = true; qemu_file_clear_error(s->to_dst_file); continue; } diff --git a/migration/savevm.c b/migration/savevm.c index 79f601c..aa4f777 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -986,6 +986,11 @@ void qemu_savevm_state_complete_postcopy(QEMUFile *f) { SaveStateEntry *se; int ret; + MigrationState *ms = migrate_get_current(); + + if (ms->recovered_once) { + qemu_savevm_command_send(f, MIG_CMD_POSTCOPY_RECOVERY, 0, NULL); + } QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { if (!se->ops || !se->ops->save_live_complete_postcopy) {