From patchwork Fri Feb 15 17:45:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Kotov X-Patchwork-Id: 10815613 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 72AD66C2 for ; Fri, 15 Feb 2019 17:47:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61AAE2FCF0 for ; Fri, 15 Feb 2019 17:47:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54A7D2FCFE; Fri, 15 Feb 2019 17:47:34 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B9D922FCEC for ; Fri, 15 Feb 2019 17:47:33 +0000 (UTC) Received: from localhost ([127.0.0.1]:44024 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1guhaG-0006w0-Ap for patchwork-qemu-devel@patchwork.kernel.org; Fri, 15 Feb 2019 12:47:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44062) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1guhYy-000645-Sk for qemu-devel@nongnu.org; Fri, 15 Feb 2019 12:46:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1guhYy-0002HB-3s for qemu-devel@nongnu.org; Fri, 15 Feb 2019 12:46:12 -0500 Received: from forwardcorp1j.cmail.yandex.net ([5.255.227.105]:55741) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1guhYx-0002FQ-Oq for qemu-devel@nongnu.org; Fri, 15 Feb 2019 12:46:12 -0500 Received: from mxbackcorp1j.mail.yandex.net (mxbackcorp1j.mail.yandex.net [IPv6:2a02:6b8:0:1619::162]) by forwardcorp1j.cmail.yandex.net (Yandex) with ESMTP id B437E213E1; Fri, 15 Feb 2019 20:46:08 +0300 (MSK) Received: from smtpcorp1o.mail.yandex.net (smtpcorp1o.mail.yandex.net [2a02:6b8:0:1a2d::30]) by mxbackcorp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id xze3JJbmm9-k86W4qeP; Fri, 15 Feb 2019 20:46:08 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1550252768; bh=IdUstYEhiZQDdu4Ck/4n1ZjgNQX1fmjHwd7rrkzdwuA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=dq7vQww7FhIkP9yttvCGxo8TVVBOyUtsuV0xYlp2rLf5NK81eJ8kIjDKImFbeGV9z ZIm+Y/TsT/7PvAsRQqPQJ6G0IfXHNsntvB2vZk0UdiOa9fEASFAqxsmYcgx/7H8gdP gls9DVzoOWFv3OcP+8gDccNAXZYvnb1gdAPI0Sjs= Authentication-Results: mxbackcorp1j.mail.yandex.net; dkim=pass header.i=@yandex-team.ru Received: from dynamic-red.dhcp.yndx.net (dynamic-red.dhcp.yndx.net [2a02:6b8:0:40c:e1bb:a1a7:a235:d6b4]) by smtpcorp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id NdnWpM22PP-k7jC95rr; Fri, 15 Feb 2019 20:46:08 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Yury Kotov To: "Dr . David Alan Gilbert" , Eduardo Habkost , Eric Blake , Igor Mammedov , Juan Quintela , Laurent Vivier , Markus Armbruster , Paolo Bonzini , Peter Crosthwaite , Richard Henderson , Thomas Huth , qemu-devel@nongnu.org Date: Fri, 15 Feb 2019 20:45:45 +0300 Message-Id: <20190215174548.2630-3-yury-kotov@yandex-team.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190215174548.2630-1-yury-kotov@yandex-team.ru> References: <20190215174548.2630-1-yury-kotov@yandex-team.ru> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 5.255.227.105 Subject: [Qemu-devel] [PATCH v3 2/5] migration: Introduce ignore-shared capability 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: peter.maydell@linaro.org, jiangshanlai@gmail.com, qemu-devel@lists.ewheeler.net, wrfsh@yandex-team.ru Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP We want to use local migration to update QEMU for running guests. In this case we don't need to migrate shared (file backed) RAM. So, add a capability to ignore such blocks during live migration. Signed-off-by: Yury Kotov Reviewed-by: Dr. David Alan Gilbert --- migration/migration.c | 14 ++++++++++++++ migration/migration.h | 1 + qapi/migration.json | 5 ++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index 37e06b76dc..0fadd97fb9 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -957,6 +957,11 @@ static bool migrate_caps_check(bool *cap_list, error_setg(errp, "Postcopy is not supported"); return false; } + + if (cap_list[MIGRATION_CAPABILITY_X_IGNORE_SHARED]) { + error_setg(errp, "Postcopy is not compatible with ignore-shared"); + return false; + } } return true; @@ -1983,6 +1988,15 @@ bool migrate_dirty_bitmaps(void) return s->enabled_capabilities[MIGRATION_CAPABILITY_DIRTY_BITMAPS]; } +bool migrate_ignore_shared(void) +{ + MigrationState *s; + + s = migrate_get_current(); + + return s->enabled_capabilities[MIGRATION_CAPABILITY_X_IGNORE_SHARED]; +} + bool migrate_use_events(void) { MigrationState *s; diff --git a/migration/migration.h b/migration/migration.h index dcd05d9f87..4211995c53 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -261,6 +261,7 @@ bool migrate_release_ram(void); bool migrate_postcopy_ram(void); bool migrate_zero_blocks(void); bool migrate_dirty_bitmaps(void); +bool migrate_ignore_shared(void); bool migrate_auto_converge(void); bool migrate_use_multifd(void); diff --git a/qapi/migration.json b/qapi/migration.json index 7a795ecc16..7105570cd3 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -409,13 +409,16 @@ # devices (and thus take locks) immediately at the end of migration. # (since 3.0) # +# @x-ignore-shared: If enabled, QEMU will not migrate shared memory (since 4.0) +# # Since: 1.2 ## { 'enum': 'MigrationCapability', 'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks', 'compress', 'events', 'postcopy-ram', 'x-colo', 'release-ram', 'block', 'return-path', 'pause-before-switchover', 'x-multifd', - 'dirty-bitmaps', 'postcopy-blocktime', 'late-block-activate' ] } + 'dirty-bitmaps', 'postcopy-blocktime', 'late-block-activate', + 'x-ignore-shared' ] } ## # @MigrationCapabilityStatus: