From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 0221192243 for ; Fri, 6 Oct 2023 13:02:27 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id CE06D32A4B for ; Fri, 6 Oct 2023 13:01:56 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Fri, 6 Oct 2023 13:01:53 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 65BC348F15 for ; Fri, 6 Oct 2023 13:01:53 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Fri, 6 Oct 2023 13:01:45 +0200 Message-Id: <20231006110148.154914-7-f.ebner@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231006110148.154914-1-f.ebner@proxmox.com> References: <20231006110148.154914-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.082 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [nongnu.org, gitlab.com] Subject: [pve-devel] [PATCH v2 qemu 6/9] add patch to avoid huge snapshot performance regression X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Oct 2023 11:02:27 -0000 Taking a snapshot became prohibitively slow because of the migration_transferred_bytes() call in migration_rate_exceeded() [0]. This also applied to the async snapshot taking in Proxmox VE, so work around the issue until it is fixed upstream. [0]: https://gitlab.com/qemu-project/qemu/-/issues/1821 Signed-off-by: Fiona Ebner --- No changes in v2. ...-workaround-snapshot-performance-reg.patch | 57 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 58 insertions(+) create mode 100644 debian/patches/extra/0007-migration-states-workaround-snapshot-performance-reg.patch diff --git a/debian/patches/extra/0007-migration-states-workaround-snapshot-performance-reg.patch b/debian/patches/extra/0007-migration-states-workaround-snapshot-performance-reg.patch new file mode 100644 index 0000000..8031837 --- /dev/null +++ b/debian/patches/extra/0007-migration-states-workaround-snapshot-performance-reg.patch @@ -0,0 +1,57 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Fiona Ebner +Date: Thu, 28 Sep 2023 11:19:14 +0200 +Subject: [PATCH] migration states: workaround snapshot performance regression + +Commit 813cd616 ("migration: Use migration_transferred_bytes() to +calculate rate_limit") introduced a prohibitive performance regression +when taking a snapshot [0]. The reason turns out to be the flushing +done by migration_transferred_bytes() + +Just use a _noflush version of the relevant function as a workaround +until upstream fixes the issue. This is inspired by a not-applied +upstream series [1], but doing the very minimum to avoid the +regression. + +[0]: https://gitlab.com/qemu-project/qemu/-/issues/1821 +[1]: https://lists.nongnu.org/archive/html/qemu-devel/2023-05/msg07708.html + +Signed-off-by: Fiona Ebner +--- + migration/migration-stats.c | 16 +++++++++++++++- + 1 file changed, 15 insertions(+), 1 deletion(-) + +diff --git a/migration/migration-stats.c b/migration/migration-stats.c +index 095d6d75bb..8073c8ebaa 100644 +--- a/migration/migration-stats.c ++++ b/migration/migration-stats.c +@@ -18,6 +18,20 @@ + + MigrationAtomicStats mig_stats; + ++/* ++ * Same as migration_transferred_bytes below, but using the _noflush ++ * variant of qemu_file_transferred() to avoid a performance ++ * regression in migration_rate_exceeded(). ++ */ ++static uint64_t migration_transferred_bytes_noflush(QEMUFile *f) ++{ ++ uint64_t multifd = stat64_get(&mig_stats.multifd_bytes); ++ uint64_t qemu_file = qemu_file_transferred_noflush(f); ++ ++ trace_migration_transferred_bytes(qemu_file, multifd); ++ return qemu_file + multifd; ++} ++ + bool migration_rate_exceeded(QEMUFile *f) + { + if (qemu_file_get_error(f)) { +@@ -25,7 +39,7 @@ bool migration_rate_exceeded(QEMUFile *f) + } + + uint64_t rate_limit_start = stat64_get(&mig_stats.rate_limit_start); +- uint64_t rate_limit_current = migration_transferred_bytes(f); ++ uint64_t rate_limit_current = migration_transferred_bytes_noflush(f); + uint64_t rate_limit_used = rate_limit_current - rate_limit_start; + uint64_t rate_limit_max = stat64_get(&mig_stats.rate_limit_max); + diff --git a/debian/patches/series b/debian/patches/series index 6d681da..c27c245 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -4,6 +4,7 @@ extra/0003-ide-avoid-potential-deadlock-when-draining-during-tr.patch extra/0004-migration-block-dirty-bitmap-fix-loading-bitmap-when.patch extra/0005-hw-ide-reset-cancel-async-DMA-operation-before-reset.patch extra/0006-Revert-Revert-graph-lock-Disable-locking-for-now.patch +extra/0007-migration-states-workaround-snapshot-performance-reg.patch bitmap-mirror/0001-drive-mirror-add-support-for-sync-bitmap-mode-never.patch bitmap-mirror/0002-drive-mirror-add-support-for-conditional-and-always-.patch bitmap-mirror/0003-mirror-add-check-for-bitmap-mode-without-bitmap.patch -- 2.39.2