From nobody Sat Nov 15 19:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1748383250; cv=none; d=zohomail.com; s=zohoarc; b=ihLCFuetxeHnLkEFziNl7cLtwS9/IyZpvIA6Ad2nLcpahyo0REHPTPT5SNw/y0aOJKjkXEu5w7xi7IA/DiAS9wFuNVhg6/GBXJ2GiBmGsPn9r2pE1K7mAu+sthev6n9azduCH+ynm9Pqb8CGlTpxFSkcqIwab5towd+Il9UC2jA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748383250; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=2yNX4HDy6gAGu/jS6K4Tf66cqp8itUnTZH8N0AIlKh4=; b=GUEGRPfbrwfUwJLS7FB9/E/iX3N2s1c6Il1CG2QELGQIz5JPUHtqmKXEHpJqDqn8Di9/rxjpAM4BeZYUTx3sTLiks72VqtKrfdi8rYVQrkrXTmYbQAfq7aq8FzS69xLQ80YA7+QnC/UlRWpbjgpt5dnMj5ZnNLm7jm83VxXN+dI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17483832504301018.7760564872622; Tue, 27 May 2025 15:00:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uK2K7-0004hi-Da; Tue, 27 May 2025 17:59:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uK2K5-0004h3-VG for qemu-devel@nongnu.org; Tue, 27 May 2025 17:59:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uK2K4-000867-5b for qemu-devel@nongnu.org; Tue, 27 May 2025 17:59:01 -0400 Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-235-ozE6QpxlNJ6fqSEAoc3YyA-1; Tue, 27 May 2025 17:58:57 -0400 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-6fabd295d12so2696966d6.1 for ; Tue, 27 May 2025 14:58:56 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6fabe4f27cdsm914516d6.49.2025.05.27.14.58.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 May 2025 14:58:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1748383139; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2yNX4HDy6gAGu/jS6K4Tf66cqp8itUnTZH8N0AIlKh4=; b=epQf4fIo0bak2WdcKr0HKyRPL6Q0sIFBjqRIbzloAZM05JA64jCeKrUWnZORyPRUoj3zJ0 lq3Q7td10Goea4B4x4ZTIqJnniMjING+1/RlgV4LemskAXN7xR3wWY0mkovz52t7r5a5rZ M2j/Qt4CDQomuzd34uvFcMOGVjq+1RY= X-MC-Unique: ozE6QpxlNJ6fqSEAoc3YyA-1 X-Mimecast-MFC-AGG-ID: ozE6QpxlNJ6fqSEAoc3YyA_1748383136 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748383136; x=1748987936; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2yNX4HDy6gAGu/jS6K4Tf66cqp8itUnTZH8N0AIlKh4=; b=Io9hfSFfGlDAgaldKXPBgrrHNgfg5zCus20uOXUiSBFAMtnhdsuvJRWlacN1v7LfhE PosnpVlYVwm86tbwVNX/289+jt+fkN018+OzMb7IqlxyW0ql2Z8/dWU74MLbMPQ0+3J2 WB9ZAEGU1VnqSh94kVzdbnCcpE0pWIvwTBkbOZDQsHMUxNwjs9iILDHGthYt40/0VN3o esVTLd4s4hzkhfFxtqj+J69Mi1qi3WzNohhTNVR4PXRZ7rWuxDMCr7XiZ4/uB3VVgmGj uLA8KoReWWYRUIKaBzNpXiy2OU9x7v1SojEjFTwW7t1RCGHwJs/omLiztqvqKtJf+e9U qyVg== X-Gm-Message-State: AOJu0YxyeNDrCzOR/MuRqE5ykAHnFGLnuIAWkWqmMF3xGkGj/GilPBbt JGDrNa5nTxIM4SyFPVhs0DE49UJstzo6qxkftclqWo87B8AL91nMwXOGFbPIdRxIb14LHQJfemM Q6wq9q4LEN3910MkwWd0Vmv/121SOP/IV0ICXWiSIf5twyzPTGEYNtPAyA+uClJ7vDOGpFytHkg S3OHPY5RJJcd4/gTq/ky8Ff8A5VWQO4M0+RvGl/A== X-Gm-Gg: ASbGncu7miBxoVqHc2+2LhdiDESOUgLa+gMUdAGwkOFIFWzsU5zqXAWxwHi886kUSpL ipmm9mLpn3xddtUyvg0ANKRNINiAS2hM0Yh5IANtsgpHsSg8DtkKtO5Lm5kV4t3hxGZ2SzKaZUg 90xpT6AW1FIuLxy/BU9VrZzHsgoeZ+Y9icdiRoXs78mSh6GDT1QdSEvMkPIiTOqQ2w+nYshiXHT CeExrbhLXZ2Qj8L6XRjTyalu50LVSaTiN7Hz4fnr3KKSrAsEAsT6l+taoleKGoUDxi8taax2kpr X-Received: by 2002:a05:6214:1646:b0:6fa:9e00:d458 with SMTP id 6a1803df08f44-6fa9e00e41cmr182134926d6.45.1748383135651; Tue, 27 May 2025 14:58:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG20ttPQTmZ6aiDCLBbu22z97QpXmIU0L2CXnv6N/RsAylQsXyzTzgdsx3jvsaZRMaqqfdwZQ== X-Received: by 2002:a05:6214:1646:b0:6fa:9e00:d458 with SMTP id 6a1803df08f44-6fa9e00e41cmr182134666d6.45.1748383135204; Tue, 27 May 2025 14:58:55 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Juraj Marcin , peterx@redhat.com, Fabiano Rosas , "Dr . David Alan Gilbert" , "Zhijian Li (Fujitsu)" Subject: [PATCH 01/11] migration/hmp: Reorg "info migrate" once more Date: Tue, 27 May 2025 17:58:40 -0400 Message-ID: <20250527215850.1271072-2-peterx@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250527215850.1271072-1-peterx@redhat.com> References: <20250527215850.1271072-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -49 X-Spam_score: -5.0 X-Spam_bar: ----- X-Spam_report: (-5.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.907, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1748383251657116600 Content-Type: text/plain; charset="utf-8" Dave suggested the HMP output for "info migrate" can not only leverage the lines but also better grouping: https://lore.kernel.org/r/aC4_-nMc7FwsMf9p@gallifrey I followed Dave's suggestion, and some more modifications on top: - Added all elements into the picture - Use size_to_str() and drop most of the units: benefit is more friendly to most human eyes, bad side effect is lose of details, but that should be corner case per my uses, and one can still leverage the QMP interface when necessary. - Sub-grouping for "Transfers" ("Channels" and "Page Types"). - Better indentations Sample output: (qemu) info migrate Status: postcopy-active Time (ms): total=3D47317, setup=3D5, down=3D8 RAM info: Throughput (Mbps): 1342.83 Sizes: pagesize=3D4 KiB, total=3D4.02 GiB Transfers: transferred=3D1.41 GiB, remain=3D2.46 GiB Channels: precopy=3D15.2 MiB, multifd=3D0 B, postcopy=3D1.39 = GiB Page Types: normal=3D367713, zero=3D41195 Page Rates (pps): transfer=3D40900, dirty=3D4 Others: dirty_syncs=3D2, postcopy_req=3D57503 Cc: Zhijian Li (Fujitsu) Suggested-by: Dr. David Alan Gilbert Signed-off-by: Peter Xu Acked-by: Dr. David Alan Gilbert Reviewed-by: Juraj Marcin Reviewed-by: Li Zhijian Tested-by: Li Zhijian --- migration/migration-hmp-cmds.c | 59 ++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index e8a563c7d8..367ff6037f 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -69,7 +69,7 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict) } =20 if (info->has_status) { - monitor_printf(mon, "Status: %s", + monitor_printf(mon, "Status: \t\t%s", MigrationStatus_str(info->status)); if (info->status =3D=3D MIGRATION_STATUS_FAILED && info->error_des= c) { monitor_printf(mon, " (%s)\n", info->error_desc); @@ -78,7 +78,7 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict) } =20 if (info->total_time) { - monitor_printf(mon, "Time (ms): total=3D%" PRIu64, + monitor_printf(mon, "Time (ms): \t\ttotal=3D%" PRIu64, info->total_time); if (info->has_setup_time) { monitor_printf(mon, ", setup=3D%" PRIu64, @@ -110,48 +110,51 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdic= t) } =20 if (info->ram) { + g_autofree char *str_psize =3D size_to_str(info->ram->page_size); + g_autofree char *str_total =3D size_to_str(info->ram->total); + g_autofree char *str_transferred =3D size_to_str(info->ram->transf= erred); + g_autofree char *str_remaining =3D size_to_str(info->ram->remainin= g); + g_autofree char *str_precopy =3D size_to_str(info->ram->precopy_by= tes); + g_autofree char *str_multifd =3D size_to_str(info->ram->multifd_by= tes); + g_autofree char *str_postcopy =3D size_to_str(info->ram->postcopy_= bytes); + monitor_printf(mon, "RAM info:\n"); - monitor_printf(mon, " Throughput (Mbps): %0.2f\n", + monitor_printf(mon, " Throughput (Mbps): \t%0.2f\n", info->ram->mbps); - monitor_printf(mon, " Sizes (KiB): pagesize=3D%" PRIu64 - ", total=3D%" PRIu64 ",\n", - info->ram->page_size >> 10, - info->ram->total >> 10); - monitor_printf(mon, " transferred=3D%" PRIu64 - ", remain=3D%" PRIu64 ",\n", - info->ram->transferred >> 10, - info->ram->remaining >> 10); - monitor_printf(mon, " precopy=3D%" PRIu64 - ", multifd=3D%" PRIu64 - ", postcopy=3D%" PRIu64, - info->ram->precopy_bytes >> 10, - info->ram->multifd_bytes >> 10, - info->ram->postcopy_bytes >> 10); + monitor_printf(mon, " Sizes: \t\tpagesize=3D%s, total=3D%s\n", + str_psize, str_total); + monitor_printf(mon, " Transfers: \t\ttransferred=3D%s, remain=3D%= s\n", + str_transferred, str_remaining); + monitor_printf(mon, " Channels: \t\tprecopy=3D%s, " + "multifd=3D%s, postcopy=3D%s", + str_precopy, str_multifd, str_postcopy); =20 if (info->vfio) { - monitor_printf(mon, ", vfio=3D%" PRIu64, - info->vfio->transferred >> 10); + g_autofree char *str_vfio =3D size_to_str(info->vfio->transfer= red); + + monitor_printf(mon, ", vfio=3D%s", str_vfio); } monitor_printf(mon, "\n"); =20 - monitor_printf(mon, " Pages: normal=3D%" PRIu64 ", zero=3D%" PRIu= 64 - ", rate_per_sec=3D%" PRIu64 "\n", - info->ram->normal, - info->ram->duplicate, + monitor_printf(mon, " Page Types: \tnormal=3D%" PRIu64 + ", zero=3D%" PRIu64 "\n", + info->ram->normal, info->ram->duplicate); + monitor_printf(mon, " Page Rates (pps): \ttransfer=3D%" PRIu64, info->ram->pages_per_second); - monitor_printf(mon, " Others: dirty_syncs=3D%" PRIu64, - info->ram->dirty_sync_count); - if (info->ram->dirty_pages_rate) { - monitor_printf(mon, ", dirty_pages_rate=3D%" PRIu64, + monitor_printf(mon, ", dirty=3D%" PRIu64, info->ram->dirty_pages_rate); } + monitor_printf(mon, "\n"); + + monitor_printf(mon, " Others: \t\tdirty_syncs=3D%" PRIu64, + info->ram->dirty_sync_count); if (info->ram->postcopy_requests) { monitor_printf(mon, ", postcopy_req=3D%" PRIu64, info->ram->postcopy_requests); } if (info->ram->downtime_bytes) { - monitor_printf(mon, ", downtime_ram=3D%" PRIu64, + monitor_printf(mon, ", downtime_bytes=3D%" PRIu64, info->ram->downtime_bytes); } if (info->ram->dirty_sync_missed_zero_copy) { --=20 2.49.0 From nobody Sat Nov 15 19:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1748383314; cv=none; d=zohomail.com; s=zohoarc; b=SC5NKKVmFaBB3m3HD4QY7d6p4QZ7avRhuJhd/6r483UJrf25nCU0xxzgcrXsg0t+fkVEeUGE0FLmolN8i8AuqQ77gtD3c16GGCD8Dl9+rSCz5R7VFq9E4FF0IJSM1RCzxUTLFfeM2GA5F7UyLOGD6qaULfuY93Aui+XS6XvtNfA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748383314; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=iIQUQu1vYHi5+Y1RGwPEL/5Si8sso3uQAGDJxQ7r36k=; b=Uws+OlIzKdCCODWb6htJhyIHy4ZmNJYGJMLXdUJsVjvceyiTse3fHndOvojqMJHRPAXjvrwHBU8h9TmqqTIlfe4ectRQ2+d6hNjU0sW3P3QbXnCaCCAqQIcjIPxVnFUZygVPzpIsMXjD+csZ/obFF9rhmp3/Ssnh2vi5qN51w6M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748383314248893.575811380793; Tue, 27 May 2025 15:01:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uK2Mo-0002nV-C1; Tue, 27 May 2025 18:01:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uK2Mm-0002nM-Se for qemu-devel@nongnu.org; Tue, 27 May 2025 18:01:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uK2Mk-0008W2-R1 for qemu-devel@nongnu.org; Tue, 27 May 2025 18:01:48 -0400 Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-357-NEvSyinTOKuIx8JP9n3TXQ-1; Tue, 27 May 2025 17:58:58 -0400 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-6f8e1d900e5so66764806d6.2 for ; Tue, 27 May 2025 14:58:58 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6fabe4f27cdsm914516d6.49.2025.05.27.14.58.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 May 2025 14:58:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1748383305; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iIQUQu1vYHi5+Y1RGwPEL/5Si8sso3uQAGDJxQ7r36k=; b=Rh+mjaXbURt7RTlJJIrfH6b6Qe8VsOsvgIPs/C7xc857cdjw6ALTVpUFTBuxryhChYelpy IKHLU1V4bfKepE3uFG7wOO/+eFaBWezlU4t82izQ54e3eAJB27Lr9OA4HJxRTsuDOBrRBt l8N4yEEoc9vbCCaw9Qf9ysjsq+GrfAY= X-MC-Unique: NEvSyinTOKuIx8JP9n3TXQ-1 X-Mimecast-MFC-AGG-ID: NEvSyinTOKuIx8JP9n3TXQ_1748383138 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748383137; x=1748987937; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iIQUQu1vYHi5+Y1RGwPEL/5Si8sso3uQAGDJxQ7r36k=; b=a6dKZbAV2a/5MYbxovHmVV1Y0OQU+LEBcFMw2N1TE9d5Rq28bjYRgIeHJVx2PgSlup idwkM+a9IDpJhdjfDTXih/S2pmcD/FDBw0mWJqDaes1kNBH6JLifiqs0JQ+HF83Gm1of A7SFt9j6fhHOcDPqAAtGcD52nznTpQlCXIPy9U89Pjyzf8rfXrBD06b13tdk0A2avSQP 9Rud4JTnkuqgtPK8Z+i4ZTr7DToMBKpif1cvMs6deUFACSNn5+VyuTTeDAG5EbGUclK7 h4OhSoSCIYvvBCmscTMI5BMTCC/4JtFNLQeStxuV0M5SB/0SXel0XfJGphapdBdKHhaJ IZLg== X-Gm-Message-State: AOJu0YzaiJOrPZxB9NGkEhcQh4DrC5xipQWcdq6hYK72b89/eI9MmF2f iNEkUI1uW3Fm4a004eQw+HWyaeA1A9/RHKm8csA9Y2D06pq6EmpZx+Vr32oLmteQby4L+6R4OYs LqcPE83tr2fecoYkfJ8jEEsDptZQEALg8JFEefAuOuGUBccVwSpLwqJYs8FjaHz7l0w3Gbtgf+J YTqXYtS/YOsOjRGkCkiSmrZaDNMpgNQNeBb0ylHQ== X-Gm-Gg: ASbGncv2XbmfqmX4tuDll5MiM7Q57wuJLIVN+UbLwIplp+1jYorYA2SFdFQJKljwfrt zjFbajErq/9v56c/eTzfOs8OHeHal6u2gFSdLBvTQr/VxTU3yr7NZCDBBEK+ftdYL5AeH5CkFgi M0mtFNhriK6ZZk2+fgJXWn9mCyNJb0QSivtv7/xmYjhkA+/OpczC+3GSRsv/JuKI71KkDjrMW71 /FvA+LdUktoZQ0wm9Od79cnsyrb/9dBDokzOIdMFvyyDBwXDR1VngYuPKyGnTcWnvalUgIUbdGn X-Received: by 2002:a05:6214:f04:b0:6e8:f4d3:e8a5 with SMTP id 6a1803df08f44-6fa9d0269b2mr213412816d6.15.1748383137278; Tue, 27 May 2025 14:58:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGUSi3UJJeg77h5NJfX4md6xlEHNDNDhxGEJU9Lw5CnjoWlsEfi3FWQn2Oh1nn6hz74t3N6Qg== X-Received: by 2002:a05:6214:f04:b0:6e8:f4d3:e8a5 with SMTP id 6a1803df08f44-6fa9d0269b2mr213412476d6.15.1748383136828; Tue, 27 May 2025 14:58:56 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Juraj Marcin , peterx@redhat.com, Fabiano Rosas , "Dr . David Alan Gilbert" , Alexey Perevalov , Markus Armbruster Subject: [PATCH 02/11] migration/hmp: Fix postcopy-blocktime per-vCPU results Date: Tue, 27 May 2025 17:58:41 -0400 Message-ID: <20250527215850.1271072-3-peterx@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250527215850.1271072-1-peterx@redhat.com> References: <20250527215850.1271072-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -49 X-Spam_score: -5.0 X-Spam_bar: ----- X-Spam_report: (-5.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.907, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1748383316454116600 Content-Type: text/plain; charset="utf-8" Unfortunately, it was never correctly shown.. This is only found when I started to look into making the blocktime feature more useful (so as to avoid using bpftrace, even though I'm not sure which one will be harder to use..). So the old dump would look like this: Postcopy vCPU Blocktime: 0-1,4,10,21,33,46,48,59 Even though there're actually 40 vcpus, and the string will merge same elements and also sort them. To fix it, simply loop over the uint32List manually. Now it looks like: Postcopy vCPU Blocktime (ms): [15, 0, 0, 43, 29, 34, 36, 29, 37, 41, 33, 37, 45, 52, 50, 38, 40, 37, 40, 49, 40, 35, 35, 35, 81, 19, 18, 19, 18, 30, 22, 3, 0, 0, 0, 0, 0, 0, 0, 0] Cc: Dr. David Alan Gilbert Cc: Alexey Perevalov Cc: Markus Armbruster Signed-off-by: Peter Xu --- migration/migration-hmp-cmds.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 367ff6037f..3cf890b887 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -208,15 +208,20 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdic= t) } =20 if (info->has_postcopy_vcpu_blocktime) { - Visitor *v; - char *str; - v =3D string_output_visitor_new(false, &str); - visit_type_uint32List(v, NULL, &info->postcopy_vcpu_blocktime, - &error_abort); - visit_complete(v, &str); - monitor_printf(mon, "Postcopy vCPU Blocktime: %s\n", str); - g_free(str); - visit_free(v); + uint32List *item =3D info->postcopy_vcpu_blocktime; + int count =3D 0; + + monitor_printf(mon, "Postcopy vCPU Blocktime (ms): \n ["); + + while (item) { + monitor_printf(mon, "%"PRIu32", ", item->value); + item =3D item->next; + /* Each line 10 vcpu results, newline if there's more */ + if ((++count % 10 =3D=3D 0) && item) { + monitor_printf(mon, "\n "); + } + } + monitor_printf(mon, "\b\b]\n"); } =20 out: --=20 2.49.0 From nobody Sat Nov 15 19:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1748383190; cv=none; d=zohomail.com; s=zohoarc; b=XAPbv6FM7xNuMnKlpdeJG29YkuUFOPetH/DQlKsnrJvUB0WL7sidJR4LJmR60KviNJwV0GTbFMNEhMAq/eh7woDqtYr/e62a99T64KA2x67ol16N5sz7QdhRGpySeHRzG53nv09yrEd2WScuG0VLRwX//16l4UnQSZCT9uHYS5I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748383190; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=KKj88guqNck61IBFBPod07ps5JD2pesHip82PrHuWHs=; b=bLs+JjF806D2C8DOOFgWDEES02rbjJDX8mWZzK0cGQr2F1xOqzJ/TLZYijQcxik6Az25EmsMTnsTrzpJG+Jvj3xDoWAeA8ibQ8zU7V9Q+usLut0/1f6Ndf9UTdiPMf59EWH0+dGlAEHC7pZMjAWui7ZVYLFptFmVV5aas+rqwS0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748383190408235.89891523424865; Tue, 27 May 2025 14:59:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uK2K9-0004iM-4e; Tue, 27 May 2025 17:59:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uK2K6-0004hK-Pn for qemu-devel@nongnu.org; Tue, 27 May 2025 17:59:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uK2K5-00086H-AG for qemu-devel@nongnu.org; Tue, 27 May 2025 17:59:02 -0400 Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-597-ypn2uxfrP1mGhU2OzncPbA-1; Tue, 27 May 2025 17:58:59 -0400 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-6faa66f6c78so5486066d6.0 for ; Tue, 27 May 2025 14:58:59 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6fabe4f27cdsm914516d6.49.2025.05.27.14.58.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 May 2025 14:58:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1748383140; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KKj88guqNck61IBFBPod07ps5JD2pesHip82PrHuWHs=; b=jAf75dyb7fNVmDGtNRT3OfbGbGzKPXqfO+YWeLUNoW0n65ZnuULGdvYW760wDJk6it9nW+ kLRIV0FXGhCtrI9WUlTodVNY/RMeOCvYBODHn7lywPudiu5GUSK8POSuiDxlY5fAr+FnwH bHzUmCMjaN6aYHHuZXOQcgTQALXR72E= X-MC-Unique: ypn2uxfrP1mGhU2OzncPbA-1 X-Mimecast-MFC-AGG-ID: ypn2uxfrP1mGhU2OzncPbA_1748383139 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748383138; x=1748987938; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KKj88guqNck61IBFBPod07ps5JD2pesHip82PrHuWHs=; b=lkbhYzCAmTbv+njj1Zi0ittv4the3YKhraJuDG51tXnJf8vwv2lI1Jiaq0cEdPXliG A0DYyVGvIn2AttOtCa4fsok1xAVqrnYwRKUAF4Y65L2unrM/xMuRx34SCVY1OXkjXrj1 67xW3MdrTrDmV0I9NhQZOWyw63ct4zSy4+AjtfJKOg7vjeS4LZi/xJ/eJSDlJbhzKMXp oIkpAokrLB06a6/hD2dLnDVpL085/zRTy2djBgYpF/f9Aaumd1PoKr8yWTQ9+MSO/Xih XdplSfdlv3eODZkKi0Ps0c6uYx29nSWAIGARAIZjS2XdQgs2QERExdyOVCjOL7w+7ZbH MMMg== X-Gm-Message-State: AOJu0YyOXps4ex4qgbHtrz0GIgrE5fjvmoFynk/dHRO44Uhe4RtQKbwX FzuSxobMc83TRW3xSzkwiQRGos7fqX5X8R5NcE1bo4cILUoU4G+RIMzJnIosC8xoYQ2Vw13Uogt AvCB+9RuZjW/hTiwAhR+z8HPoukVQkW12VTDRpuYs9rFWkk6GSDKqqJwJqrn9FIzen1D6aiUc+k h68wmtJfkqs/cp9npKgIvfvH2tbOx8HpKmUthzBw== X-Gm-Gg: ASbGncsnTRm8rotBrkIN+YDm3nrP3PsoqWs+lE1sHv3ikscyU77huT90TDyBwc95fsK 6yXLWvucZAE8yVVdrcqX83tO9cniRCUisWUFmWMULE/BBMIL83Hs99NNtwqu2baH6Pg0iHr+i5a EIacdPGs+tHzLtvqXUQa58cWEDkiAmn2aO3PW37egUsc50RFvFnXfYj3TxS81iSbGLyKOSn3+rF 1/fASiuoHej6QCZAXtquqDpMLYJE0vlBnZGPxtZPxCF62H8UvxFwp1FL1PhfdxkQb4InUT88cq3 X-Received: by 2002:a05:6214:2461:b0:6fa:a52b:d4ba with SMTP id 6a1803df08f44-6fab9ea8514mr40642546d6.12.1748383138591; Tue, 27 May 2025 14:58:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFjBPsezoRPeFuu+6e++/RIDvWLYp9703pFdjLWRuS04DceRkH7JUgxhuk1a5gvkIwb+EdnRg== X-Received: by 2002:a05:6214:2461:b0:6fa:a52b:d4ba with SMTP id 6a1803df08f44-6fab9ea8514mr40642336d6.12.1748383138244; Tue, 27 May 2025 14:58:58 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Juraj Marcin , peterx@redhat.com, Fabiano Rosas , "Dr . David Alan Gilbert" Subject: [PATCH 03/11] migration/docs: Move docs for postcopy blocktime feature Date: Tue, 27 May 2025 17:58:42 -0400 Message-ID: <20250527215850.1271072-4-peterx@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250527215850.1271072-1-peterx@redhat.com> References: <20250527215850.1271072-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -49 X-Spam_score: -5.0 X-Spam_bar: ----- X-Spam_report: (-5.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.907, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1748383192718116600 Content-Type: text/plain; charset="utf-8" Move it out of vanilla postcopy session, but instead a standalone feature. When at it, removing the NOTE because it's incorrect now after introduction of max-postcopy-bandwidth, which can control the throughput even for postcopy phase. Signed-off-by: Peter Xu Reviewed-by: Juraj Marcin --- docs/devel/migration/postcopy.rst | 36 +++++++++++++++---------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/docs/devel/migration/postcopy.rst b/docs/devel/migration/postc= opy.rst index 82e7a848c6..e319388d8f 100644 --- a/docs/devel/migration/postcopy.rst +++ b/docs/devel/migration/postcopy.rst @@ -33,25 +33,6 @@ will now cause the transition from precopy to postcopy. It can be issued immediately after migration is started or any time later on. Issuing it after the end of a migration is harmless. =20 -Blocktime is a postcopy live migration metric, intended to show how -long the vCPU was in state of interruptible sleep due to pagefault. -That metric is calculated both for all vCPUs as overlapped value, and -separately for each vCPU. These values are calculated on destination -side. To enable postcopy blocktime calculation, enter following -command on destination monitor: - -``migrate_set_capability postcopy-blocktime on`` - -Postcopy blocktime can be retrieved by query-migrate qmp command. -postcopy-blocktime value of qmp command will show overlapped blocking -time for all vCPU, postcopy-vcpu-blocktime will show list of blocking -time per vCPU. - -.. note:: - During the postcopy phase, the bandwidth limits set using - ``migrate_set_parameter`` is ignored (to avoid delaying requested pages = that - the destination is waiting for). - Postcopy internals =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 @@ -312,3 +293,20 @@ explicitly) to be sent in a separate preempt channel, = rather than queued in the background migration channel. Anyone who cares about latencies of page faults during a postcopy migration should enable this feature. By default, it's not enabled. + +Postcopy blocktime statistics +----------------------------- + +Blocktime is a postcopy live migration metric, intended to show how +long the vCPU was in state of interruptible sleep due to pagefault. +That metric is calculated both for all vCPUs as overlapped value, and +separately for each vCPU. These values are calculated on destination +side. To enable postcopy blocktime calculation, enter following +command on destination monitor: + +``migrate_set_capability postcopy-blocktime on`` + +Postcopy blocktime can be retrieved by query-migrate qmp command. +postcopy-blocktime value of qmp command will show overlapped blocking +time for all vCPU, postcopy-vcpu-blocktime will show list of blocking +time per vCPU. --=20 2.49.0 From nobody Sat Nov 15 19:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1748383190; cv=none; d=zohomail.com; s=zohoarc; b=mqqvEPgUTmmkPe3nzCotlnI9suk8xbqVzR1tZCGfuatZRrRSQL3Yx0oIhFf9d4NdZqAZuf0Duo9HzQ7RmbbsYsM7PFOshVAKCdBuqyZN/8x2jSjJ2r7GxVpNMUg1B8Evc7VOqZ4lWe9gc50kuGU5rfxSULFDRiO5v5mnsq98HQ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748383190; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=oBPJYh4awj1/1POQMjqRYxwnju5UeXUDjsTRvIqFEdk=; b=Wrgwi1PeP+d7jcBxw9kwOoMWzJCSQc8xvYWQZIRL9VPCvfPEmf9OTDr3oCRW8z9NNdaZJ7JnYBEQQMrFeZB26SaVfjFdQKFwKAPGiefsBfKGr3idqcOG2PN6OMn7zKL8+8LEa453TsFFMOJcue0G17jmA5zjCg1bdsVFOsprMQA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748383190437272.11486506830806; Tue, 27 May 2025 14:59:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uK2K9-0004iN-OX; Tue, 27 May 2025 17:59:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uK2K7-0004hz-Ro for qemu-devel@nongnu.org; Tue, 27 May 2025 17:59:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uK2K6-00086X-Hk for qemu-devel@nongnu.org; Tue, 27 May 2025 17:59:03 -0400 Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-655-ou4VulYHMlOdX4DZRZI3gw-1; Tue, 27 May 2025 17:59:00 -0400 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-6f0e2d30ab4so66377326d6.1 for ; Tue, 27 May 2025 14:59:00 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6fabe4f27cdsm914516d6.49.2025.05.27.14.58.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 May 2025 14:58:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1748383141; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oBPJYh4awj1/1POQMjqRYxwnju5UeXUDjsTRvIqFEdk=; b=U61/7GmXyhR7rP0S31tjw4u7SrWojHvq5J6wfMk65jFnZHSly6COgefNt7iJFo74cVk56B r/ujdq+8xW8S4TyrvqKwVwYHbqxcj2BvZAohekKeCjw18vQ5Jefgac0f9Wejt7m1u7stIw ZNPttNMA5/TNUMb3iHYephgVeJQuCyI= X-MC-Unique: ou4VulYHMlOdX4DZRZI3gw-1 X-Mimecast-MFC-AGG-ID: ou4VulYHMlOdX4DZRZI3gw_1748383140 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748383140; x=1748987940; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oBPJYh4awj1/1POQMjqRYxwnju5UeXUDjsTRvIqFEdk=; b=J7Ynsucknqf2FHYqANIxvxc4PlY00BMWS2xF3QghAsuAdxeN5TQRFMWZjkCC8tWfQ3 eenqW4fhC7NwhczrqfB/KIS4bUSZjPj7zLDKjE3l1iongWgYBH5wdvAMySQFr07dYrN4 9hpclmdG+V+ft89jq21drnpiA4biM4wWzjA6RWy0GNjM16jqeh8MK3bncJg1LWmzMSQB TcnMxPHIdEkp4x+rSFkZlqLQzdZ3hR2BAYYs8J8UwLOnq2MKQxmIJFdTiJTV7ZJpGBaI tS2bbnHZtINASHCpPszgxuhwJ7FRuKhwn2jiPIYTrOZqZdR+srtUzQbcQYGnDOFqLs+O Z+bg== X-Gm-Message-State: AOJu0Yw+6+0f3nl7D8mm4AWvfiz2Le9ZfWHD2LrZPeftHk53w5k0QQFC +yXKuMhGc/MmtasfP7wDHgqbsStMzcNaLUiAEsRvD6wEfQBbtFu9d9utvznrVys+NzwiTfm/3US vzqTD6Elq2yJd7ZWxZb36e1NJzoKnE/foHyjAvy/dZCSrzIeMWd1FOEkhcGrdEdisxcDxb7qbjk j5rnGIzVBfmPHtdknKjbqTZR9I9SDZRLaU03ZsjQ== X-Gm-Gg: ASbGnct5/VUsHtSl7Y1XvcLZi0NU9UWMC0a8zVAHXDjG60EtDmNzkJ4CegF5pj57H1D Y+2OrYGBdz9I1SVlfviUu44+lTNNLoILEKWP6h90ZRmHWaVazhcLjE0PqqDTq12SGJb4qpHctYD E8PHg4VaxKvsj5wRzyrrMQEoADfYlMVPqIcJtVf63sXjdAujQwVvIijGbjSl9KqTT09bcmDKBbx 9jPJ4tbtV3TZ3fK2qzVj8bAhj9/10xVS1a0rSJ3xIoktv9HJddBA6x37rvvSLH2/gO06hdGYaph X-Received: by 2002:a05:6214:401b:b0:6f5:4214:774a with SMTP id 6a1803df08f44-6fa9d29d04cmr236353816d6.41.1748383139844; Tue, 27 May 2025 14:58:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEdBLAP9+XbvCDFi2G91SWkxCE6UJmzNXjFE1YF7NK6Tqpmyw5An+o9qlrZH2SkofZANoRiDQ== X-Received: by 2002:a05:6214:401b:b0:6f5:4214:774a with SMTP id 6a1803df08f44-6fa9d29d04cmr236353576d6.41.1748383139542; Tue, 27 May 2025 14:58:59 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Juraj Marcin , peterx@redhat.com, Fabiano Rosas , "Dr . David Alan Gilbert" Subject: [PATCH 04/11] migration/bg-snapshot: Do not check for SKIP in iterator Date: Tue, 27 May 2025 17:58:43 -0400 Message-ID: <20250527215850.1271072-5-peterx@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250527215850.1271072-1-peterx@redhat.com> References: <20250527215850.1271072-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -49 X-Spam_score: -5.0 X-Spam_bar: ----- X-Spam_report: (-5.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.907, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1748383192621116600 Content-Type: text/plain; charset="utf-8" It's not possible to happen in bg-snapshot case. Signed-off-by: Peter Xu Reviewed-by: Juraj Marcin --- migration/migration.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 4697732bef..7bd78dd524 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3890,9 +3890,8 @@ static void *bg_migration_thread(void *opaque) =20 while (migration_is_active()) { MigIterateState iter_state =3D bg_migration_iteration_run(s); - if (iter_state =3D=3D MIG_ITERATE_SKIP) { - continue; - } else if (iter_state =3D=3D MIG_ITERATE_BREAK) { + + if (iter_state =3D=3D MIG_ITERATE_BREAK) { break; } =20 --=20 2.49.0 From nobody Sat Nov 15 19:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1748383251; cv=none; d=zohomail.com; s=zohoarc; b=Felts2Xx9ouDS+4tdFWuFx3B0/DhNuVUS48gawpC5fIgydiNf4zO4NII/EvoDW2xvvpmM2M8Ny2+uYKEgMZyfGjgSJFSIHx1NeyrzPZUcUpVaQifiUQbW8wdUtH+cR0GfFn4DNNixrGvlqmVXr33QwmpeqxGqa7oUP8Q2wNM9IU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748383251; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=yIlAgqOWKOqSEUzDQT/GOunQvqeaHzoRg1BUuH85Fug=; b=j/IV9e/Tx9sBa1GabeblQFwMGhfS7w7djkt432urxZw34c9t/XtQ3GhAX45zfukjq9QfpfkNa9i2PytbpaaEu0u4RwT4i6FBRGDv3Ad/JJL00suaeLb/VZZnmUBv7QLuQYbjF3UEVa3h60y7poR/dksM/QE2ONclBr2wFVassgg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748383251582254.19754177182017; Tue, 27 May 2025 15:00:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uK2KE-0004j5-Lt; Tue, 27 May 2025 17:59:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uK2KA-0004ic-32 for qemu-devel@nongnu.org; Tue, 27 May 2025 17:59:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uK2K8-00086u-9m for qemu-devel@nongnu.org; Tue, 27 May 2025 17:59:05 -0400 Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-635-NZXDOMC3MnSH6DmW4n2-0w-1; Tue, 27 May 2025 17:59:02 -0400 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-4767e6b4596so64825991cf.2 for ; Tue, 27 May 2025 14:59:02 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6fabe4f27cdsm914516d6.49.2025.05.27.14.58.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 May 2025 14:59:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1748383143; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yIlAgqOWKOqSEUzDQT/GOunQvqeaHzoRg1BUuH85Fug=; b=SPpKQ/nOn6sU1pwJL/vULcoqB0UdOTZhpjNchGU5TIbEHxNHe4vksJWJ3xkOFtAJt9XHtp cVttbhcFwSX97hHA84gUwvz592BfSYMXO34OJlUpDDqn+pd1fB0vINFIVn7OHY4U23tger WMqOEl/MMN0TS6ZEGpsx0ujRRffc2lM= X-MC-Unique: NZXDOMC3MnSH6DmW4n2-0w-1 X-Mimecast-MFC-AGG-ID: NZXDOMC3MnSH6DmW4n2-0w_1748383142 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748383141; x=1748987941; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yIlAgqOWKOqSEUzDQT/GOunQvqeaHzoRg1BUuH85Fug=; b=fjZDuz7/mE9Xc5523jjbVDf5Bk9XI7rlqJYextPQ9H5RMG8TpjcyhmdRACr5u6D4bE y3t13Y7S8ejsruDPFxKmwDggI3gX57SvQWhW3AKFDhLRftKCQT/Va0M1Zag1drsugIfD fRQwOwWnF9DW2RDkY1l53xNkxkYuByWT+CwyLH6YaAo2Ixx0YtgTgjNZ3mzhKyWbDyoJ GsV66Q8AyuWjM4tyIaI7yf6FVwTcy2P+lw/gUaX/LwH9Xw0wo8mjn7ZcyHH+q4xUyxvY MXtS05puBdz4DgoOpZZu5Lm0ygNAeK0EPxDgH2w/YKYUNhL5fTtQaUO+QUdcl18Nm3XN OX3g== X-Gm-Message-State: AOJu0YxJ5RMcQBvPUP7PL4rtcASBZaBT+PlJv1tmvBxMtv1XiLswcYd4 dPb5P0gUMK6OFz8/+2yaF71XDgdddaJbZjoveBGjWKCKmzGGCgjBVuXEI5rhDu4Pgcv8ACPFMyt r2w+Q0w97az1W4FxLG8U8Q4O2lwRqrKqP3IkZ3TgperJu9f/1xbJdc+jfK+25FYrMmulhgjjq6u z7f0nHWidL2qPY0Yw+n3h0095KcCvGlYIS4UaHlg== X-Gm-Gg: ASbGncuCV9/HRvbJRgHZHE9jvdP8plMJl7okmLsLEDoTC0pLBX7mDStQ30TWvf7RHXl sB2+5xE571Yjs1EOtbfGvxiFGaSmWo1MLKvF7Jbo8mOUezHlczOLy4PvdDEDTvUkONv21u2c1Vp 4l+uJqQtFhWYTemFxTgQpnvAwGtpoV4utIVxloumJSuw2wL3GQTa+gMLmd/yMXt47JIEOdNsYDn 2rAR/DHynoUxbrY0TQQ+Fy60TcloReYHEBH8c29SuLYMi70oCB+8sjYwFYFcpY+ldOIW9V+8dZM X-Received: by 2002:a05:622a:4a0e:b0:477:e4e:9186 with SMTP id d75a77b69052e-49f46056ff6mr286997351cf.11.1748383141279; Tue, 27 May 2025 14:59:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHvzgMi9lDKAaWu3e72Hl5Q1R15+d2Avli3uTMykXtQcTjXBk33uup36pkQFIxdUb8SZnZcWw== X-Received: by 2002:a05:622a:4a0e:b0:477:e4e:9186 with SMTP id d75a77b69052e-49f46056ff6mr286996941cf.11.1748383140813; Tue, 27 May 2025 14:59:00 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Juraj Marcin , peterx@redhat.com, Fabiano Rosas , "Dr . David Alan Gilbert" Subject: [PATCH 05/11] migration: Drop save_live_complete_postcopy hook Date: Tue, 27 May 2025 17:58:44 -0400 Message-ID: <20250527215850.1271072-6-peterx@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250527215850.1271072-1-peterx@redhat.com> References: <20250527215850.1271072-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -49 X-Spam_score: -5.0 X-Spam_bar: ----- X-Spam_report: (-5.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.907, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1748383253499116600 Content-Type: text/plain; charset="utf-8" The hook is only defined in two vmstate users ("ram" and "block dirty bitmap"), meanwhile both of them define the hook exactly the same as the precopy version. Hence, this postcopy version isn't needed. No functional change intended. Signed-off-by: Peter Xu --- include/migration/register.h | 24 ++++++++---------------- migration/block-dirty-bitmap.c | 1 - migration/ram.c | 1 - migration/savevm.c | 9 ++++----- 4 files changed, 12 insertions(+), 23 deletions(-) diff --git a/include/migration/register.h b/include/migration/register.h index b79dc81b8d..e022195785 100644 --- a/include/migration/register.h +++ b/include/migration/register.h @@ -77,26 +77,18 @@ typedef struct SaveVMHandlers { */ void (*save_cleanup)(void *opaque); =20 - /** - * @save_live_complete_postcopy - * - * Called at the end of postcopy for all postcopyable devices. - * - * @f: QEMUFile where to send the data - * @opaque: data pointer passed to register_savevm_live() - * - * Returns zero to indicate success and negative for error - */ - int (*save_live_complete_postcopy)(QEMUFile *f, void *opaque); - /** * @save_live_complete_precopy * * Transmits the last section for the device containing any - * remaining data at the end of a precopy phase. When postcopy is - * enabled, devices that support postcopy will skip this step, - * where the final data will be flushed at the end of postcopy via - * @save_live_complete_postcopy instead. + * remaining data at the end phase of migration. + * + * For precopy, this will be invoked _during_ the switchover phase + * after source VM is stopped. + * + * For postcopy, this will be invoked _after_ the switchover phase + * (except some very unusual cases, like PMEM ramblocks), while + * destination VM can be running. * * @f: QEMUFile where to send the data * @opaque: data pointer passed to register_savevm_live() diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c index f2c352d4a7..6ee3c32a76 100644 --- a/migration/block-dirty-bitmap.c +++ b/migration/block-dirty-bitmap.c @@ -1248,7 +1248,6 @@ static bool dirty_bitmap_has_postcopy(void *opaque) =20 static SaveVMHandlers savevm_dirty_bitmap_handlers =3D { .save_setup =3D dirty_bitmap_save_setup, - .save_live_complete_postcopy =3D dirty_bitmap_save_complete, .save_live_complete_precopy =3D dirty_bitmap_save_complete, .has_postcopy =3D dirty_bitmap_has_postcopy, .state_pending_exact =3D dirty_bitmap_state_pending, diff --git a/migration/ram.c b/migration/ram.c index fd8d83b63c..8b43b9e1e8 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -4545,7 +4545,6 @@ void postcopy_preempt_shutdown_file(MigrationState *s) static SaveVMHandlers savevm_ram_handlers =3D { .save_setup =3D ram_save_setup, .save_live_iterate =3D ram_save_iterate, - .save_live_complete_postcopy =3D ram_save_complete, .save_live_complete_precopy =3D ram_save_complete, .has_postcopy =3D ram_has_postcopy, .state_pending_exact =3D ram_state_pending_exact, diff --git a/migration/savevm.c b/migration/savevm.c index 006514c3e3..26d32eb5a7 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1485,9 +1485,8 @@ bool should_send_vmdesc(void) } =20 /* - * Calls the save_live_complete_postcopy methods - * causing the last few pages to be sent immediately and doing any associa= ted - * cleanup. + * Complete saving any postcopy-able devices. + * * Note postcopy also calls qemu_savevm_state_complete_precopy to complete * all the other devices, but that happens at the point we switch to postc= opy. */ @@ -1497,7 +1496,7 @@ void qemu_savevm_state_complete_postcopy(QEMUFile *f) int ret; =20 QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { - if (!se->ops || !se->ops->save_live_complete_postcopy) { + if (!se->ops || !se->ops->save_live_complete_precopy) { continue; } if (se->ops->is_active) { @@ -1510,7 +1509,7 @@ void qemu_savevm_state_complete_postcopy(QEMUFile *f) qemu_put_byte(f, QEMU_VM_SECTION_END); qemu_put_be32(f, se->section_id); =20 - ret =3D se->ops->save_live_complete_postcopy(f, se->opaque); + ret =3D se->ops->save_live_complete_precopy(f, se->opaque); trace_savevm_section_end(se->idstr, se->section_id, ret); save_section_footer(f, se); if (ret < 0) { --=20 2.49.0 From nobody Sat Nov 15 19:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1748383260; cv=none; d=zohomail.com; s=zohoarc; b=AM7pi8iker2bC9s7YITfB6u9Y5lp4PRyZ7Ra8O/UBvFQS7ynG7xZUFxdUXgdt8Lxxm70xlH2po0fLtjKuLP4a5pecVJ4FWNAvh//+6oZ8/pBvksZWfEH7HvtALrksp34Dlyj6e7Vz6gDNWP8KstAFmlxz0pIyWM/pXJ04a7DjPA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748383260; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=rF2PSs6USBeJMuUguzOMonpG6ikjGwbjJXliQR0arrg=; b=Ke9yuZCwENPCbkk1UmTQl9Efxm3jxAL1adgV18+JvIOVhd9+Eubqo6m7dBeUG4fIaX3UBukllsgonpQzRGtnI/LOc1fKYolD84RnrT5z1q2ujNac1LPr1MGcRc+CisuH17PSiDnPKE/6mnioTD64hiPHdizHmLk7U/6h6dCRqas= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748383260383145.89478966747947; Tue, 27 May 2025 15:01:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uK2KE-0004j1-2F; Tue, 27 May 2025 17:59:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uK2KB-0004ip-IJ for qemu-devel@nongnu.org; Tue, 27 May 2025 17:59:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uK2K9-00087F-Vi for qemu-devel@nongnu.org; Tue, 27 May 2025 17:59:07 -0400 Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-607-EaEcmh-cNIKKfYPmgYR6cw-1; Tue, 27 May 2025 17:59:04 -0400 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-6faa63b1e32so5369466d6.0 for ; Tue, 27 May 2025 14:59:03 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6fabe4f27cdsm914516d6.49.2025.05.27.14.59.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 May 2025 14:59:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1748383145; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rF2PSs6USBeJMuUguzOMonpG6ikjGwbjJXliQR0arrg=; b=ImfMu2jOUyfCp4pnvCEtO9pi8hvBrcleBp0188c6+aQ1afrGdSvRHldujMgAPaDn8UTuXH QGu8OvWMRy2fMDS3ZvHVm7ixo5k3xs99xJVs1K9P6VQg2rE3uLo2gBTBuN5d0uZeQVMfTh K6JErlWgeAzOF0DvS+6S8ynYkVPlwJU= X-MC-Unique: EaEcmh-cNIKKfYPmgYR6cw-1 X-Mimecast-MFC-AGG-ID: EaEcmh-cNIKKfYPmgYR6cw_1748383143 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748383143; x=1748987943; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rF2PSs6USBeJMuUguzOMonpG6ikjGwbjJXliQR0arrg=; b=d0LKEi/MN520ZMLIZmtFpAh+AJBeKPZ/NIoPrMMrLkdn7qSY5a1l9s0zILaEY6sGTA 52PstMEwUmMniJINmFuzBLBOc1SCYXTFygrwbj2vITRpqjD3UAH4tD230Vd8ioSvWil3 ndtmfM8KHIcJcVXFp/H6FG7De6cQ4l5RkQYYT0FbUdv3NJGG1xyH8qdqN1hrvfViR8EU Jeqys/DmNQ14/j4lQKuHQkSVR/L30plMBbj+nry020y3IoybMUXF0LCdZgmP6/l7TysU baUnKblsE7rra9dI1LyH1G88hHtJjKQOGpwJh9rLur7cdJFvBFJiM1JHYJFpHZiKgeo1 HXaw== X-Gm-Message-State: AOJu0YxSwNxriROFb+5Yp/7DMx/E8UY1fV/5BUbp8C+/fLCZPNCnkB/u Kq+AVi9OM4PaRiw8lNr2RZqz/F45lyBsR/y1axnzXZLd4VDIgTCrw6zFoCwUc4DYxXwsts2Bv/8 elQNw0DPys4Ts5hAMF//uixGgvbJn2CwWx0prc26dTb/zeiuK00ao1gcP6rWbwb+PmEiqPfXCaj gScKqWnvBzrVPxYWoRitHHJCMHT2hVA4MpMl6xRw== X-Gm-Gg: ASbGncsBJapS0lyQw3fnoIiaaNfIKWp2fLLjDd6K318tNN29nE8lQQE7nPYWFW2TRB/ OGhPKwziJk9nE9M/2gm0EQdag6k8asa8mwnfMw1h3NZo9OLuL1vFGQdqtW+caXtc3Li5bSAZAj4 8niS7+9yn3ZQrtWFz5Y7MVdlnzvPpNvo3hu7PFHh9pZWgVKi1AI4sbU6PeD+Z+1W9jsmj8ndH9Q ISZduz1S1yIc93GSBgGKPWohq6XAMUL5GKGh1Px8QEfCqv9gZnXdUv6+FeXkkg5PgWJHTkNp0F0 X-Received: by 2002:ad4:5d65:0:b0:6fa:b467:aa67 with SMTP id 6a1803df08f44-6fab9ed8dd3mr37696146d6.20.1748383142845; Tue, 27 May 2025 14:59:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE8SoVaEMlGK+fQi+3yt3m9dO4UDt0f6WLopkzE/J/rNrC/TU5lxdeAVtJ2i/sLyTiMz3KzjQ== X-Received: by 2002:ad4:5d65:0:b0:6fa:b467:aa67 with SMTP id 6a1803df08f44-6fab9ed8dd3mr37695816d6.20.1748383142424; Tue, 27 May 2025 14:59:02 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Juraj Marcin , peterx@redhat.com, Fabiano Rosas , "Dr . David Alan Gilbert" Subject: [PATCH 06/11] migration: Rename save_live_complete_precopy to save_complete Date: Tue, 27 May 2025 17:58:45 -0400 Message-ID: <20250527215850.1271072-7-peterx@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250527215850.1271072-1-peterx@redhat.com> References: <20250527215850.1271072-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -49 X-Spam_score: -5.0 X-Spam_bar: ----- X-Spam_report: (-5.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.907, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1748383261651116600 Content-Type: text/plain; charset="utf-8" Now after merging the precopy and postcopy version of complete() hook, rename the precopy version from save_live_complete_precopy() to save_complete(). Dropping the "live" when at it, because it's in most cases not live when happening (in precopy). No functional change intended. Signed-off-by: Peter Xu --- include/migration/register.h | 4 ++-- hw/ppc/spapr.c | 2 +- hw/s390x/s390-stattrib.c | 2 +- hw/vfio/migration.c | 2 +- migration/block-dirty-bitmap.c | 2 +- migration/ram.c | 2 +- migration/savevm.c | 8 ++++---- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/migration/register.h b/include/migration/register.h index e022195785..0510534515 100644 --- a/include/migration/register.h +++ b/include/migration/register.h @@ -78,7 +78,7 @@ typedef struct SaveVMHandlers { void (*save_cleanup)(void *opaque); =20 /** - * @save_live_complete_precopy + * @save_complete * * Transmits the last section for the device containing any * remaining data at the end phase of migration. @@ -95,7 +95,7 @@ typedef struct SaveVMHandlers { * * Returns zero to indicate success and negative for error */ - int (*save_live_complete_precopy)(QEMUFile *f, void *opaque); + int (*save_complete)(QEMUFile *f, void *opaque); =20 /** * @save_live_complete_precopy_thread (invoked in a separate thread) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 702f774cda..c5d30f2ebd 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2518,7 +2518,7 @@ static void htab_save_cleanup(void *opaque) static SaveVMHandlers savevm_htab_handlers =3D { .save_setup =3D htab_save_setup, .save_live_iterate =3D htab_save_iterate, - .save_live_complete_precopy =3D htab_save_complete, + .save_complete =3D htab_save_complete, .save_cleanup =3D htab_save_cleanup, .load_state =3D htab_load, }; diff --git a/hw/s390x/s390-stattrib.c b/hw/s390x/s390-stattrib.c index f74cf32636..13a678a803 100644 --- a/hw/s390x/s390-stattrib.c +++ b/hw/s390x/s390-stattrib.c @@ -338,7 +338,7 @@ static const TypeInfo qemu_s390_stattrib_info =3D { static SaveVMHandlers savevm_s390_stattrib_handlers =3D { .save_setup =3D cmma_save_setup, .save_live_iterate =3D cmma_save_iterate, - .save_live_complete_precopy =3D cmma_save_complete, + .save_complete =3D cmma_save_complete, .state_pending_exact =3D cmma_state_pending, .state_pending_estimate =3D cmma_state_pending, .save_cleanup =3D cmma_save_cleanup, diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c index b76697bd1a..33a71f8999 100644 --- a/hw/vfio/migration.c +++ b/hw/vfio/migration.c @@ -824,7 +824,7 @@ static const SaveVMHandlers savevm_vfio_handlers =3D { .state_pending_exact =3D vfio_state_pending_exact, .is_active_iterate =3D vfio_is_active_iterate, .save_live_iterate =3D vfio_save_iterate, - .save_live_complete_precopy =3D vfio_save_complete_precopy, + .save_complete =3D vfio_save_complete_precopy, .save_state =3D vfio_save_state, .load_setup =3D vfio_load_setup, .load_cleanup =3D vfio_load_cleanup, diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c index 6ee3c32a76..a061aad817 100644 --- a/migration/block-dirty-bitmap.c +++ b/migration/block-dirty-bitmap.c @@ -1248,7 +1248,7 @@ static bool dirty_bitmap_has_postcopy(void *opaque) =20 static SaveVMHandlers savevm_dirty_bitmap_handlers =3D { .save_setup =3D dirty_bitmap_save_setup, - .save_live_complete_precopy =3D dirty_bitmap_save_complete, + .save_complete =3D dirty_bitmap_save_complete, .has_postcopy =3D dirty_bitmap_has_postcopy, .state_pending_exact =3D dirty_bitmap_state_pending, .state_pending_estimate =3D dirty_bitmap_state_pending, diff --git a/migration/ram.c b/migration/ram.c index 8b43b9e1e8..ed380ac86f 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -4545,7 +4545,7 @@ void postcopy_preempt_shutdown_file(MigrationState *s) static SaveVMHandlers savevm_ram_handlers =3D { .save_setup =3D ram_save_setup, .save_live_iterate =3D ram_save_iterate, - .save_live_complete_precopy =3D ram_save_complete, + .save_complete =3D ram_save_complete, .has_postcopy =3D ram_has_postcopy, .state_pending_exact =3D ram_state_pending_exact, .state_pending_estimate =3D ram_state_pending_estimate, diff --git a/migration/savevm.c b/migration/savevm.c index 26d32eb5a7..311f2a4c61 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1496,7 +1496,7 @@ void qemu_savevm_state_complete_postcopy(QEMUFile *f) int ret; =20 QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { - if (!se->ops || !se->ops->save_live_complete_precopy) { + if (!se->ops || !se->ops->save_complete) { continue; } if (se->ops->is_active) { @@ -1509,7 +1509,7 @@ void qemu_savevm_state_complete_postcopy(QEMUFile *f) qemu_put_byte(f, QEMU_VM_SECTION_END); qemu_put_be32(f, se->section_id); =20 - ret =3D se->ops->save_live_complete_precopy(f, se->opaque); + ret =3D se->ops->save_complete(f, se->opaque); trace_savevm_section_end(se->idstr, se->section_id, ret); save_section_footer(f, se); if (ret < 0) { @@ -1583,7 +1583,7 @@ int qemu_savevm_state_complete_precopy_iterable(QEMUF= ile *f, bool in_postcopy) if (!se->ops || (in_postcopy && se->ops->has_postcopy && se->ops->has_postcopy(se->opaque)) || - !se->ops->save_live_complete_precopy) { + !se->ops->save_complete) { continue; } =20 @@ -1598,7 +1598,7 @@ int qemu_savevm_state_complete_precopy_iterable(QEMUF= ile *f, bool in_postcopy) =20 save_section_header(f, se, QEMU_VM_SECTION_END); =20 - ret =3D se->ops->save_live_complete_precopy(f, se->opaque); + ret =3D se->ops->save_complete(f, se->opaque); trace_savevm_section_end(se->idstr, se->section_id, ret); save_section_footer(f, se); if (ret < 0) { --=20 2.49.0 From nobody Sat Nov 15 19:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1748383210; cv=none; d=zohomail.com; s=zohoarc; b=Q0KuPEvs3jFGStayEiqguaRPvmRvQO7eVsZQfyCVS2EfzJ9L6p/QXAoVZPPcCwc3piGlv59SP3iccIgSEr3/mWHmsTuwDCvA+gGluDRzANtai2Cd5iJ12awP37fraUeBteIsAe3SAwxo9KrzyB5Gfrwoy+R4wVHcWO2JmUatTFo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748383210; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Itx6jMeOoeSf+G3Cpg/QB5b5z4qMFbEfWVbumqBdGUo=; b=DP8coQ6fNKUthEYpx/M9Fbb+ujzaoMjlSuoWtXbT3ro0E4VV/C/ijAk+EtnsqGQnQiOxDskupqn7idrA5zHhW81P14BY3faaN4bNKVZgHlOdPOeAZBaGmHN4m/lPMQnlCmwXY0Wuz1KoCHL+PBn5NfjvZICV6gXNUMkX2Jb2k98= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748383210420104.70457986760084; Tue, 27 May 2025 15:00:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uK2KL-0004kw-Ug; Tue, 27 May 2025 17:59:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uK2KC-0004j0-La for qemu-devel@nongnu.org; Tue, 27 May 2025 17:59:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uK2KB-00087U-0E for qemu-devel@nongnu.org; Tue, 27 May 2025 17:59:08 -0400 Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-15-ITpDp3xePfSiLp6jdPWxhw-1; Tue, 27 May 2025 17:59:05 -0400 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-6faac462e12so51357966d6.0 for ; Tue, 27 May 2025 14:59:05 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6fabe4f27cdsm914516d6.49.2025.05.27.14.59.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 May 2025 14:59:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1748383146; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Itx6jMeOoeSf+G3Cpg/QB5b5z4qMFbEfWVbumqBdGUo=; b=cmSXJYYnudrCeXJZMZO8VAOOgAzKVd/oc+n5rbnd3MvleVEg5GLlkkiVozUwXxPqWmZhrl OrydLaoC8ZYOUywPH1p40pIJOUiowkSyGeORd9+LYH7+DIQXclxKonxqwXYmv35wLI7uJh IarC0/ptMWTjJ00wHSLftUEUzER38Hw= X-MC-Unique: ITpDp3xePfSiLp6jdPWxhw-1 X-Mimecast-MFC-AGG-ID: ITpDp3xePfSiLp6jdPWxhw_1748383145 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748383144; x=1748987944; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Itx6jMeOoeSf+G3Cpg/QB5b5z4qMFbEfWVbumqBdGUo=; b=ZDUnYOgm0bfMBfA2zh3URWsEDWRDA7TpcvidoZpCqw/kYYrgFiTj9/qk2xB44hU+32 3yiKQK81UYJDnrgfI8my/YKB/MfjArbzFhQzyCAFZcxyatquCegFdCcB9SdiT+FrcPrk Hy5RPD52ytrW3lqMMYo2b/eZxBQIw/90J/NtWDAcukM040z6ywndxVl+18uCWCk+9611 vlzS1RS8IAnvDtbHf5vNQBfaMyYIWDtjPNAoK1RLhbIiqyaxHr3BTmfQ9Qfn2mEsEO5M NIWmaXEIgPhs2MjTUDoeXLSSHWNre3yFmjQluKLQpHEsl6V6wK0qY90UGJ6TsLtVa3l5 Lucw== X-Gm-Message-State: AOJu0YztTgP0mcb2OC6+GdEgT4lYvxerX6njAy+a3U+ABzOq/kIXSg0f 1HLq1fxXr3DfR2OyW3P8+MIag/YvvvkWGj5xWFRFY/1Tqkk8Ix0NhP8bJzvQKqi15CzhUCQOC0F K7fNq3pLG96ll/tfrZGVVCmAKrO/vYWpG7nYAE+H9k3hF+pHAOxVlOzLMYbrYJi9H/LeJ1PiPs1 ht41XMzvC56evI7rP/wkSdqgv6ulfyUM2BXkApug== X-Gm-Gg: ASbGnctpM9hfnbt2XMRcreHaZXrRkpUHQv10JzzTRxxYBgFDOTJQfpUYQQsYneNPxmn KNj9kMkWlI6xXUub/uYDz4hx44jLAwdwa+ZYMIMKjiJsdyhbB2lCHe/Z2tCYm8Nr5em+FBphW/U XFECK7ZvMn4DWvTmN2jk4UPDXD1XBBdsC+ac7YwFebKxuhRiJgeZsP45KQbsgFpfhzZNH/3JM8C QliF5EInZP7vRxFtN1ZrhmA2VuBN3w7phRiLzfTQk2jjNYaHyb6627vhWyj8FKi/5rjRtnZqr+o X-Received: by 2002:a05:6214:764:b0:6e4:2dcb:33c8 with SMTP id 6a1803df08f44-6fa9d287827mr228097466d6.29.1748383144481; Tue, 27 May 2025 14:59:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHVZ4kfQN/R9cDiBjgTSWMZllJAJCtQzg2bjTSRquysbpYKBmPrnUG4emDld1qm7HsClXY7wA== X-Received: by 2002:a05:6214:764:b0:6e4:2dcb:33c8 with SMTP id 6a1803df08f44-6fa9d287827mr228096946d6.29.1748383144009; Tue, 27 May 2025 14:59:04 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Juraj Marcin , peterx@redhat.com, Fabiano Rosas , "Dr . David Alan Gilbert" Subject: [PATCH 07/11] migration: qemu_savevm_complete*() helpers Date: Tue, 27 May 2025 17:58:46 -0400 Message-ID: <20250527215850.1271072-8-peterx@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250527215850.1271072-1-peterx@redhat.com> References: <20250527215850.1271072-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -49 X-Spam_score: -5.0 X-Spam_bar: ----- X-Spam_report: (-5.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.907, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1748383210939116600 Content-Type: text/plain; charset="utf-8" Since we use the same save_complete() hook for both precopy and postcopy, add a set of helpers to invoke the hook() to dedup the code. Signed-off-by: Peter Xu --- migration/savevm.c | 78 ++++++++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 34 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index 311f2a4c61..936e59b41d 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1484,6 +1484,38 @@ bool should_send_vmdesc(void) return !machine->suppress_vmdesc; } =20 +static bool qemu_savevm_complete_exists(SaveStateEntry *se) +{ + return se->ops && se->ops->save_complete; +} + +/* + * Invoke the ->save_complete() if necessary. + * Returns: 0 if skip the current SE or succeeded, <0 if error happened. + */ +static int qemu_savevm_complete(SaveStateEntry *se, QEMUFile *f) +{ + int ret; + + if (se->ops->is_active) { + if (!se->ops->is_active(se->opaque)) { + return 0; + } + } + + trace_savevm_section_start(se->idstr, se->section_id); + save_section_header(f, se, QEMU_VM_SECTION_END); + ret =3D se->ops->save_complete(f, se->opaque); + trace_savevm_section_end(se->idstr, se->section_id, ret); + save_section_footer(f, se); + + if (ret < 0) { + qemu_file_set_error(f, ret); + } + + return ret; +} + /* * Complete saving any postcopy-able devices. * @@ -1493,27 +1525,13 @@ bool should_send_vmdesc(void) void qemu_savevm_state_complete_postcopy(QEMUFile *f) { SaveStateEntry *se; - int ret; =20 QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { - if (!se->ops || !se->ops->save_complete) { + if (!qemu_savevm_complete_exists(se)) { continue; } - if (se->ops->is_active) { - if (!se->ops->is_active(se->opaque)) { - continue; - } - } - trace_savevm_section_start(se->idstr, se->section_id); - /* Section type */ - qemu_put_byte(f, QEMU_VM_SECTION_END); - qemu_put_be32(f, se->section_id); =20 - ret =3D se->ops->save_complete(f, se->opaque); - trace_savevm_section_end(se->idstr, se->section_id, ret); - save_section_footer(f, se); - if (ret < 0) { - qemu_file_set_error(f, ret); + if (qemu_savevm_complete(se, f) < 0) { return; } } @@ -1559,7 +1577,6 @@ int qemu_savevm_state_complete_precopy_iterable(QEMUF= ile *f, bool in_postcopy) { int64_t start_ts_each, end_ts_each; SaveStateEntry *se; - int ret; bool multifd_device_state =3D multifd_device_state_supported(); =20 if (multifd_device_state) { @@ -1580,32 +1597,25 @@ int qemu_savevm_state_complete_precopy_iterable(QEM= UFile *f, bool in_postcopy) } =20 QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { - if (!se->ops || - (in_postcopy && se->ops->has_postcopy && - se->ops->has_postcopy(se->opaque)) || - !se->ops->save_complete) { + if (!qemu_savevm_complete_exists(se)) { continue; } =20 - if (se->ops->is_active) { - if (!se->ops->is_active(se->opaque)) { - continue; - } + if (in_postcopy && se->ops->has_postcopy && + se->ops->has_postcopy(se->opaque)) { + /* + * If postcopy will start soon, and if the SE supports + * postcopy, then we can skip the SE for the postcopy phase. + */ + continue; } =20 start_ts_each =3D qemu_clock_get_us(QEMU_CLOCK_REALTIME); - trace_savevm_section_start(se->idstr, se->section_id); - - save_section_header(f, se, QEMU_VM_SECTION_END); - - ret =3D se->ops->save_complete(f, se->opaque); - trace_savevm_section_end(se->idstr, se->section_id, ret); - save_section_footer(f, se); - if (ret < 0) { - qemu_file_set_error(f, ret); + if (qemu_savevm_complete(se, f) < 0) { goto ret_fail_abort_threads; } end_ts_each =3D qemu_clock_get_us(QEMU_CLOCK_REALTIME); + trace_vmstate_downtime_save("iterable", se->idstr, se->instance_id, end_ts_each - start_ts_each); } --=20 2.49.0 From nobody Sat Nov 15 19:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1748383246; cv=none; d=zohomail.com; s=zohoarc; b=Aa8fKs5QOtKpEvgPDN3jlDUAsuupoO6RtUfZWFzIxGL5PG0+V7L1m4lRMQdn6eHvwcm0Fl0brinj+UMZp6dopuRuKYQzweGy7yq/9HTJCglBwnVZCZ9J6iA89Lu/k0+t8WSxu0eLbBTNi7lUs5h9hEhOjt0IxZsrmWy/Ik8hB0U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748383246; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=6TUQBg817ppc4hwW9V6NKciCAGQ6MOuLEm1abHL7GjA=; b=FKLWdvYhwIrzcHyFLSQ+SWXboqeSPdI3khVsAoA/kWa+b7Q6xinreS/K87/B5a9716eo4QOEe3XPkp5iK+eTqxlKoPChvt6sE0VHG0dZtMKIVMXd8KKvN8PrJv91KFs98pWh0EHcdKR8Qjqqa1bMSQZU8Ui6GZWkBlO/n3hLZGo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748383246226238.01673784440868; Tue, 27 May 2025 15:00:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uK2KH-0004kR-VN; Tue, 27 May 2025 17:59:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uK2KD-0004j6-9v for qemu-devel@nongnu.org; Tue, 27 May 2025 17:59:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uK2KB-00087b-Uq for qemu-devel@nongnu.org; Tue, 27 May 2025 17:59:09 -0400 Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-687-0vEhhQBlME2iLB6q7yTj2g-1; Tue, 27 May 2025 17:59:06 -0400 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-6f8cc1c047dso54346806d6.0 for ; Tue, 27 May 2025 14:59:06 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6fabe4f27cdsm914516d6.49.2025.05.27.14.59.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 May 2025 14:59:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1748383147; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6TUQBg817ppc4hwW9V6NKciCAGQ6MOuLEm1abHL7GjA=; b=Kr+lLx9tHDRwfW+7aUBpSw7c9uA5oIgcKuoG8389NCFbX+GYBAYaIT/8XHwJLVR8AJIlvE W7dS8F9Phn/HZLigrYrBBZOidIeHn1PA5eoa6Saum3Wcp285eSGi2PKBn0bpMhFQrsykZP XCVj+TYufFs+Ab51iJwP2sW7m0Gxqt0= X-MC-Unique: 0vEhhQBlME2iLB6q7yTj2g-1 X-Mimecast-MFC-AGG-ID: 0vEhhQBlME2iLB6q7yTj2g_1748383146 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748383145; x=1748987945; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6TUQBg817ppc4hwW9V6NKciCAGQ6MOuLEm1abHL7GjA=; b=KtaHIs57I+ckEIMMmCU6AxWnJsNGwBjr6IRSANjUVgynndqQOqz0iGagwaS9NOajA2 RnTInxhAOm/FH7U6kLDgPAGVFA1YIfYLwzcj0qL592pfOGNJXfKfI2MdchKKtaqlZrqQ YNwntv/EimPJDXOBCeA/5A6xe74mO1xEe33+Q/Z+8fLNjILoH59+zsIaf8ICzeMI7Gs4 m3xffJwUPr14Dt3GJICoGcB8K74Nk3mH3dEkaar8TguMouBuV1vqzckmOW5t84FDTykk e7xjfaZn0RjU/gbU37YBcfe9YggxRfdA9jd34hr6zbw4N4hH6E+7y4ndnXgBzcqMF0C5 acBA== X-Gm-Message-State: AOJu0Yy5/WVmDtsbymHyPRe+T5PqDBkC2W5MMXNwqWNudUJI3j4Vql4x ZUbydWMHZ+LqrlzGt/nCrNi1ks/yaZyrzJUxNN5Gaxn2AxI6Nz8LkxlA1V3T74AVZuPlvYMbL+V cxEqqLZIe/ciesckV80PgptFAmJ8BHpKfMAIh0XDW6m65o02Nf8WKLDcMrjkTdti2VAPq4rWwau QOYS7DEdQLeNFVHMaKkqVheZiUQingCSFdN3X8rg== X-Gm-Gg: ASbGncsldMSGH87rR2BInw+3J4sCf0kpNWXvGvFGDcdsWHoeO2wlt2kfs03CMrOMlmq WIPSlsy6BqJh3Qq5x469xvKWQEs2EL6WbiJKStlK01v+kB1z7x5OIhZHnFtVu2ZasLjzrNQg75S uzFjAueZd8WZbXQu325KWK+P0zj26RSvbWkK0EFy+CMOfU4rf6HlxdUG4PHfnQ9D95EMyIo+SDJ 5A4okG5wr924/B+Ff1MM6brrwRdY/7J9rl9E7fw1HntA+k4vk9so7axrH5IGA1YcmI08LcHMSjy X-Received: by 2002:ad4:5bad:0:b0:6f5:f6e:832a with SMTP id 6a1803df08f44-6fa9d1435d5mr258021026d6.19.1748383145661; Tue, 27 May 2025 14:59:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFypgnMHOX4jOU4YmiHsfZadLDtx0r6liB9kC9uf7mOCrKAoMH8U8WnLFreIzpEWO0NvldS+w== X-Received: by 2002:ad4:5bad:0:b0:6f5:f6e:832a with SMTP id 6a1803df08f44-6fa9d1435d5mr258020736d6.19.1748383145374; Tue, 27 May 2025 14:59:05 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Juraj Marcin , peterx@redhat.com, Fabiano Rosas , "Dr . David Alan Gilbert" Subject: [PATCH 08/11] migration/ram: One less indent for ram_find_and_save_block() Date: Tue, 27 May 2025 17:58:47 -0400 Message-ID: <20250527215850.1271072-9-peterx@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250527215850.1271072-1-peterx@redhat.com> References: <20250527215850.1271072-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -49 X-Spam_score: -5.0 X-Spam_bar: ----- X-Spam_report: (-5.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.907, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1748383247516116600 Content-Type: text/plain; charset="utf-8" The check over PAGE_DIRTY_FOUND isn't necessary. We could indent one less and assert that instead. Signed-off-by: Peter Xu Reviewed-by: Juraj Marcin --- migration/ram.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index ed380ac86f..c66ad3cf8b 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2285,16 +2285,18 @@ static int ram_find_and_save_block(RAMState *rs) if (!get_queued_page(rs, pss)) { /* priority queue empty, so just search for something dirty */ int res =3D find_dirty_block(rs, pss); - if (res !=3D PAGE_DIRTY_FOUND) { - if (res =3D=3D PAGE_ALL_CLEAN) { - break; - } else if (res =3D=3D PAGE_TRY_AGAIN) { - continue; - } else if (res < 0) { - pages =3D res; - break; - } + + if (res =3D=3D PAGE_ALL_CLEAN) { + break; + } else if (res =3D=3D PAGE_TRY_AGAIN) { + continue; + } else if (res < 0) { + pages =3D res; + break; } + + /* Otherwise we must have a dirty page to move */ + assert(res =3D=3D PAGE_DIRTY_FOUND); } pages =3D ram_save_host_page(rs, pss); if (pages) { --=20 2.49.0 From nobody Sat Nov 15 19:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1748383247; cv=none; d=zohomail.com; s=zohoarc; b=P10aFAzx6bRBs2WT3TO5fBvEYknffYzxyHuqTBQJtSRctOiVyjC2o/3rCDvUdWJ2uyxP8JZ0WrjPXl7A/fC18LzvZMIbNVPQLUjldVn4L8ElooejbX3j18CF4R40LAavn4rgy+YCYdbrZFfySFOKfH/0MxMsmuZbe5s8b/vbZ+E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748383247; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=CUd2N/gt18BX9yz0xYPGJs36PcbgIsSrKQL2cAT1iQ4=; b=eumdqlBwueJllL3UV9zrV3Lfl5j0R6cTNcCURMCt1kF2/RnEp59PtuTSElfKCJv28TrYx+lmJe+H6oATM7ASe3lpn9CJZemI45pTSDHW7KGUcRBPXuuGRzbRf5roVhP6xGrijdLAZkvDZ+vsXz2B7tuFkOZ1GaV75SipABNoyTM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748383247723674.588305569546; Tue, 27 May 2025 15:00:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uK2KH-0004kS-VY; Tue, 27 May 2025 17:59:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uK2KF-0004jl-Bj for qemu-devel@nongnu.org; Tue, 27 May 2025 17:59:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uK2KD-00087u-UU for qemu-devel@nongnu.org; Tue, 27 May 2025 17:59:11 -0400 Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-134-OJT4-EQkOLGIZELD9T1yCw-1; Tue, 27 May 2025 17:59:07 -0400 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-6faacebc952so43112996d6.1 for ; Tue, 27 May 2025 14:59:07 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6fabe4f27cdsm914516d6.49.2025.05.27.14.59.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 May 2025 14:59:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1748383149; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CUd2N/gt18BX9yz0xYPGJs36PcbgIsSrKQL2cAT1iQ4=; b=JUeqPsASqdSUYEAvfj05sz5jWtRP3AfYrhvwvns9XIDTVwxlrjLZkcFK99naegezl1nzaj xtqPMNZV2E2W4zEwil5c0jIdFV2qRI2kJsHqa6WlFdijPwXafPN5Utz8s4vRRQvkz4mOCh ezvGl4EmfJHqkjRynBRiv7Km80fu0eQ= X-MC-Unique: OJT4-EQkOLGIZELD9T1yCw-1 X-Mimecast-MFC-AGG-ID: OJT4-EQkOLGIZELD9T1yCw_1748383147 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748383147; x=1748987947; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CUd2N/gt18BX9yz0xYPGJs36PcbgIsSrKQL2cAT1iQ4=; b=wD+KceTehtRLrDAMzRJ31yNPhn+M/QDd9poURDuNq+R6Q7L1rTld7+d8vCZG/nOejb 37Vb3cdDuyKFkeVYKop1NiZvoKwvcyVhkPVr6ZwcRW767GU3xAOEKlBcflVpQfil+gdh YmMpEZkBIZfkOPrUgCCotB2+kEa654dXBREKJTqOwq3Cl8jMLOsWAZSuTSqcv3JO5yU8 IWgQQ2cIhJBW1Dv2fXxYkHn25EYmkiOV9MYNmdX33e1DTmMMn5a67+yaa1i+vBziA+qs QcGLBP+Rf4n+itlbTAeINvBANFtmUvK8TuWFYc1d+b0xRA+b6ZJ45nsfmuIjodQosaFZ l+8g== X-Gm-Message-State: AOJu0YyBADI4Z7XgEuD5F5EwvPWChl1B1Ckrr9B0Jomo4+U755dwwsqx vvIheqwHUZvj5nRt2aNtf1TRKPoyvwnIC6Ij38xCKKhvTlcRN4SC5vdIclq7xUM6TsIFq0i937X mkjNXPpRpCp8U5S5vhnrXpJARZAx1KbVD0awlCUV2vJWDwUizCNjhqdj0QBZ5RMwoN25/mNnwlw 63PI1Rgr1WeC9x/e7Gz7o+5Mneo4a/ozm9YQRAGA== X-Gm-Gg: ASbGncsHYHXFZTqqui1TUSzREddD9O9Fsmz9qH8uzurECzDxHNLFbm1wRO3Z6ADVZBO Dpk3T7Y5R+UEHRacfYfsMhsFtsckVZjtqIkxaeS0lZysoq3jNJsVb3CR1xCSFK+LoCS/uzm/fxg Mp6X5lymmO9lpB124k+NTr9ahjBAB/rorgdtwZF6bqdO7TPzO/vSgU98Y6Laf9fstODVy4St2Z/ nGMBJtTQwwwAsyjjrftW+8WS8zaTeiRxrQ8NEbSZPHpiXE/eDSTOLwmXAHhd/W29v1DnVWtylI1 X-Received: by 2002:a05:6214:ac6:b0:6e8:f17e:e00d with SMTP id 6a1803df08f44-6fa9d01da5amr257560576d6.14.1748383146874; Tue, 27 May 2025 14:59:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGBeSfDhPYTlvFfN8T+OrMPtuBhoeP3r2g5pSZKi4EKuIhDEYlUdjFHq75J9duiLl/0pN9Aqw== X-Received: by 2002:a05:6214:ac6:b0:6e8:f17e:e00d with SMTP id 6a1803df08f44-6fa9d01da5amr257560276d6.14.1748383146572; Tue, 27 May 2025 14:59:06 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Juraj Marcin , peterx@redhat.com, Fabiano Rosas , "Dr . David Alan Gilbert" Subject: [PATCH 09/11] migration/ram: Add tracepoints for ram_save_complete() Date: Tue, 27 May 2025 17:58:48 -0400 Message-ID: <20250527215850.1271072-10-peterx@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250527215850.1271072-1-peterx@redhat.com> References: <20250527215850.1271072-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -49 X-Spam_score: -5.0 X-Spam_bar: ----- X-Spam_report: (-5.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.907, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1748383249313116600 Content-Type: text/plain; charset="utf-8" Take notes on start/end state of dirty pages for the whole system. Signed-off-by: Peter Xu Reviewed-by: Juraj Marcin --- migration/ram.c | 5 +++++ migration/trace-events | 1 + 2 files changed, 6 insertions(+) diff --git a/migration/ram.c b/migration/ram.c index c66ad3cf8b..a1d0e8ada2 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -3289,6 +3289,8 @@ static int ram_save_complete(QEMUFile *f, void *opaqu= e) RAMState *rs =3D *temp; int ret =3D 0; =20 + trace_ram_save_complete(rs->migration_dirty_pages, 0); + rs->last_stage =3D !migration_in_colo_state(); =20 WITH_RCU_READ_LOCK_GUARD() { @@ -3352,6 +3354,9 @@ static int ram_save_complete(QEMUFile *f, void *opaqu= e) } =20 qemu_put_be64(f, RAM_SAVE_FLAG_EOS); + + trace_ram_save_complete(rs->migration_dirty_pages, 1); + return qemu_fflush(f); } =20 diff --git a/migration/trace-events b/migration/trace-events index c506e11a2e..dcd8fe9a0c 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -105,6 +105,7 @@ ram_load_postcopy_loop(int channel, uint64_t addr, int = flags) "chan=3D%d addr=3D0x%" ram_postcopy_send_discard_bitmap(void) "" ram_save_page(const char *rbname, uint64_t offset, void *host) "%s: offset= : 0x%" PRIx64 " host: %p" ram_save_queue_pages(const char *rbname, size_t start, size_t len) "%s: st= art: 0x%zx len: 0x%zx" +ram_save_complete(uint64_t dirty_pages, int done) "dirty=3D%" PRIu64 ", do= ne=3D%d" ram_dirty_bitmap_request(char *str) "%s" ram_dirty_bitmap_reload_begin(char *str) "%s" ram_dirty_bitmap_reload_complete(char *str) "%s" --=20 2.49.0 From nobody Sat Nov 15 19:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1748383198; cv=none; d=zohomail.com; s=zohoarc; b=Gxpkb84MvepzoKQFDRY0/vnKOKOWjcF8kmPG82NkCp1UZ8aCONR/m0sNXqzY4I0Q85sHZ10/Nif6RGgdkUmgvAyi4SeR5Nmnhc0x/Fa15Mp+q7Dj9XH4uQJkQISyZkLfTJs2/0DYApQ6pK+dmTMkWj0nQF8PDovw/O7b6vOHR0g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748383198; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8rjaoMtmxWqZHgcZh3j5/e8hA4MGM0+maUVVcU22C5c=; b=KrWXy2llc/fXjpPQ2qD82xwf8x7/8GXn7RrkaxPAEyskL+ktWr40sRyK1tFiV9wY3sYUvYRWLSNAs/ZQH7t1lq1tqIosPQPLVqIQiOQ54YSS2KYbk2RH974PGqkaYnwJTZL9YtFaV2qojut5t1eUllZh5FufM1GjqkICYJBWAGA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748383198245287.1733368792876; Tue, 27 May 2025 14:59:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uK2KL-0004ks-Df; Tue, 27 May 2025 17:59:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uK2KH-0004kB-JZ for qemu-devel@nongnu.org; Tue, 27 May 2025 17:59:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uK2KF-000883-8k for qemu-devel@nongnu.org; Tue, 27 May 2025 17:59:12 -0400 Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-339-JMWAE2HrOwGaZ7EHSY1MRA-1; Tue, 27 May 2025 17:59:09 -0400 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-6faa9ffe50fso40638956d6.3 for ; Tue, 27 May 2025 14:59:09 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6fabe4f27cdsm914516d6.49.2025.05.27.14.59.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 May 2025 14:59:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1748383150; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8rjaoMtmxWqZHgcZh3j5/e8hA4MGM0+maUVVcU22C5c=; b=J3lEv090EyQ59BixTBinxHdTZ+HpUiB1bz1xwAVyWtYASvCibC+ZZo6tt77gygvDZBkgL2 XUoPr/BOYeMGhYGMmKNdd6zTLNVrs73jzn3JPCh2pnS2TujlSpDaq2fUfWh/JMgLrJOkhw SqPqoKahB35XHStSyZqndY/HVRwhZYA= X-MC-Unique: JMWAE2HrOwGaZ7EHSY1MRA-1 X-Mimecast-MFC-AGG-ID: JMWAE2HrOwGaZ7EHSY1MRA_1748383149 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748383148; x=1748987948; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8rjaoMtmxWqZHgcZh3j5/e8hA4MGM0+maUVVcU22C5c=; b=DMgI/MEBzsEqJLKHOrFmOBP6a45BEA42nvp65ntMyb+JYIBCk9IWVEt3Nnbh0ZN/FN J2mi91ItTQMerTnaVQPFrKDDNdYsJl6fBH5lz9l3z4BsbaeeN2WaiDXIRg6XqoJGW/gn g7Bomvg3uiZhXWHpMaogc93NgBi2ZAOXkLd7mAUWpyHnydHRMRLllA5J+8mqn6HpfcVZ 2ib0O+GWGSrtXAiOleiSdZa8VV3XdgAnyXyyqmodURtrraJz1Rx9igWcLtYWRaCw4p4d N4AEJL4ELqQjgphqe2BdPi2MjcL0emP828ep9zDWP/z5R16vHYhgV0ytODJ88+Gsh6yU ANyw== X-Gm-Message-State: AOJu0YyHFd/N7L+2tjiv95tx/eyUr82AKQbQkQTUVFOBJc9ZSo9XuajI 3S+7MsiCJzHKoIv6HOhOkQqFQoT67ZG52AdG638jQ7+qEviym/zLp7zbi+TbhaIme+a1E1ANzUO AXGvdtbG9aMiM58ilruCfAqsFK0Mj6V4PfWN+rJxwQZgGZc+bXN8rvPJBat6XejRzAksaItP0HM FJZBD+NfSBZwrElEU7tBUXcHGdkKbmhW6fSDLlog== X-Gm-Gg: ASbGncuoI60fWOSq0T3WfU6GXeupfjVsNZ1ltWK1QRALwAwVQfjIur3EUGgBfZBEjd5 EFsy3xkzR7vkh9i29p3Fz1qH31gK2/UJhQfTi2Sb8OjFE0UH6g4H8kZvz++G1gOLsCABaptaURE DiomsAgXaelV0uvBtKDVcFG0u3JaUFZS5K0aSQA6M4iZltsnBagMN0rF4bfME8F6bTGtkaKQNnD 3DzcCdJbpAzyMuAOg6taqiWmOQY5U9/jvqU1+ucXCwlGN8iTZVeAsszrtoT7QrDuzIcXdASLKHj X-Received: by 2002:a05:6214:3013:b0:6f8:f21a:233c with SMTP id 6a1803df08f44-6fa9d2de23emr254270376d6.42.1748383148250; Tue, 27 May 2025 14:59:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH/q7bRHYU/X0tpI+yPhbBZ/yMv3mKAs+U9IPe1zUljY5U9Lu2zVvyNAIjtaDi5ABoHYPS3qQ== X-Received: by 2002:a05:6214:3013:b0:6f8:f21a:233c with SMTP id 6a1803df08f44-6fa9d2de23emr254270076d6.42.1748383147863; Tue, 27 May 2025 14:59:07 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Juraj Marcin , peterx@redhat.com, Fabiano Rosas , "Dr . David Alan Gilbert" Subject: [PATCH 10/11] migration: Rewrite the migration complete detect logic Date: Tue, 27 May 2025 17:58:49 -0400 Message-ID: <20250527215850.1271072-11-peterx@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250527215850.1271072-1-peterx@redhat.com> References: <20250527215850.1271072-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -49 X-Spam_score: -5.0 X-Spam_bar: ----- X-Spam_report: (-5.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.907, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1748383199174116600 Content-Type: text/plain; charset="utf-8" There're a few things off here in that logic, rewrite it. When at it, add rich comment to explain each of the decisions. Since this is very sensitive path for migration, below are the list of things changed with their reasonings. (1) Exact pending size is only needed for precopy not postcopy Fundamentally it's because "exact" version only does one more deep sync to fetch the pending results, while in postcopy's case it's never going to sync anything more than estimate as the VM on source is stopped. (2) Do _not_ rely on threshold_size anymore to decide whether postcopy should complete threshold_size was calculated from the expected downtime and bandwidth only during precopy as an efficient way to decide when to switchover. It's not sensible to rely on threshold_size in postcopy. For precopy, if switchover is decided, the migration will complete soon. It's not true for postcopy. Logically speaking, postcopy should only complete the migration if all pending data is flushed. Here it used to work because save_complete() used to implicitly contain save_live_iterate() when there's pending size. Even if that looks benign, having RAMs to be migrated in postcopy's save_complete() has other bad side effects: (a) Since save_complete() needs to be run once at a time, it means when moving RAM there's no way moving other things (rather than round-robin iterating the vmstate handlers like what we do with ITERABLE phase). Not an immediate concern, but it may stop working in the future when there're more than one iterables (e.g. vfio postcopy). (b) postcopy recovery, unfortunately, only works during ITERABLE phase. IOW, if src QEMU moves RAM during postcopy's save_complete() and network failed, then it'll crash both QEMUs... OTOH if it failed during iteration it'll still be recoverable. IOW, this change should further reduce the window QEMU split brain and crash in extreme cases. If we enable the ram_save_complete() tracepoints, we'll see this before this patch: 1267959@1748381938.294066:ram_save_complete dirty=3D9627, done=3D0 1267959@1748381938.308884:ram_save_complete dirty=3D0, done=3D1 It means in this migration there're 9627 pages migrated at complete() of postcopy phase. After this change, all the postcopy RAM should be migrated in iterable phase, rather than save_complete(): 1267959@1748381938.294066:ram_save_complete dirty=3D0, done=3D0 1267959@1748381938.308884:ram_save_complete dirty=3D0, done=3D1 (3) Adjust when to decide to switch to postcopy This shouldn't be super important, the movement makes sure there's only one in_postcopy check, then we are clear on what we do with the two completely differnt use cases (precopy v.s. postcopy). (4) Trivial touch up on threshold_size comparision Which changes: "(!pending_size || pending_size < s->threshold_size)" into: "(pending_size <=3D s->threshold_size)" Signed-off-by: Peter Xu Reviewed-by: Juraj Marcin --- migration/migration.c | 56 +++++++++++++++++++++++++++++++------------ 1 file changed, 41 insertions(+), 15 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 7bd78dd524..e542c09755 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3439,33 +3439,59 @@ static MigIterateState migration_iteration_run(Migr= ationState *s) Error *local_err =3D NULL; bool in_postcopy =3D s->state =3D=3D MIGRATION_STATUS_POSTCOPY_ACTIVE; bool can_switchover =3D migration_can_switchover(s); + bool complete_ready; =20 + /* Fast path - get the estimated amount of pending data */ qemu_savevm_state_pending_estimate(&must_precopy, &can_postcopy); pending_size =3D must_precopy + can_postcopy; trace_migrate_pending_estimate(pending_size, must_precopy, can_postcop= y); =20 - if (pending_size < s->threshold_size) { - qemu_savevm_state_pending_exact(&must_precopy, &can_postcopy); - pending_size =3D must_precopy + can_postcopy; - trace_migrate_pending_exact(pending_size, must_precopy, can_postco= py); + if (in_postcopy) { + /* + * Iterate in postcopy until all pending data flushed. Note that + * postcopy completion doesn't rely on can_switchover, because when + * POSTCOPY_ACTIVE it means switchover already happened. + */ + complete_ready =3D !pending_size; + } else { + /* + * Exact pending reporting is only needed for precopy. Taking RAM + * as example, there'll be no extra dirty information after + * postcopy started, so ESTIMATE should always match with EXACT + * during postcopy phase. + */ + if (pending_size < s->threshold_size) { + qemu_savevm_state_pending_exact(&must_precopy, &can_postcopy); + pending_size =3D must_precopy + can_postcopy; + trace_migrate_pending_exact(pending_size, must_precopy, can_po= stcopy); + } + + /* Should we switch to postcopy now? */ + if (must_precopy <=3D s->threshold_size && + can_switchover && qatomic_read(&s->start_postcopy)) { + if (postcopy_start(s, &local_err)) { + migrate_set_error(s, local_err); + error_report_err(local_err); + } + return MIG_ITERATE_SKIP; + } + + /* + * For precopy, migration can complete only if: + * + * (1) Switchover is acknowledged by destination + * (2) Pending size is no more than the threshold specified + * (which was calculated from expected downtime) + */ + complete_ready =3D can_switchover && (pending_size <=3D s->thresho= ld_size); } =20 - if ((!pending_size || pending_size < s->threshold_size) && can_switcho= ver) { + if (complete_ready) { trace_migration_thread_low_pending(pending_size); migration_completion(s); return MIG_ITERATE_BREAK; } =20 - /* Still a significant amount to transfer */ - if (!in_postcopy && must_precopy <=3D s->threshold_size && can_switcho= ver && - qatomic_read(&s->start_postcopy)) { - if (postcopy_start(s, &local_err)) { - migrate_set_error(s, local_err); - error_report_err(local_err); - } - return MIG_ITERATE_SKIP; - } - /* Just another iteration step */ qemu_savevm_state_iterate(s->to_dst_file, in_postcopy); return MIG_ITERATE_RESUME; --=20 2.49.0 From nobody Sat Nov 15 19:07:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1748383198; cv=none; d=zohomail.com; s=zohoarc; b=RztYd0gWrOmaI/IaSnMt1EJNmwQLFwrAyqJXfS8qowb1JjRjVGg7eLeNORP2ICtztj/tH2Ce8PZXWLNEFstXrxDIHY/6tXxyh4Y+SwkriUOEI4TwR3vHTUBab4Xm4MK+4tw03YAL2aAjeaPe/h75hoS+RDajaF8Z9v0ZVZjm1Ns= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748383198; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ow9XZwvFSPaA1YRoz79EY6e13wTkk7fPGrMeCj5AqlA=; b=Pv1nuatRrIkyMCgqUQh2A5CVwCgWHjOD8WxHcDFHUsIR1oe2mNnS3Mlu5Oo0Jud/b8LLed2jTdC1+5U+w6vi5VLuCBpNW59BEQ3tOPpRgWm/OdncrTTzoZlh6um5gdQsoKdkW0IdpDkRNUlhpnhoOZR0DPnY7IgTZp85ImUe9Uc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 174838319878168.08955657316335; Tue, 27 May 2025 14:59:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uK2KQ-0004lZ-8E; Tue, 27 May 2025 17:59:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uK2KI-0004kj-VX for qemu-devel@nongnu.org; Tue, 27 May 2025 17:59:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uK2KH-00088H-CP for qemu-devel@nongnu.org; Tue, 27 May 2025 17:59:14 -0400 Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-263-HCNP35QMOh2IcZFEqTFahg-1; Tue, 27 May 2025 17:59:10 -0400 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-6f50edda19eso56597766d6.1 for ; Tue, 27 May 2025 14:59:10 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6fabe4f27cdsm914516d6.49.2025.05.27.14.59.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 May 2025 14:59:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1748383152; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ow9XZwvFSPaA1YRoz79EY6e13wTkk7fPGrMeCj5AqlA=; b=HUWyYebxsV+bscClle1EJBgvVze70agUCFUUqVyWFWOwZNlnnliLwgg7Tg/ukKetM9UgYM E7VA5iVAHd28REtGkLBW61kUgbcYheQVTcvLd3v/mD1RJq72n+1wFA+TsDBwu4JuylJ5w/ sNwZaGBfMuvuv5ofFCeqQ2JStX2pxu0= X-MC-Unique: HCNP35QMOh2IcZFEqTFahg-1 X-Mimecast-MFC-AGG-ID: HCNP35QMOh2IcZFEqTFahg_1748383150 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748383150; x=1748987950; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ow9XZwvFSPaA1YRoz79EY6e13wTkk7fPGrMeCj5AqlA=; b=wmnRfFBulI7R8061etwW9FWVO60XaWaF/PjZfBcUEjE03n/yO8TYGw+GapFk6/XPah iKTKybU22Ez1TG6uAabJyUBhqq2JMHCiFjZH98ebBdaq6WE3zzID3iJJLDoXj7Ax6YXw trbchDmqWOENil1sjBbuWoCbIHwzY6BZw8mhCWvpqAghujs4P85HjcAc1+iV0o4zF9YP dABLN8CUWotzU4eG89FaZyLDeP3G8OxMuaNB2aRFHPoB04sjBOy6AHkxr9JaKSesW0q4 bygQKwZajb+5JWtyqoE9I10hYttyaSOTfk4JUKF8reoiXroAtT9F7+HKPU82xZ3oo6QL a1gw== X-Gm-Message-State: AOJu0YzlfJJQpJZRomqjgF+VU5yDgqjOCuAay4MSbfaWgc16n12Rmhii xXIFovCfSCeeq6rgwGoXQ/otrkcriaFVNcb4mgpEPpWoVnGvinM/Ct8ZNhPx5vpUFNn9dFrvbH+ WCECy+IG6W9tWdanbXJCaxKEgWo77TIo7z5D2oeEXUd/mKU6q/BfatBXzAue+8bA3HbBuHU4UMU ijcES1pV1OuVzG4gQZS2YmnMG+/UbPdVkA/bTIEg== X-Gm-Gg: ASbGnctylbCuYNRUsZWwCwVPzaTig6Bhn9HSDb+BzG5ghr8vI20L8+TRzgo3/vd2Goi RRC6czjVrf3Dj5cJa7OIPg2dMxyKv+75Ud9/hJfop+gC6DQ58GUVFa6txMluj/Ju+uwCHoRBm3f n5ySOlkPvldUQqm7tIbxGBHMns38iShFMHPwXwDSDIAlFE6xy351tNCTEa6mpV0SRp5YCJR/WF2 jx1pHQst7NHNpNvJDbMFxUnJa7bRWhuulPZ4ktHKXlELxwg1IjhdMw/65FB/JBOUDTAdxS+2yCP X-Received: by 2002:a05:6214:1d0d:b0:6f5:f83:1cf8 with SMTP id 6a1803df08f44-6fa9cfe9a16mr248859066d6.7.1748383149725; Tue, 27 May 2025 14:59:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEERYoWgEOp7ygcCxwDSWKMlmRyOV4jZWAiqDgES13PXu/QctQIcmzedy4Z2V19a3Lq1B54JA== X-Received: by 2002:a05:6214:1d0d:b0:6f5:f83:1cf8 with SMTP id 6a1803df08f44-6fa9cfe9a16mr248858726d6.7.1748383149336; Tue, 27 May 2025 14:59:09 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Juraj Marcin , peterx@redhat.com, Fabiano Rosas , "Dr . David Alan Gilbert" , Yanfei Xu Subject: [PATCH 11/11] migration/postcopy: Avoid clearing dirty bitmap for postcopy too Date: Tue, 27 May 2025 17:58:50 -0400 Message-ID: <20250527215850.1271072-12-peterx@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250527215850.1271072-1-peterx@redhat.com> References: <20250527215850.1271072-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -49 X-Spam_score: -5.0 X-Spam_bar: ----- X-Spam_report: (-5.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.907, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1748383200718116600 Content-Type: text/plain; charset="utf-8" This is a follow up on the other commit "migration/ram: avoid to do log clear in the last round" but for postcopy. https://lore.kernel.org/r/20250514115827.3216082-1-yanfei.xu@bytedance.com I can observe more than 10% reduction of average page fault latency during postcopy phase with this optimization: Before: 268.00us (+-1.87%) After: 232.67us (+-2.01%) The test was done with a 16GB VM with 80 vCPUs, running a workload that busy random writes to 13GB memory. Cc: Yanfei Xu Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas --- migration/ram.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/migration/ram.c b/migration/ram.c index a1d0e8ada2..cd4aafd15c 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -835,8 +835,10 @@ static inline bool migration_bitmap_clear_dirty(RAMSta= te *rs, * protections isn't needed as we know there will be either (1) no * further writes if migration will complete, or (2) migration fails * at last then tracking isn't needed either. + * + * Do the same for postcopy due to the same reason. */ - if (!rs->last_stage) { + if (!rs->last_stage && !migration_in_postcopy()) { /* * Clear dirty bitmap if needed. This _must_ be called before we * send any of the page in the chunk because we need to make sure --=20 2.49.0