From patchwork Mon Feb 4 13:09:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Kotov X-Patchwork-Id: 10795645 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 02FCE13B5 for ; Mon, 4 Feb 2019 13:27:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4D9B2877B for ; Mon, 4 Feb 2019 13:27:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D8279287E8; Mon, 4 Feb 2019 13:27:26 +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 718272877B for ; Mon, 4 Feb 2019 13:27:26 +0000 (UTC) Received: from localhost ([127.0.0.1]:42777 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gqeHV-0005gy-Lh for patchwork-qemu-devel@patchwork.kernel.org; Mon, 04 Feb 2019 08:27:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51512) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gqeC6-00011N-EQ for qemu-devel@nongnu.org; Mon, 04 Feb 2019 08:21:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gqe1K-00052B-HB for qemu-devel@nongnu.org; Mon, 04 Feb 2019 08:10:44 -0500 Received: from forwardcorp1g.cmail.yandex.net ([2a02:6b8:0:1465::fd]:35515) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gqe1G-00046v-Lr for qemu-devel@nongnu.org; Mon, 04 Feb 2019 08:10:40 -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 4A04D21812; Mon, 4 Feb 2019 16:10:13 +0300 (MSK) Received: from smtpcorp1p.mail.yandex.net (smtpcorp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:10]) by mxbackcorp2j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Rc7iajfhj2-ACWiMJ6v; Mon, 04 Feb 2019 16:10:13 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1549285813; bh=NddfxRbLp2dSC/V4Ia+2x+js7+QLWlW9Rfz12iVQigQ=; h=From:To:Cc:Subject:Date:Message-Id; b=DEza3FY9bqmIAUxBl2Wvv5JGBLakaxBvkhT5kWQw5wPCn/Ggi0f7tGUcysx+JF2tg vdtnH+T1GLAtkAL6VTAU4NnovtlGe8N3c6RZ1lz1Km45hD/t1S56SeYj1ezjXVBaDB eM0SIfevdmHRJbKfCmCt8mScQmUTgyAg3SjyD3BU= 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 smtpcorp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id CD2xRF1yHW-AC5alH3p; Mon, 04 Feb 2019 16:10:12 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Yury Kotov To: qemu-devel@nongnu.org, Eduardo Habkost , Igor Mammedov , Paolo Bonzini , Peter Crosthwaite , Richard Henderson , Juan Quintela , "Dr. David Alan Gilbert" , Eric Blake , Markus Armbruster , Thomas Huth , Laurent Vivier Date: Mon, 4 Feb 2019 16:09:54 +0300 Message-Id: <20190204130958.18904-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] X-Received-From: 2a02:6b8:0:1465::fd Subject: [Qemu-devel] [PATCH v2 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: 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-external capability on both VMs: { "execute": "migrate-set-capabilities" , "arguments": { "capabilities": [ { "capability": "x-ignore-external", "state": true } ] } } 4. Start migration. Another use case I keep in mind is to migrate to file. Usage is very similar. 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: Move qemu_ram_foreach_migratable_block to migration code migration: Introduce ignore-shared capability 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 | 9 ++++ migration/migration.h | 11 +++- migration/postcopy-ram.c | 48 +++++++++-------- migration/ram.c | 86 ++++++++++++++++++++++++++---- migration/rdma.c | 9 ++-- migration/savevm.c | 101 +++++++++++++++++++++++++++++++++++ qapi/migration.json | 5 +- stubs/ram-block.c | 15 ++++++ tests/migration-test.c | 109 +++++++++++++++++++++++++++++++------- util/vfio-helpers.c | 6 +-- 12 files changed, 361 insertions(+), 83 deletions(-)