From patchwork Fri Feb 15 17:45:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Kotov X-Patchwork-Id: 10815615 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 EB51617E0 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 DB7E52FCEC for ; Fri, 15 Feb 2019 17:47:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF67F2FCFE; 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 606BD2FCEC for ; Fri, 15 Feb 2019 17:47:34 +0000 (UTC) Received: from localhost ([127.0.0.1]:44026 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1guhaH-0006xF-LM for patchwork-qemu-devel@patchwork.kernel.org; Fri, 15 Feb 2019 12:47:33 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44063) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1guhYy-000646-Su 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 1guhYx-0002Gz-VN for qemu-devel@nongnu.org; Fri, 15 Feb 2019 12:46:12 -0500 Received: from forwardcorp1g.cmail.yandex.net ([87.250.241.190]:40724) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1guhYx-0002En-2a for qemu-devel@nongnu.org; Fri, 15 Feb 2019 12:46:11 -0500 Received: from mxbackcorp2j.mail.yandex.net (mxbackcorp2j.mail.yandex.net [IPv6:2a02:6b8:0:1619::119]) by forwardcorp1g.cmail.yandex.net (Yandex) with ESMTP id CBE5A202F8; Fri, 15 Feb 2019 20:46:06 +0300 (MSK) Received: from smtpcorp1o.mail.yandex.net (smtpcorp1o.mail.yandex.net [2a02:6b8:0:1a2d::30]) by mxbackcorp2j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id LiNduRIr1X-k6WKm4Wf; Fri, 15 Feb 2019 20:46:06 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1550252766; bh=e+5cjTalkPTdsPDLtgnJqxNZfakp2AI0ybHMxDgDYk8=; h=From:To:Cc:Subject:Date:Message-Id; b=NaBeFQLSzxiUSr6b46CFxlFOtONBN9TnIbZrStlS19jvXUsybGu73KlxLuAN8LeSM jXUfzzoq4W76hUtSGExqa/fhIaBhC4pjYac8vbHn+tMmLGP3Bo0oBBixzJCReSqgmu GM/mCeZz1+HUOlXEW0CmcHwqK6g9SMaByPUzbW64= Authentication-Results: mxbackcorp2j.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-k5j0eitE; Fri, 15 Feb 2019 20:46:06 +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:43 +0300 Message-Id: <20190215174548.2630-1-yury-kotov@yandex-team.ru> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 87.250.241.190 Subject: [Qemu-devel] [PATCH v3 0/5] Add ignore-external migration 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 Hi, The series adds a migration capability, which allows to skip shared RAM blocks during the migration. It's useful for fast local migration. E.g. to update QEMU for the running guests. Usage example: 1. Start source VM: qemu-system-x86 \ -m 4G \ -object memory-backend-file,id=mem0,size=4G,share=on,mem-path=/dev/shm/mem0 \ -numa node,memdev=mem0 \ -qmp unix:/tmp/qemu-qmp-1.sock,server,nowait \ 2. Start target VM: qemu-system-x86 \ -m 4G \ -object memory-backend-file,id=mem0,size=4G,share=on,mem-path=/dev/shm/mem0 \ -numa node,memdev=mem0 \ -qmp unix:/tmp/qemu-qmp-2.sock,server,nowait \ -incoming defer 3. Enable ignore-shared capability on both VMs: { "execute": "migrate-set-capabilities" , "arguments": { "capabilities": [ { "capability": "x-ignore-shared", "state": true } ] } } 4. Start migration. Another use case I keep in mind is to migrate to file. Usage is very similar. V2 to V3: * Split "migration: Introduce ignore-shared capability" * Serialize the capabilities as strings rather than as indexes * Don't allow to enable postcopy and ignore-shared together * Skip the test for OSs which don't have /dev/shm * Add a check whether shared RAM has been really skipped V1 to V2: * Keep migration stream compatibility * Reuse the existing code to ignore unwanted RAMBlocks * Add capability validation feature * ignore-external -> ignore-shared Regards, Yury Yury Kotov (5): exec: Change RAMBlockIterFunc definition migration: Introduce ignore-shared capability migration: Add an ability to ignore shared RAM blocks tests/migration-test: Add a test for ignore-shared capability migration: Add capabilities validation exec.c | 38 +++++------ include/exec/cpu-common.h | 7 +- migration/migration.c | 14 ++++ migration/migration.h | 5 +- migration/postcopy-ram.c | 48 +++++++------ migration/ram.c | 110 ++++++++++++++++++++++-------- migration/rdma.c | 9 ++- migration/savevm.c | 137 ++++++++++++++++++++++++++++++++++++++ qapi/migration.json | 5 +- stubs/ram-block.c | 15 +++++ tests/migration-test.c | 131 +++++++++++++++++++++++++++++------- util/vfio-helpers.c | 6 +- 12 files changed, 420 insertions(+), 105 deletions(-)