From patchwork Fri Jul 3 16:11:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis V. Lunev" X-Patchwork-Id: 11642247 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D487713BD for ; Fri, 3 Jul 2020 16:26:04 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9093E20760 for ; Fri, 3 Jul 2020 16:26:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9093E20760 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=openvz.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34828 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jrOVn-0001Ic-RW for patchwork-qemu-devel@patchwork.kernel.org; Fri, 03 Jul 2020 12:26:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35118) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jrOHu-0001O7-Rd; Fri, 03 Jul 2020 12:11:44 -0400 Received: from relay.sw.ru ([185.231.240.75]:48382 helo=relay3.sw.ru) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jrOHq-0002cs-TK; Fri, 03 Jul 2020 12:11:42 -0400 Received: from [192.168.15.23] (helo=iris.sw.ru) by relay3.sw.ru with esmtp (Exim 4.93) (envelope-from ) id 1jrOHf-0005Rg-67; Fri, 03 Jul 2020 19:11:27 +0300 From: "Denis V. Lunev" To: qemu-block@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v6 0/7] block: seriously improve savevm/loadvm performance Date: Fri, 3 Jul 2020 19:11:23 +0300 Message-Id: <20200703161130.23772-1-den@openvz.org> X-Mailer: git-send-email 2.17.1 Received-SPF: pass client-ip=185.231.240.75; envelope-from=den@openvz.org; helo=relay3.sw.ru X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/03 12:11:34 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Fam Zheng , Vladimir Sementsov-Ogievskiy , Juan Quintela , "Dr. David Alan Gilbert" , Max Reitz , Denis Plotnikov , Stefan Hajnoczi , "Denis V . Lunev" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" This series do standard basic things: - it creates intermediate buffer for all writes from QEMU migration code to QCOW2 image, - this buffer is sent to disk asynchronously, allowing several writes to run in parallel. In general, migration code is fantastically inefficent (by observation), buffers are not aligned and sent with arbitrary pieces, a lot of time less than 100 bytes at a chunk, which results in read-modify-write operations with non-cached operations. It should also be noted that all operations are performed into unallocated image blocks, which also suffer due to partial writes to such new clusters. This patch series is an implementation of idea discussed in the RFC posted by Denis Plotnikov https://lists.gnu.org/archive/html/qemu-devel/2020-04/msg01925.html Results with this series over NVME are better than original code original rfc this cached: 1.79s 2.38s 1.27s non-cached: 3.29s 1.31s 0.81s Changes from v5: - loadvm optimizations added with Vladimir comments included Changes from v4: - added patch 4 with blk_save_vmstate() cleanup - added R-By - bdrv_flush_vmstate -> bdrv_finalize_vmstate - fixed return code of bdrv_co_do_save_vmstate - fixed typos in comments (Eric, thanks!) - fixed patchew warnings Changes from v3: - rebased to master - added patch 3 which removes aio_task_pool_wait_one() - added R-By to patch 1 - patch 4 is rewritten via bdrv_run_co - error path in blk_save_vmstate() is rewritten to call bdrv_flush_vmstate unconditionally - added some comments - fixes initialization in bdrv_co_vmstate_save_task_entry as suggested Changes from v2: - code moved from QCOW2 level to generic block level - created bdrv_flush_vmstate helper to fix 022, 029 tests - added recursive for bs->file in bdrv_co_flush_vmstate (fix 267) - fixed blk_save_vmstate helper - fixed coroutine wait as Vladimir suggested with waiting fixes from me Changes from v1: - patchew warning fixed - fixed validation that only 1 waiter is allowed in patch 1 Signed-off-by: Denis V. Lunev CC: Kevin Wolf CC: Max Reitz CC: Stefan Hajnoczi CC: Fam Zheng CC: Juan Quintela CC: "Dr. David Alan Gilbert" CC: Vladimir Sementsov-Ogievskiy CC: Denis Plotnikov