From nobody Sun Feb 8 19:30:10 2026 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=1749823727; cv=none; d=zohomail.com; s=zohoarc; b=Ern4zDsdSgWhtRbobr+0IT/jFL6sQ4Rr/zaPhQSVqHa2I5txrE28sNxb6BujVeYPvsU2HCt43iBJ5o61Yjgc+5eB+IC8bida/rX69U+E6/gECEL4YsucOMp/HKAoaNB+q+qM49hF0jeoM2cHcPladgBNu6NV78+pzcgiOLdKF34= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749823727; 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=Eb09oWLwuSnauqTMTtyOC9YBT06C8v5NY6NTl05oP68=; b=gp6ZOLPToXH+PZRb5A7dnKux7W2pF/tlLk4y80SG0+p1ZLLlLworVsTsWfPteJkuuFM9528ysiM06QuZ/4RvSKAF+yojaYiPHB4mjZ9yg3QHtwKq+OTRB0EQNjrPBhcBV+Q284CLIpFPp/AAZEM5iWHxtmtH4YRvgLWk+7nn9lk= 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 1749823727674710.9132487323407; Fri, 13 Jun 2025 07:08:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uQ54w-00048l-8H; Fri, 13 Jun 2025 10:08: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 1uQ54r-00047l-Fh for qemu-devel@nongnu.org; Fri, 13 Jun 2025 10:08:17 -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 1uQ54o-0001TF-Qj for qemu-devel@nongnu.org; Fri, 13 Jun 2025 10:08:17 -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-412-rH5nKDPBNou7lKXnXqF4Bw-1; Fri, 13 Jun 2025 10:08:09 -0400 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-6fad29c1b72so30499466d6.1 for ; Fri, 13 Jun 2025 07:08:08 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4a72a52a1ddsm17384111cf.81.2025.06.13.07.08.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jun 2025 07:08:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749823691; 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=Eb09oWLwuSnauqTMTtyOC9YBT06C8v5NY6NTl05oP68=; b=LPrb0xNa6IcC5yGQW6n31n9JdwEUbJTZu91R9GtxN1GNp8v2jdn4SoFH9Wbg33kzjhWCv9 OyCLvnREuIikGgY0xS/Ff21YUjk+jTweJfB/d8juBsfYldu3mdAYJqNLZrJYt+3rytihQ2 k1kX138wxts8V8JyaOO+D0MOn+DzphQ= X-MC-Unique: rH5nKDPBNou7lKXnXqF4Bw-1 X-Mimecast-MFC-AGG-ID: rH5nKDPBNou7lKXnXqF4Bw_1749823687 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749823687; x=1750428487; 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=Eb09oWLwuSnauqTMTtyOC9YBT06C8v5NY6NTl05oP68=; b=Pf15NDN6c9b7qSyZ3tEqHJcEtrj+ZhO6mp0YhPFaNTpzTp/AYhluF0AuaDdFrtBMdK GJE2u0moS5FNPaqdjzaPU/q8FeOnSJzaDbOMR+n4fhD1WHr93dQzffYhTR8BmSr6OuvB Zrbn68mpreCTyDjTPYL75uCVNfBkF8IMiYB3QJaUNfiOmLpbrliEwCC5wNmrc/elbanN ERWLCcYLO6qepq7zRgjF1f5btIZyOKq2jCLMcHAWFOnTcYe4EAGxlP+jqJgB24TEtFqN JPTVcWjy97gJsLpmOZBcZciVL1DYRgyBzPNINt2FFxa2Nxtt0kxq7seAd+2Q0nFNBfoN 7bkQ== X-Gm-Message-State: AOJu0YxoiA4limTPH2SVb1d17go1wsktaqtJroYpBujP/K6B6g8LkMfE Zab456Bvc/kmQuy7Ea0MsHE1q2QnRqJkGqEeC4IgculQSqC6N37dleQtzmc+D6bMps+hSJlore6 WLTdlO1uL9WIwOlT4d+5l34TO1ByBBvfo9kkPuWDBtPxOJ+vfxlP+ng0I7n7p+C5AbzihZGMz+T b767k1fbIOceLvrxsgyVT3m7vdMx4TI+4wT+vIrg== X-Gm-Gg: ASbGncvHjk8TAzwJLijZavaF/OGhFokL0Lca50QoDs6HCMmxz56yZV51tj/PBTExCH1 jFK5Qzi8HK8BOLv0WRIwwXADpW6EiLPTSxcvyYS2mA2A6dv65tsk66Z+U3v7eUAWpF2h8I8xRCO ccyvpLfVpF9JhVBLnXbNQpW2z6xPIYBXnlnh1zzuZZcGqCwdPd519sHFTQoUSXmZqHnymw2c/iD qyQ5t8YNe/z7DvPPdsghTpyZksn6S0vy5pLDbj91bTOP16YdWAqbkcmTd+2tmNGSyej/dyM9LSN a95EivlIVYg= X-Received: by 2002:a05:622a:5c17:b0:494:a4bc:3b4d with SMTP id d75a77b69052e-4a72fe7833cmr59582161cf.18.1749823686654; Fri, 13 Jun 2025 07:08:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGS09x4u0ZVFzuSVZy7c0tnx6UYEilIa2/+HZTTGDi28eeJ9k+MqGdgqcReWAiJle1+nhnBVw== X-Received: by 2002:a05:622a:5c17:b0:494:a4bc:3b4d with SMTP id d75a77b69052e-4a72fe7833cmr59581381cf.18.1749823686029; Fri, 13 Jun 2025 07:08:06 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Juraj Marcin , Mario Casquero , Fabiano Rosas , "Dr . David Alan Gilbert" , Li Zhijian Subject: [PATCH v3 01/11] migration/hmp: Reorg "info migrate" once more Date: Fri, 13 Jun 2025 10:07:51 -0400 Message-ID: <20250613140801.474264-2-peterx@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250613140801.474264-1-peterx@redhat.com> References: <20250613140801.474264-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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1749823730629116600 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 Suggested-by: Dr. David Alan Gilbert Tested-by: Li Zhijian Reviewed-by: Li Zhijian Acked-by: Dr. David Alan Gilbert Reviewed-by: Juraj Marcin Tested-by: Mario Casquero Signed-off-by: Peter Xu --- 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 Sun Feb 8 19:30:10 2026 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=1749823867; cv=none; d=zohomail.com; s=zohoarc; b=cKvG+b+9bA4XSgcc+uhURmdJhcPa29YX/Np40FVA00m6okVCuwqcCUpsBSkewl9iivSZtWlNBkIIiEf+S9gtME2zHV22L8Gx6pG7R9b/SZaEU8HhzgpPD2j6KJAMb16Xa9LnMnHzbz7pQQsbm2N1FIgcEFg9m6skmbnK/r+V8gs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749823867; 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=ZtGNbngagZowlFdpcI8HvA2dIlze53B9ZOZz7ZeuxTs=; b=C7j1TD3BHYQ6ZbyZmgRDC2SvGZGfG/RG3xOvz8VLHCG/xO445CzUlnURtDAGYyQhs2zmAbcmBckjb0YL16o8aJCuPS4OVDNfSF8BUDUGU6rc88h8gBLWOSyBsCc74+Vu4a/oYN4kZ4+yP1FDYdqp20KqqLmH/QW08NYvd/RcGwA= 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 17498238675481004.8358194811386; Fri, 13 Jun 2025 07:11:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uQ54t-00048N-Iy; Fri, 13 Jun 2025 10:08:19 -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 1uQ54p-000478-Gb for qemu-devel@nongnu.org; Fri, 13 Jun 2025 10:08: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 1uQ54n-0001T9-ID for qemu-devel@nongnu.org; Fri, 13 Jun 2025 10:08:15 -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-367-YGTFkPfaNe-7HfssoxOZ8w-1; Fri, 13 Jun 2025 10:08:09 -0400 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-6fac45de153so31329176d6.2 for ; Fri, 13 Jun 2025 07:08:09 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4a72a52a1ddsm17384111cf.81.2025.06.13.07.08.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jun 2025 07:08:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749823691; 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=ZtGNbngagZowlFdpcI8HvA2dIlze53B9ZOZz7ZeuxTs=; b=clwnNqJC9TfgPQOQIeOgyHMKM22f0uJy5i7pzK3fd1fhNagZ0ta0LYi0JrgzbeQ88oSXpI m9BfUh88fB56evFtIXwwPTuO6ekqm1DFcnEb9rPsSTi40FUiE6KF6Qmty+6FMEBOApF8TJ Gw+VWXGq+v7A3m4zLwPIjaS6rnhdv4c= X-MC-Unique: YGTFkPfaNe-7HfssoxOZ8w-1 X-Mimecast-MFC-AGG-ID: YGTFkPfaNe-7HfssoxOZ8w_1749823688 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749823688; x=1750428488; 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=ZtGNbngagZowlFdpcI8HvA2dIlze53B9ZOZz7ZeuxTs=; b=QUdPIo6iCM/S9H9bTuEucdEOe70+tPJFKKha/EH5gQ2k2x1FzbIz8OChwwgScCkt+8 FAmjRKXe9mAOPzjSahBXL6aQvfIptpicgJj5lyoLn92Zfn33EF8eIcgnxyMm5hWp9wR8 1w/ZOqYe/7aE064GGSsxDHnGNb066YYM9nl5LRJPZFlwxigtQ0GX2OX06JC6hOJyutia XBC43RhtzTw11hXG0ePBIVhilmNN9J9vdAbQgJhhVpgqXEY1eC5aV27qAldsX2/tYPpB koo9QudI6MJiQjr0WvWCKeC2nao5aPaW8XQ56rv0Dc7RpqncD1/mSeKuUrc5EB0JulbR VmaA== X-Gm-Message-State: AOJu0YwKl6LAK8tshDjsoIApbgGZYcWn+9HIeoi5e2JvO/CB46dSA18J RSETHPLT9qDxRD0lrlQyDdLUE1xLeRXgS3DrDSQMnuM3FaA0HZyUT2E3XGL1wM8O8y30LLVVY8T m6GEQxYf5L+Jp+9Ef2Z81QDT1D938nOjJAMlkC6wvz1XbYtqziZ5zfqWWuugmDoovG9FcRCQpL/ Oa2yEwcNtifY1JazQ52eFSzN8WPqNOoQSU7vTxdQ== X-Gm-Gg: ASbGnctos8RELkAnTsLJsK3UZekL/cji0ntVsH0xdpeV3wtoUhFDGGHVy1u9uxqbvOt dTLAWXAj+PcUa3hoNl5hL94FLRCg/N2cplFe+0rfPYSiV2fjK1hq9do3yEq2SEQ5B4GqAKcck8X ouehTobMebUibP4cVhdrv69BKENya26VsH+nm4Bb4p33JyPSjMFeTU6UJlW1/U3Fi0M18EQ75mI Y4l1CsHogjOX9fUYErO+PnbIALkfXxY/iWa7Q6q0dBg9mAavRd/uYxogZxuUhcVmO17iaA6OqrX AEYcCP15HnE= X-Received: by 2002:a05:622a:4816:b0:499:5503:7b2c with SMTP id d75a77b69052e-4a72ff18e39mr59444011cf.43.1749823687920; Fri, 13 Jun 2025 07:08:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHRyPdqjx1gEFBLVGZZXGwrD6+ZD+qblAgtVDjpWiXky+DIFkA0chRsMdL4GBxqbc1F9q0Yrw== X-Received: by 2002:a05:622a:4816:b0:499:5503:7b2c with SMTP id d75a77b69052e-4a72ff18e39mr59443281cf.43.1749823687241; Fri, 13 Jun 2025 07:08:07 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Juraj Marcin , Mario Casquero , Fabiano Rosas , "Dr . David Alan Gilbert" , Alexey Perevalov , Markus Armbruster Subject: [PATCH v3 02/11] migration/hmp: Fix postcopy-blocktime per-vCPU results Date: Fri, 13 Jun 2025 10:07:52 -0400 Message-ID: <20250613140801.474264-3-peterx@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250613140801.474264-1-peterx@redhat.com> References: <20250613140801.474264-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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1749823870108116600 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 Tested-by: Mario Casquero Signed-off-by: Peter Xu Reviewed-by: Juraj Marcin --- migration/migration-hmp-cmds.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 367ff6037f..867e017b32 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -208,15 +208,19 @@ 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; + const char *sep =3D ""; + int count =3D 0; + + monitor_printf(mon, "Postcopy vCPU Blocktime (ms):\n ["); + + while (item) { + monitor_printf(mon, "%s%"PRIu32, sep, item->value); + item =3D item->next; + /* Each line 10 vcpu results, newline if there's more */ + sep =3D ((++count % 10 =3D=3D 0) && item) ? ",\n " : ", "; + } + monitor_printf(mon, "]\n"); } =20 out: --=20 2.49.0 From nobody Sun Feb 8 19:30:10 2026 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=1749823856; cv=none; d=zohomail.com; s=zohoarc; b=QwZpUi1A7EDVxCM2se0zEgMrI5hwswIdCo44GqqjIQAYCiDk2YwpcfJ9RkFN4UQ62JFxqc9F8WCYMgfh0iH4m7VH8tmR/mAWV0nvM+6RWYlcEWLgNNYRK1K5f1Ch1KRHem34AhBQyOyGNfbW/eDqBVlqUUQaMGiFJKD/4ePIvRY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749823856; 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=hT+PxuMKRJ8Bh39RMhUF6/Cm7/wGAILL/wn1CqdT0Rg=; b=cAVVZ6v0LbmPGN9PlOBxtAJaMyRSvMEGacW1f4isgy0NkiJ7uAD6aarak10Kf2LPTv+2TM4PG4lQ9Oc/z9qVY+ksJBpa42Hl3xX+8MN+n2XiZCCFqvnSCgZrUkMNsUjwu3oNmcrTYM9/G3aUv6w+HlOceFfWONAWtOg3oi1omI4= 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 1749823856048945.7960803251572; Fri, 13 Jun 2025 07:10:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uQ54u-00048g-Pl; Fri, 13 Jun 2025 10:08:21 -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 1uQ54q-00047S-Rt for qemu-devel@nongnu.org; Fri, 13 Jun 2025 10:08:17 -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 1uQ54o-0001T7-Qe for qemu-devel@nongnu.org; Fri, 13 Jun 2025 10:08:16 -0400 Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-158-IErH_cxnMOm46BSBeis90Q-1; Fri, 13 Jun 2025 10:08:09 -0400 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-4a4403a6996so36788051cf.0 for ; Fri, 13 Jun 2025 07:08:09 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4a72a52a1ddsm17384111cf.81.2025.06.13.07.08.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jun 2025 07:08:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749823690; 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=hT+PxuMKRJ8Bh39RMhUF6/Cm7/wGAILL/wn1CqdT0Rg=; b=gVkHEBQdr4EP9lf/MLIXosrHU74fM0BLqdSphhK7Sy+bXuJzpUmByPwG2rN8KNaEMNheK5 eyqCUBm8O32+VfuLQiaOKjLEyiEwzjjvJIGB8eLWSiXgVKEekdXPP6S2AhkXFAyuMM3so3 M8+NRIZWxJSv+cNBBUNzm3iXVmkL2C4= X-MC-Unique: IErH_cxnMOm46BSBeis90Q-1 X-Mimecast-MFC-AGG-ID: IErH_cxnMOm46BSBeis90Q_1749823689 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749823689; x=1750428489; 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=hT+PxuMKRJ8Bh39RMhUF6/Cm7/wGAILL/wn1CqdT0Rg=; b=Gm/fMSfn6SMnXoVmHUDB+Oy5un8rMBFWssLGbl/iMRhLsWYjMuDcFsSv6+scjiLyy5 MX3nKIX6ALZ5CSxsv7+UvIZNYXKXGY8NcT2YTRtCnZ2+6Z0nkFAoE9GBbk8tQlfaU3ii CNZR/6BaWkm/+77HoPNO8V7LFnP1dKtjk/xqgqSHs1Xqv/N7ZFlPVFKFgrOmugu3QRgB RZ8iBKOG6/CcjoQdFjmsypm5LcmTsYspPSlHrcZcz5ejMgRMy2uGSfHXSHRMONjiIKRU 2ILWVYfkyNVapeIjPSaH5JwALJ2yB4UMCyVDDF/A3hpwtLIVeOiaJHkHXb+Urytcb4Q4 tENA== X-Gm-Message-State: AOJu0YxNxgvEtXQJjtiyFOtwYL93XZW61s6emn1R8vOpqreqK5pJJLdp HWFcYIQgzClrVy+wWrLuELfDw1S1a33kAeJ+fn5psJLEyzhfoemdeY1ZhtUg/9EnSxhUKwZ+e/t PXYNtUlktZ0u24k59fhsSvykG6cHUA6AlaSI1yRgOmPIDjSklnPAltkYvPd5VngsFI5Svf035E0 +HvC/s8XRTnmd2PzvsdtWeXoZornqVTe+bNuLKTQ== X-Gm-Gg: ASbGncttCKvaE77XqYf3I7ZlBIVYeNULuF+TKnXu/gBFn7xDQs7Iz36D4YA9GrE5+BD 1lsGG40wYFQ7EGKcT0lUnGCxpqX3nBEpLaayhAr/r5rCZwNNkPmj7v5yIWvyJQrhHc0+jX+D2rn kIC8CNxQyXxT9sSWJX1Y1RvfWGJDuHzXiC7nNdajpsPdP8PnID90N/hUBWusczksR4sqfkGdaA4 WKXGDHs6O7Yv688zW0OfEceMEoNbqTiB/ac07XM33soZPQwV9eMworB6R4yRcupA42nrN0j1foo lcdroH2pBsU= X-Received: by 2002:a05:622a:a13:b0:497:6a94:dba0 with SMTP id d75a77b69052e-4a72ff2b054mr49205991cf.25.1749823688826; Fri, 13 Jun 2025 07:08:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGX/OhDRG0j7TAQTY7XwZhcR31JIiFgJNZqzcwSt4AWT8k/Zn/iuzHvytgbPv2QUzibcQHesA== X-Received: by 2002:a05:622a:a13:b0:497:6a94:dba0 with SMTP id d75a77b69052e-4a72ff2b054mr49205591cf.25.1749823688324; Fri, 13 Jun 2025 07:08:08 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Juraj Marcin , Mario Casquero , Fabiano Rosas , "Dr . David Alan Gilbert" Subject: [PATCH v3 03/11] migration/docs: Move docs for postcopy blocktime feature Date: Fri, 13 Jun 2025 10:07:53 -0400 Message-ID: <20250613140801.474264-4-peterx@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250613140801.474264-1-peterx@redhat.com> References: <20250613140801.474264-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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1749823858000116600 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. Reviewed-by: Juraj Marcin Signed-off-by: Peter Xu --- 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 Sun Feb 8 19:30:10 2026 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=1749823869; cv=none; d=zohomail.com; s=zohoarc; b=gAGDApD7rCKocWNxpkZKZL9v7bjswulyNmzgDbh6nro8Qjg8QAAQODUbwaZ42aQBxUaAKZtqFSAvPRvNREjVSfB7fniNc6bOng0+87P1SBx0UOqiPfuwgPlhddY3lB8A2yUUV+ItDUMdSOoavTcS9xggCLiO4zcHd31nUE4IadI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749823869; 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=cDCSHE7UZto1NWz1vjWrhDSXJj9UdV9w/vzQlY4ASS0=; b=AItXiq7TDCrKsYVJf4AV/OJX+igHAtsHtv9R08eJGbDrid77BC1Xl8NX94V6PkcmyWTJhm2E7FzuL/H6/IpUl0P2XvKsWWbkAOXG5l1DoQ1h9atRag4dl4FogU/CjHIdpxQg+0CHf0VYz+HGfDIqi0ytk6K4nmF+Hs+iATsoE+A= 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 1749823869909396.5748606675062; Fri, 13 Jun 2025 07:11:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uQ54v-00048h-4f; Fri, 13 Jun 2025 10:08:21 -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 1uQ54q-00047Q-Nn for qemu-devel@nongnu.org; Fri, 13 Jun 2025 10:08:17 -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 1uQ54o-0001TR-HX for qemu-devel@nongnu.org; Fri, 13 Jun 2025 10:08:16 -0400 Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-65-M6q9PC8ANnybymwiTbCGog-1; Fri, 13 Jun 2025 10:08:10 -0400 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-4a38007c7bdso47311221cf.3 for ; Fri, 13 Jun 2025 07:08:10 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4a72a52a1ddsm17384111cf.81.2025.06.13.07.08.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jun 2025 07:08:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749823692; 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=cDCSHE7UZto1NWz1vjWrhDSXJj9UdV9w/vzQlY4ASS0=; b=c423tSmlhXOS4yi/a+XtAG5Wswb8kjYZt4TPP/ykQ6pNTfMfNZdPEBVZMMYxF97r5KHNl/ Xga2Vt0yUuu+qE9Ga58LZ4/N0i2T+VdGpdpm9ailL+kt+KaC9nVrWVay/2It05Oc0RAU6D 7c8gMKimB0tivjWNOCPJQbimGuXZdhc= X-MC-Unique: M6q9PC8ANnybymwiTbCGog-1 X-Mimecast-MFC-AGG-ID: M6q9PC8ANnybymwiTbCGog_1749823690 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749823690; x=1750428490; 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=cDCSHE7UZto1NWz1vjWrhDSXJj9UdV9w/vzQlY4ASS0=; b=cNFtX2UnBICA+fSmgAnjcdSHz91HHzKRyBgxKIvVYdnOvvaDBcgn5ySkLTb3Rr01/t Yl2Dhtmy5VTCBwSsox8KWReBBiy4EBnVDvdHFMMI8IKxajsV0wgobhtss/AZSPEsq6Kw cvPwyAKvnA2KAn4DDagwS4rCx8fkOernoYXwCFS/64f2LZwLKvNB5IoU/eYqiWrdkHnW 4DMzr7zwqTSp0UggS6RPKKseyXtNnI6SzD7QPjDYWGyJqJGaZhppC9+f4G15ZRB+5Ec6 2j8PkhZ83v+JmIYyQAuTWdd3e2QIDL1+MqfHJIDL34S13QmM4xB5tbPxbMWgcJ6TIFWw RZIA== X-Gm-Message-State: AOJu0YzYc90XPbPDoD/vmRLg8L7cE1uLjAVZFiDpPOPfN2ikTZ8eZWcJ VGfRaTZCRcaz3/iVdQMdtyKC85XK2l+sJDoGBS8PCjURcDkzGS+mhdMMAm7gGZksfHoBTBW+CAt RfPgtDNDLPfiXu7HMe3jQk6b6cKA//2HJcJ16O1Rzc6aELlk8t071ATrSUf9ZEgQ5HeK8zj01Xd DUqGWAHgn0Se/yoQIoxlyFNWHa0Fv1vUeiXmQC/g== X-Gm-Gg: ASbGncsuxbVKFJ9x8Gb6WV9DjbNrtIUF0tAXnEoG9ewwvI82ifLBX9gD8mYlOzmyLBM qn/Kb7IxVDmtno8whrrYXcyxG2SB2fLOMDybIFdB70hJPB2+KkoNBtfyTGKesz1cDoy+c04sc76 rDiXu2sOQ9MFsp6qMhbiz5XJdgo5wKOiUl6Y9IWmoVbYNYNuH62g61HcxFS4MuomBJZtvsaw3RC u0Jusp9gKlsYibhiRvUrd4277uxuBbpvlEeRK36weB1dFrbQvR1YqQloGPZcP/QEBaAqE9PNpYk p/9BfJHXZ8w= X-Received: by 2002:a05:622a:1b15:b0:4a7:2f49:7627 with SMTP id d75a77b69052e-4a72febfd10mr59473061cf.11.1749823689649; Fri, 13 Jun 2025 07:08:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGZRoM6yXHJtrSQqBO1L4FnmXXbP3si63rDmjvV0PuUBFknDWrIcohxTfozmq6qTfOODl4OmQ== X-Received: by 2002:a05:622a:1b15:b0:4a7:2f49:7627 with SMTP id d75a77b69052e-4a72febfd10mr59472521cf.11.1749823689211; Fri, 13 Jun 2025 07:08:09 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Juraj Marcin , Mario Casquero , Fabiano Rosas , "Dr . David Alan Gilbert" Subject: [PATCH v3 04/11] migration/bg-snapshot: Do not check for SKIP in iterator Date: Fri, 13 Jun 2025 10:07:54 -0400 Message-ID: <20250613140801.474264-5-peterx@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250613140801.474264-1-peterx@redhat.com> References: <20250613140801.474264-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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1749823874120116600 Content-Type: text/plain; charset="utf-8" It's not possible to happen in bg-snapshot case. Reviewed-by: Juraj Marcin Signed-off-by: Peter Xu --- migration/migration.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 4098870bce..e33e39ac74 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3887,9 +3887,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 Sun Feb 8 19:30:10 2026 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=1749823727; cv=none; d=zohomail.com; s=zohoarc; b=b4LdX/bWEkrYAOQU1Mpm1n3YQA42pUvJlNOEz20nmYF9w8jbHx8t18LAqM/H5QJaCIWYfxxgQ/KI+7SgeFcBXjlB6fUy/7oPDGVI/tCBYkRIUQMZAh1B7+LClyulevoYAnXEbuoZKoNDSWpvr05PstUY9zIKDu0tSeinMKh71a4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749823727; 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=NKIjGXzbdqec1RdAiV0GytaZxUNeq+dQYEYp0p5xAUA=; b=OmIEy7gk/5P832c2vOezQeEgGERy1/M1npwbBUcZQ3utlMskBi8+7Nzvv4L8/uL+/JxwAi0cNtnJ96uSRNBb8GIbX6BMqoIhFI4RryEj1ZZ5Uo71IOo/dfb4+QP3JJKjoj0eEOdnd55fZo7ZFecqotY36abcKZCzsgeJEHijqgU= 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 1749823727576281.9976269292771; Fri, 13 Jun 2025 07:08:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uQ54r-00047k-NQ; Fri, 13 Jun 2025 10:08: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 1uQ54q-00047I-0F for qemu-devel@nongnu.org; Fri, 13 Jun 2025 10:08:16 -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 1uQ54o-0001Tr-8o for qemu-devel@nongnu.org; Fri, 13 Jun 2025 10:08:15 -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-550-TmeG_qZcPiK6hfwPjBmbzg-1; Fri, 13 Jun 2025 10:08:12 -0400 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-6fb3654112fso35289496d6.3 for ; Fri, 13 Jun 2025 07:08:12 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4a72a52a1ddsm17384111cf.81.2025.06.13.07.08.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jun 2025 07:08:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749823693; 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=NKIjGXzbdqec1RdAiV0GytaZxUNeq+dQYEYp0p5xAUA=; b=bV/8h6+zA4xCZ325aqdZ+GwdHWIApfwjTS6y5V4RsLDpCGBIMZrpsHvUUgt03W572OgDQb Kgrandi1FyLBTkr7vbkOKiJZEs23qAFj8gSfL/V6T1xazZJhuWLKYpTMf9EoaoBovO7nOQ xnJFnrjcnkX8g5Zvrs14Dww0OYFT2PA= X-MC-Unique: TmeG_qZcPiK6hfwPjBmbzg-1 X-Mimecast-MFC-AGG-ID: TmeG_qZcPiK6hfwPjBmbzg_1749823692 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749823691; x=1750428491; 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=NKIjGXzbdqec1RdAiV0GytaZxUNeq+dQYEYp0p5xAUA=; b=WKm+dAt8BGEDTH60IEABjIyJUHnPDcC+zNgYRvDyHLFTM9oi4qJjEMVn9AqwCNsgT5 ZeMVvGfkClSnjBvJirieBypEbooYpMMLYYf0lbvliXU2satW+QtKu8DCYz3pSvxwlXDP P0wveG9Ri7OGU7oSudvbyDBlCIPY0eXbUNIEnZTMLWacVWrkKeOJNiz16l2mbJnbVPiy PSXIUAqBC18Tk0nnYuObTB6/Pb8eUVkIRAwLpl8z4JxlHW1i7UmiH4LwUf7iVSsoL4UL klQC01IXkddMLRxuOrotdIDu8w89BHWczxsyWRFdc3NMUj8TVqUngs5dl6298h6zarT1 D/JA== X-Gm-Message-State: AOJu0Yzy7R2WALja4+XlgfQphrTn7nLb7Jlgf+D0JBogy0uZDeQk/H1V TQGmUAs8RaEmsPY/PX0MeEutZqvp+bs2nWBy2Cx4gQXEvXBSu1EEbCia6bOv/wECCFkPoeq1KoR Y/vH5vnCPWwIT+1SuQ73qE+MrzN68s7FwU4o0HdzDwx2NSpMJYb45DFiyYl4CGKWURR+P81gHeU r5DUnL8bB9o7268LZz2kPC8w3VlwaZOMgW7sIqWQ== X-Gm-Gg: ASbGncuV/tkIh4+ujcrP+fa+QxBAin1FGq4E9g1BrmTfhi+6urMkTimb4XFpee55Ukq 7RI8f6HgiLeTCDCQcXopRrGlAWJxqe5NOK/VrWqR0c3wlaude2Mlk+vhQ13l0yTYataKT+RRVyx DrLWrNd/AHxAB6CbHGF3wJA2674MuZ2DhI7x6opJ0nV6DyR3h9jV5iCn6E9xyMiWMhwTXGaxydH tLYX0lBSYGaL0pFMgwjV5z5i9mJyzbZZc5KFyQ82Ja4+o8eTGqTqLlXuhYa/lX9jEG29s5TTd2b whLHPsqU/oU= X-Received: by 2002:a05:622a:488e:b0:494:b3eb:a4b9 with SMTP id d75a77b69052e-4a72ff36944mr50200681cf.51.1749823691498; Fri, 13 Jun 2025 07:08:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH9XGCpV9hvmABABAKMewX48tIED31Mb9Yg/2vjsWPFVKfsTWtg0OU9Uf4Xhbj3yEtFJTaSPg== X-Received: by 2002:a05:622a:488e:b0:494:b3eb:a4b9 with SMTP id d75a77b69052e-4a72ff36944mr50200051cf.51.1749823690765; Fri, 13 Jun 2025 07:08:10 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Juraj Marcin , Mario Casquero , Fabiano Rosas , "Dr . David Alan Gilbert" Subject: [PATCH v3 05/11] migration: Drop save_live_complete_postcopy hook Date: Fri, 13 Jun 2025 10:07:55 -0400 Message-ID: <20250613140801.474264-6-peterx@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250613140801.474264-1-peterx@redhat.com> References: <20250613140801.474264-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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1749823730580116600 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 Reviewed-by: Juraj Marcin --- 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 bb04a4520d..3e20f8608a 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 Sun Feb 8 19:30:10 2026 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=1749823825; cv=none; d=zohomail.com; s=zohoarc; b=ff6sukfgXz40WrhRdFAEPzlkl925soBWmxdQMgZpn4D92WQC994J8iS4KSkiBKOXniTpJqJbpl5LGbXz3XZZZdJpeFmqoEGc6GXi0iCA0pfkbkniSzv1ZgCQ3hB7vjr+mr3aez+3j7gses3YwTigaNXmVgAt4XbCPEIkyhbNQTE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749823825; 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=FGb3RLqEsP5Ser5SoCct0WTAVrJhRlNVodLholPOw40=; b=Ebl8DBqV5JTb1y3+qHK7g8Dy8uQ0+Hl3KV+Hamcbx0nfJtwCmKaDSliqEDvARFkMFk+tCD8r5UzsLoS8JLIMv8UrQ4+xKgo5CGMJbmvPqkNLAkp8LO3qFjRl2iyuAGZrDUsi1Gt7Fv6J5l04458s8ANpHwujBfcioltdTOKOXGo= 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 1749823825003999.7852666428031; Fri, 13 Jun 2025 07:10:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uQ55d-0004Mw-9X; Fri, 13 Jun 2025 10:09: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 1uQ55c-0004Mn-4O for qemu-devel@nongnu.org; Fri, 13 Jun 2025 10:09:04 -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 1uQ55a-0001dL-6O for qemu-devel@nongnu.org; Fri, 13 Jun 2025 10:09:03 -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-582-hZ8xyk3SMQij7tWrIrV5uQ-1; Fri, 13 Jun 2025 10:08:19 -0400 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-4a6f2dbdf84so33872951cf.0 for ; Fri, 13 Jun 2025 07:08:19 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4a72a52a1ddsm17384111cf.81.2025.06.13.07.08.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jun 2025 07:08:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749823741; 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=FGb3RLqEsP5Ser5SoCct0WTAVrJhRlNVodLholPOw40=; b=eAYoja65AkHtADJB9M10OcjMQWBwaZodVXTVYSG/oau6XOB4L8zLeQZecre8GQilmkIn5+ Gady+gwhE0WPe0B9C+ZsSMTEv9STigqsLfBs9v8tL49zMbxwO6tJ6yTPUeJcrGY6lUk7oB Cfnw87tS4Mkj8XoA46gsdpWEB59bHvc= X-MC-Unique: hZ8xyk3SMQij7tWrIrV5uQ-1 X-Mimecast-MFC-AGG-ID: hZ8xyk3SMQij7tWrIrV5uQ_1749823699 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749823699; x=1750428499; 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=FGb3RLqEsP5Ser5SoCct0WTAVrJhRlNVodLholPOw40=; b=HLeBd+kTT0fRQwQ2DKKL/0KJ2J1RfrCnIp28sNoHnfKd/Zy9vHV+XcIIlfW5usLMG/ 9RvDapUYL/etjdLyi0WAHW1MlSdJoH2dZDHnhFmrfnrf4XZaiME5QtbJ+IqL/trmcgUM J0GLjeoOu4m2Ub/BIbSd6fAX9mtY5MncLSDiCs4miWZd0H+XZEcHkD0UMYhQx11mva+G sXAXihDPTLBoLqm/qink8YtYG/V2RZAfqx+yHilpNhCDJUGKao9HxpvL8RlA7uUcoQzq nPEkloYugJE/c6UwN009BemPq1jSTCcfHb7GhntjwdrEHpG4ripcHS088CxSIY/aMf4w RsNA== X-Gm-Message-State: AOJu0YweMchYywTDo0+ClMNpL36akp+O9WJsG1h9YlsCzgz04chC2NMh vhXHAHfPIQMSHOp3srhGJf3YAw85qrFGQAYQ67Z0lDzl83n9KCAdHe+Z26iIFv3t3okVFijXizb Vp/rXNO+eQ/hNq52vxUqQlQmW+72qEJEEbvN3IEWD1gqtdAy8cn/o69lm3pliuj8I/qO5M/tS75 QRDA//e+ReOMWn1lOoLz36yOMgPFgnQuW3H63Apw== X-Gm-Gg: ASbGnctm8Av3dzWL0d4tHr+I0Rfef+AkVCf9vKHpwRgevCFcFzQB6cHMZwWeLFijYuB PZrsfDPTSiaPspJJhCwWef6Q1dvsIIMG7eV3R9LGhvlal6dNdO624oMP7PpNZjgtquGS/HUhKh6 Xrduj1NYvP0V08hK6w9Kis70VbbTFFGSAkE62zNuMExFvcuO5WroHreiFA1mv2YU/DGV/k4yeEh YU84wUKuoh2FY185859yGPJT/GPhoqUBIjmTKJUJqEr6tddL+LSU5LMETb21cKYksR5l6XHWEiJ YWkwaK03jCA= X-Received: by 2002:a05:622a:192a:b0:4a5:9825:d6fe with SMTP id d75a77b69052e-4a72feeaa74mr47516421cf.26.1749823693684; Fri, 13 Jun 2025 07:08:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHsyUpFJY1Scjjk67ECNgdO3g9GJQECDGhCy9CTkJdCMceRIW2x4nx4cQcUsf1r0IKQkXiZBA== X-Received: by 2002:a05:622a:192a:b0:4a5:9825:d6fe with SMTP id d75a77b69052e-4a72feeaa74mr47515781cf.26.1749823693162; Fri, 13 Jun 2025 07:08:13 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Juraj Marcin , Mario Casquero , Fabiano Rosas , "Dr . David Alan Gilbert" Subject: [PATCH v3 06/11] migration: Rename save_live_complete_precopy to save_complete Date: Fri, 13 Jun 2025 10:07:56 -0400 Message-ID: <20250613140801.474264-7-peterx@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250613140801.474264-1-peterx@redhat.com> References: <20250613140801.474264-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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1749823825636116600 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 Reviewed-by: Juraj Marcin --- 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 3e20f8608a..454e914b56 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 Sun Feb 8 19:30:10 2026 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=1749823728; cv=none; d=zohomail.com; s=zohoarc; b=JFeX+fsMLr7qa9f21WJPlJIZSt8ZeoUc289qURtrUb3Z9MtYBQ0nC1jR+NIP8PMp7OWMEFXJ+DOTg7vZv4FLA0xclN2jdWsafIN8AwSdShtljbiq/itpSq9NqGIX79P8UdnjC5FM7yxQPpP9jgQtX/QPiz9HERPoifzc5Msnk9M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749823728; 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=wNEbeFV94Epe1QBIO3JwY23G4Fsb18RrXYM96D8g5bs=; b=I/4q3EEmbVMz3/1WJsgGUPCcg0DCmDLR0vS+VHi5t6tn1OXmvCv+jm2a9KFRw/61PC+/uWjYHQu9GfeqDZQmty64MNsHovqNx29HvUCJMF+pEJBF+v+uaBO1mgdwEB5uh+NQl94IYy2226xcL+nXwxZC2He6lW6Ufm/V+tMPvZ4= 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 1749823728394833.5902142678397; Fri, 13 Jun 2025 07:08:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uQ54w-00048m-8D; Fri, 13 Jun 2025 10:08: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 1uQ54t-00048Y-J9 for qemu-devel@nongnu.org; Fri, 13 Jun 2025 10:08:19 -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 1uQ54r-0001Ut-Nm for qemu-devel@nongnu.org; Fri, 13 Jun 2025 10:08:19 -0400 Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-375-PBV-rfLLOIGI771rSrS-xQ-1; Fri, 13 Jun 2025 10:08:15 -0400 Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-478f78ff9beso65197831cf.1 for ; Fri, 13 Jun 2025 07:08:15 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4a72a52a1ddsm17384111cf.81.2025.06.13.07.08.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jun 2025 07:08:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749823696; 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=wNEbeFV94Epe1QBIO3JwY23G4Fsb18RrXYM96D8g5bs=; b=Sa3/HdJX7DeGgTl6tE3/DtrB/ulykVu8FERL5F9Vj/ffEts8oz9tTLKryblYdyJfluXPf+ f9n1MEDDfodXWk/kKL4UjoyrreTC54amxbktRvnLBWN7hmLod+ePpIg9sRtoBplCSIGtIm KH/cR3wiFYWbRL/X3nkvcWyAL1u2zBk= X-MC-Unique: PBV-rfLLOIGI771rSrS-xQ-1 X-Mimecast-MFC-AGG-ID: PBV-rfLLOIGI771rSrS-xQ_1749823695 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749823695; x=1750428495; 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=wNEbeFV94Epe1QBIO3JwY23G4Fsb18RrXYM96D8g5bs=; b=gYccYAFayWB1bTRsIcIgzejJz0oHOzxTbKa80O0CksECEuNkgNJo9Khx9WqO1R/0Ty i2D1zbX9x+TeM1Ulf/wzmQ54YGibtqCCRfzYe+fIOGRCNdAzi9VheaVh5tJXv05vkUnT jm+x7YNeml04Mvy1ASPd6tEnFw4hXG4C9FPxMKCuyKaPhWaCvsTS6Msh62Gi0oje2UzS pU3qpn5vo4tksVujbLT0/J6PGzy+XjOijyT6kSwb2W2945ChPQ8fNU3kxwmjCIcqgUhw 0/y+KB5dBd57a9uYWS3yhdMXdAEniIfwE5kHRG4b8pCY6iw4EmVWEaktcfergEMlPMuu ezZw== X-Gm-Message-State: AOJu0YzkhkbhsgfuxoZ3BcjHvhEnrKcQr4A5Fy1RqJGGfTAk1P0NVd81 bAVx7F6TIo32BP60VyT6iwAT3cGu3VnVMQDuuAG5Yw8/2GNqIrXLGhlwmmF+YLlFHyJd1Z2vnGi 1AC53kb4wAvxVCVskfqXLYM0hKaztcXl+4M0dyNa5Mv6E7nTeZ7yuyRw9rRO/FmhOzpGl9DqAim KRDyku2TTSLsxz4I8zi+XUbpIxXNg8mBLMDo5uqQ== X-Gm-Gg: ASbGnct0bezgcujrvdYLy63WT7NkK10KNCFGO5GS/scYujBdqjVAF16lLMicNgUxy72 tjzbycQ+HH78Iv7KFW0GdQtwQZNm8oO0ZsGYK3wcj8HGveQrDgM5HIUik7gFQL+yxnad/H2a4kO 8pSGUi6wTsy42TMEAP2GH7bixFT/9ISRPXiONtG4CZgamHzFQ/J1j1cJmbA0Dv4r9jbSUzH1tsw ixVwOobqL0UrpGc5/v6rGLGrxyYCTi5YfQCpTnnc13fLjNpefNPrna1u/NXK465yo4RzFEfaKaH 2yBIkfcogvg= X-Received: by 2002:a05:622a:4204:b0:4a5:a5fb:d3fa with SMTP id d75a77b69052e-4a72ff9ca02mr58271641cf.47.1749823694712; Fri, 13 Jun 2025 07:08:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHdTXSdWvYGu76Xy4iiERQGxuqGg8I0PqZeNSGkYwY2v5y2oNa2z+HLdxRhzm4hX91aaCZg2g== X-Received: by 2002:a05:622a:4204:b0:4a5:a5fb:d3fa with SMTP id d75a77b69052e-4a72ff9ca02mr58271021cf.47.1749823694188; Fri, 13 Jun 2025 07:08:14 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Juraj Marcin , Mario Casquero , Fabiano Rosas , "Dr . David Alan Gilbert" Subject: [PATCH v3 07/11] migration: qemu_savevm_complete*() helpers Date: Fri, 13 Jun 2025 10:07:57 -0400 Message-ID: <20250613140801.474264-8-peterx@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250613140801.474264-1-peterx@redhat.com> References: <20250613140801.474264-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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1749823732504116600 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 Reviewed-by: Juraj Marcin --- migration/savevm.c | 78 ++++++++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 34 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index 454e914b56..c4fd5f5a5b 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 Sun Feb 8 19:30:10 2026 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=1749823754; cv=none; d=zohomail.com; s=zohoarc; b=nau5vxTGfIReVK4o5rWmd20CB0eVC15lKCdNPk0sVh5pm5AtW70e6nYtf3d4yIzbqri0FgCzdsAoZBP2VlT3zGgLfIvX0fhsN6zrSopb12uHFf+5cYgW4XaRR8H2vfGRuKWVUa4MoLUHdIx2fh66bF4/bOwKqbXQEEA9VK/nEAQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749823754; 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=0gBjc7m16rQwKWYyV/3t//9MlDB/n3QsWgc67i1f8wg=; b=Nxw4j0B6dTzs5PNYVC2ta1+yXrsAn2WTYAyUISVeJ9+UlPgKirHpK8C1jjpM9dVzVk8nATundj/x2AWnvHei1K44n+Sq5qfGXyJ619JSqQ2QTEpSxSDI4/AdwcU5gbCafjK67n6mDR4l6MHE5K39GQLYqDHxmKMMv3Zv2gvkz8E= 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 1749823754314515.7152265178096; Fri, 13 Jun 2025 07:09:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uQ556-0004Ak-IO; Fri, 13 Jun 2025 10:08:34 -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 1uQ54v-00048j-PR for qemu-devel@nongnu.org; Fri, 13 Jun 2025 10:08:21 -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 1uQ54u-0001Ve-Ar for qemu-devel@nongnu.org; Fri, 13 Jun 2025 10:08:21 -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-455-tUZ-Gya1PZO9DxiDMVntPw-1; Fri, 13 Jun 2025 10:08:18 -0400 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-4a582e95cf0so22006571cf.1 for ; Fri, 13 Jun 2025 07:08:18 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4a72a52a1ddsm17384111cf.81.2025.06.13.07.08.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jun 2025 07:08:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749823699; 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=0gBjc7m16rQwKWYyV/3t//9MlDB/n3QsWgc67i1f8wg=; b=ZyizkMP9PIDgmfKsqOkHdg2XQCDoVUrMy+5uyXVoO2Dlu8LqeSP+O8moOEetYoitj21ha9 YoOd5JyBaQ7YlRrYzQbwrYerjEzMY32av6FURDfx1pviYRiCQtf2Z7hLEvA7gbyn7zkoqB lnF11RjniFoLUAbsrreIRyDapO75/pM= X-MC-Unique: tUZ-Gya1PZO9DxiDMVntPw-1 X-Mimecast-MFC-AGG-ID: tUZ-Gya1PZO9DxiDMVntPw_1749823698 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749823697; x=1750428497; 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=0gBjc7m16rQwKWYyV/3t//9MlDB/n3QsWgc67i1f8wg=; b=vntyZgLANSRrVy0wvllnQ0e+cGrk5LJPI+1lmgi2hkD6b5jDte1J6foKyiuZuu0io+ yMCkD1/4cDGSqm/WeU9dBtkbcaxdNLg5oBge209Q40IsVrWXjMQQxBoIXkv9v7SA2CDJ bJW1fP4Urya8YkmAS+QLMWLKyNSJ5um4LEor76YLsiYuuo1vxDgXZDIuZXP1+nXeEHIe p7mRHNmvQxUev6mL/yPYdlpworGIbqQVBFeFMv0wwS7Rq7QloeE4t3njh0EczyFl9scv gCHZiQRpQciRYjmCG0ipl5djsQ6CooIj2LOLmWYYB6J6NA7Lj+ie+1Im0XSpl9baB2Ge if5A== X-Gm-Message-State: AOJu0YxpulTHF1AO/UiD9lpv9wydf4kzsVRKETPo1RWYDPTW5avkDh8n rDc8Jzk4LKLfUPeuYS8XQBeZec2oqnZORThk7CfHl0oXV8LIrWnsfq9yrSooOEV9I4BzsucYW+D CszKkDLLQxLdZLUbXjMMQ+lkto2NMbrfTw/FCGV63YFPd2B7jQeCJ1Wj4r3WPirCp3CRi8R+CFY LbDLOyQAEImhmpbohDhlydNDihlFO3lXFWO7bXAQ== X-Gm-Gg: ASbGncuRDjrlfs+YLVyLZVyzMFa2jHco6n1LwK7ba9zCDDWjMoW1fWRYQQP/dyYtq2p OGFJVFSgqirHqgye4S+WUKO08iP9TGWgeg2MuFTbpFaWMLoT85tKPPe7oOFg9SBr81ZCJTShlkQ QqP5jh0l6hfJ8wOMiE7jrHGC2Ex/wBf3VKT9l7ULe8NOSkS+q36giViAZT3sfCdHmk46/4vsnuw QG2mEHM451tDRjhAYNr13+r9+NduSSTAN0qAH4EGYfXS+BFlZuywM17hNLORagZ2DJKFoyixFCj Dyzec/CJO6A= X-Received: by 2002:a05:622a:1cc3:b0:4a5:afa8:b3f with SMTP id d75a77b69052e-4a72fe63213mr63321961cf.3.1749823697318; Fri, 13 Jun 2025 07:08:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHMze8gQLP+ETf96zPRed/03GEJ0mRcGiPcVxsEkwkhx6e2YJbc4H9YcCqHAvGgTST73iKQ8w== X-Received: by 2002:a05:622a:1cc3:b0:4a5:afa8:b3f with SMTP id d75a77b69052e-4a72fe63213mr63320001cf.3.1749823695771; Fri, 13 Jun 2025 07:08:15 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Juraj Marcin , Mario Casquero , Fabiano Rosas , "Dr . David Alan Gilbert" Subject: [PATCH v3 08/11] migration/ram: One less indent for ram_find_and_save_block() Date: Fri, 13 Jun 2025 10:07:58 -0400 Message-ID: <20250613140801.474264-9-peterx@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250613140801.474264-1-peterx@redhat.com> References: <20250613140801.474264-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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1749823756664116600 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. Reviewed-by: Juraj Marcin Signed-off-by: Peter Xu --- 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 Sun Feb 8 19:30:10 2026 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=1749823813; cv=none; d=zohomail.com; s=zohoarc; b=PYKZ3davFPiysSlecNht+8+ilVOZSXEZqBmLvmpfEtQIUJleq9Oaa4k9Zn7RVZ6jnm1ieB95pKXSu/IBgPxOLsNcJrQfS4wrF3SnmhaRVGwYyoNc5BObs4A26P9fRK+zOyun6tg3nLdnRhZRWL0yJbhRN4KacK95lEErwzqnx0k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749823813; 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=1A0fDBuQYTqmVarAzgYqBRrK/hWUHvpepmptSmGtWkw=; b=SHv6+fDXdK4fCC/5NzVzEqR8MQzXtbRQ2Awdu91OY4GcfM+kcClWnJXRtGkYReBn7Eo1+7vNbqZ8wNFuhbDBOvR3lI2ASnJODgw9oPEpCLPWvI9u1f5dRCi3AYeroHGXD/HjIL09IQlrVvUKfmLHL4tjmOZNzDJEgvhRTJvWTkQ= 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 1749823813195436.839669631005; Fri, 13 Jun 2025 07:10:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uQ550-0004AH-QH; Fri, 13 Jun 2025 10:08:26 -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 1uQ54x-00049N-1L for qemu-devel@nongnu.org; Fri, 13 Jun 2025 10:08:23 -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 1uQ54v-0001Vt-1k for qemu-devel@nongnu.org; Fri, 13 Jun 2025 10:08:22 -0400 Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-523-_UjnyBUVPaaDRDq9T9RXYw-1; Fri, 13 Jun 2025 10:08:19 -0400 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-4a42d650185so28999161cf.0 for ; Fri, 13 Jun 2025 07:08:19 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4a72a52a1ddsm17384111cf.81.2025.06.13.07.08.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jun 2025 07:08:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749823700; 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=1A0fDBuQYTqmVarAzgYqBRrK/hWUHvpepmptSmGtWkw=; b=gbrLMuWJfsb8bTJoIoO4mZNN6kjW/E5kNophYcsedkcm3VZmU1Srqx4gy5Nv4Cetp0DNvW iBhXCJw/69XVmhvQ3PMhYgihD/fstD4GRhUncqqKXbVRBU3DBGW9yyZXnySuu4kF+rO7rF 799CE9t2zXllwatpOXj9B9kjO3bRt38= X-MC-Unique: _UjnyBUVPaaDRDq9T9RXYw-1 X-Mimecast-MFC-AGG-ID: _UjnyBUVPaaDRDq9T9RXYw_1749823699 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749823698; x=1750428498; 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=1A0fDBuQYTqmVarAzgYqBRrK/hWUHvpepmptSmGtWkw=; b=DB+zANkXKOYI2RpgaXKBGa2dxmvZLF2/R0mUD6LZRHCCTmGTpjbzl6PbZAdGDO/ldX yx8QUCBecz+EdlD+zX4SO+jdJ2oUyPJ0xXLhcuJmxWAUvxpztou2cizGtVvjeA8NW8lE cg9KgNr5MyhQ6hgOYzMVIpLp90/C7aWZSqSVJSnKEW1M6qwwjQi6qQkVoVj6CHnPJ0Mj RPfHhlsH+ADLnEzank48/pknMQL9xFAuvrY2F/CrtYKUHo/W4iaVJvUNepur2e2zx/KS +eJtTvMvmUkBWdIgUj/X6geDFAhyqF6V0ms63alU52Ukbozhl5RgrTwz/4CRpvqUBgb9 411w== X-Gm-Message-State: AOJu0YzhdM/Zqe0EOmPD8669Y8NkGqKt96ginO8jqWggZQAI3lQZCdy1 SHPJLcpiOMAFH+aL9rDMF14FiU3MGPcm1MXN1PJ/Z5HskvOT6R7rMcOXVPHqiEkadb08RyZxGyz Pk1YtGmAXjjAYYUH/kd8TAN90un9wPWYEWTA6iK/KL/qybT+Ny02e29xhpSwbjpF/KTMVZGRoGe /nqCfonJExUsO8DiBVgaa/OnaMQv6t8cixwkoshA== X-Gm-Gg: ASbGnctC3lkFz3gWJBXK5b6/klnjA4qckj9gK95HnL1KByv3y+Vka6NPnktpEKI5KgK KmohRF8kyJkD27Ps1+iEhHSj1meIeGvMsYAdQTyWrZMa9+yMWHrczPz+Koz0iQBvGUL5dWol34V 7sKxbL/lnAM4dmaNadz8esNPTVEOA8Kv7bkAzWt6FFLbFCt6bpMW1K8AGc6OV3G7GUysybEw4XQ IhKJPM748+sNv9vbn2bHw03AF59aw1xwcAtRolVKEE1nc9jyL4S3dIHQ+KrJUTBawlXL61YArMP AyxSVqefWmI= X-Received: by 2002:a05:622a:1e98:b0:4a4:3171:b942 with SMTP id d75a77b69052e-4a72ff1c1d8mr57239741cf.39.1749823697874; Fri, 13 Jun 2025 07:08:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFcUg2sla6Pi8BTIx7AxNjTdd5kTcrQwyuGwGYaSh2EgvGfy9zw1ofuiuNp1y3rP3Mx9kSsHA== X-Received: by 2002:a05:622a:1e98:b0:4a4:3171:b942 with SMTP id d75a77b69052e-4a72ff1c1d8mr57239221cf.39.1749823697382; Fri, 13 Jun 2025 07:08:17 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Juraj Marcin , Mario Casquero , Fabiano Rosas , "Dr . David Alan Gilbert" Subject: [PATCH v3 09/11] migration/ram: Add tracepoints for ram_save_complete() Date: Fri, 13 Jun 2025 10:07:59 -0400 Message-ID: <20250613140801.474264-10-peterx@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250613140801.474264-1-peterx@redhat.com> References: <20250613140801.474264-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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1749823815533116600 Content-Type: text/plain; charset="utf-8" Take notes on start/end state of dirty pages for the whole system. Reviewed-by: Juraj Marcin Signed-off-by: Peter Xu --- 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 Sun Feb 8 19:30:10 2026 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=1749823792; cv=none; d=zohomail.com; s=zohoarc; b=MVEv6j1BMeGr5yZTp0P159pu0biQ0XEONd5SWHzJb+Rz+7+PQV7msr3m6pkZ3GfeNEoFrh5BMCYLb6b6MnViH1qwaotjzhmnBVEvLmRJeEVY1zwEABP5cpevBfRVSxD8R4d6Qve6+9Lr/m4z+m6M4EcYJ80WyDNpAClRcImUCsY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749823792; 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=KkSoF5C170XPQpMmHRJlTyOwKvMj5P74B1dZkPVw5Dg=; b=IJgdH3gINX4LNGcgeIw0xLlxq1EEOIbTwYBUw90vb/SDuDJBu3yjLC9cSIGj+vBKu+7grLmGV3K1zRXdTTXFeFL+L2u3MLCROpbhfjRiWd2B6WsjKxDU/pjONbNPoJ6vZ7Rhvn3IldQiI9h+IN16sXUFQ/t4vOkJCJjboIc5LPU= 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 1749823792381149.56827398983648; Fri, 13 Jun 2025 07:09:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uQ55C-0004BL-Ma; Fri, 13 Jun 2025 10:08:40 -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 1uQ54z-0004A7-55 for qemu-devel@nongnu.org; Fri, 13 Jun 2025 10:08:25 -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 1uQ54w-0001WM-HV for qemu-devel@nongnu.org; Fri, 13 Jun 2025 10:08:24 -0400 Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-632-p0qelc32OMO9gQWEd26xmQ-1; Fri, 13 Jun 2025 10:08:20 -0400 Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-4a42d650185so28999441cf.0 for ; Fri, 13 Jun 2025 07:08:20 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4a72a52a1ddsm17384111cf.81.2025.06.13.07.08.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jun 2025 07:08:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749823701; 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=KkSoF5C170XPQpMmHRJlTyOwKvMj5P74B1dZkPVw5Dg=; b=Z4nK8QUJsp6bwB/kzZmoMgs5VGjuiwel26hQZ3854UD5W9msPT567nFitu0sxQXWaRKNhh 1Kyc6T/7MpheXB4DukkjOXxuo0xdOgxp4EuzVQ81ooDK05lLdcvIzT/lJfJzymWdxyafkd Auyjz2A3bB0UK6lRxCjsDA8h7kMuDSY= X-MC-Unique: p0qelc32OMO9gQWEd26xmQ-1 X-Mimecast-MFC-AGG-ID: p0qelc32OMO9gQWEd26xmQ_1749823700 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749823699; x=1750428499; 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=KkSoF5C170XPQpMmHRJlTyOwKvMj5P74B1dZkPVw5Dg=; b=XVXOi1nn6WLgNOX9Q3BN+qtyBi+63E6ZzyogHKx7lMuT+WTYQQ/tDJcfl8UFWiiEXe N/pOxV0Ri3Y4yg+C1D3/BzyhWz2ZIA3Cncy91rd3q4Ouva9DUuDVhBJnzSEb8ku8lePm RgpokAsrSqaw4Ny42ORQMldNEp/YgG0f7bHY6xCqn64UAL1o6/X+juT6qLwFv+fRZhB5 QNQx+3r6HOh1V9EEKPpThe7Vl6SxQHPGQLXnwi8Eof8k8R6knYOBBraSBvBT77gQ+RCS rXZdp34BIYIKtY1iPXzbkunBZ50eNZZim8zgbMzYHXrveh/w/s5R+Z6aXePAL+pPlfbx h2wQ== X-Gm-Message-State: AOJu0YwgJLFkuDHnHacVlXneTlcN1MeXm1QtBaXiwEoPRb/u7oqYG8tc oJx27VRVReYIuKzXPKLaf1skxpTrUnXX+u7KgBN7ZxSgLuUyHR7WduzPmwxLXlmGOkWyX4rvJ3i gbRGvRitMJ9S6coLTyfUtaeS+7aj85j3abt5lyV6nnvSyOZFAmGh1UubU35Vo+eg//zuvXLK7zx HibZBd77IL2VrK/Dw88F5sDHgQK5iVDU8O2lBajg== X-Gm-Gg: ASbGncs1LZHKKm9EN/hugLrjgbvwTfeZVHSGDp0MHZIXIDUbQ5NXdbCkKR/N+i5d9qT t/eY30V+gWYjBEznT3ATYfThBav9U0RT11Yo0KJT1BbuO44YpQobsyI351R7KB/sJ3k0zK8nxkt Mwv4fiCIwwzIg/yHQxF5cmStmDIrNeFmuoXal6yvlSAgorEk2XZ6ybgXUpbIZAmH0lz8PCx2myg XD0qg2ue1qY3R4pth2BBKG//IMaZSNuXIjB/fv3OAHmKfg4fnFFdRLuy5Y0u5jy9/SbPqX5fZoe qmFA38HXESY= X-Received: by 2002:a05:622a:4d09:b0:4a6:f878:346a with SMTP id d75a77b69052e-4a72fe63272mr57516471cf.11.1749823699241; Fri, 13 Jun 2025 07:08:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFLDbW8JkrD8JwXPtBwnfp1jMLy/QEUEXPXfG9mSacrRephz6JoPL7cxmOR0AAQxMUQMt0rWQ== X-Received: by 2002:a05:622a:4d09:b0:4a6:f878:346a with SMTP id d75a77b69052e-4a72fe63272mr57515791cf.11.1749823698620; Fri, 13 Jun 2025 07:08:18 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Juraj Marcin , Mario Casquero , Fabiano Rosas , "Dr . David Alan Gilbert" Subject: [PATCH v3 10/11] migration: Rewrite the migration complete detect logic Date: Fri, 13 Jun 2025 10:08:00 -0400 Message-ID: <20250613140801.474264-11-peterx@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250613140801.474264-1-peterx@redhat.com> References: <20250613140801.474264-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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1749823793316116600 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)" Reviewed-by: Juraj Marcin Signed-off-by: Peter Xu --- migration/migration.c | 57 +++++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index e33e39ac74..923400f801 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3436,33 +3436,60 @@ 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_postcopy); + } + + /* 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 Sun Feb 8 19:30:10 2026 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=1749823781; cv=none; d=zohomail.com; s=zohoarc; b=NuCZadG+bfrZTknO6qZes9pTsigC1ixb4zvuXS+Ew1daJnJZzrVFuUhgjA8XPCeAxotKz05Y5Prtf5Z43EGSVUK47oq6hWZCcp78ZVbUGy8yLn1TUzDDqO0i5s92MCUKsn696oR/VlRl7Dl8IEg7nAUgNlYuXCSsR7/lpUcJRAs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749823781; 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=81vpRbPBsl4TxnkuqSVUCogqP7kEXR/iTLHp+dsYNmM=; b=a461k9LgIvV0JXoxYoAhGmaZKuxNwR891grR3axw/koBrzk4g5v1dEUvswdfGqaUoIf97AWzLSQSytyM3Fy9tHtKyeuDpjiFKmc4SNBfxpyvDp2YeyuMxCgBlxv5rArXsq+Y131sWDM4PhxrDOROJDGF6ZzscoT18DXdtbGkOuk= 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 1749823781132180.6271073306258; Fri, 13 Jun 2025 07:09:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uQ55G-0004Bz-Ap; Fri, 13 Jun 2025 10:08:42 -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 1uQ550-0004AU-L2 for qemu-devel@nongnu.org; Fri, 13 Jun 2025 10:08:26 -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 1uQ54y-0001We-9v for qemu-devel@nongnu.org; Fri, 13 Jun 2025 10:08:26 -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-605-6WtMKKLbPGmKBks8W2fb0Q-1; Fri, 13 Jun 2025 10:08:21 -0400 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-4a441a769c7so43897141cf.3 for ; Fri, 13 Jun 2025 07:08:21 -0700 (PDT) Received: from x1.com ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4a72a52a1ddsm17384111cf.81.2025.06.13.07.08.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jun 2025 07:08:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749823703; 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=81vpRbPBsl4TxnkuqSVUCogqP7kEXR/iTLHp+dsYNmM=; b=EnoM5/vCssczljZdFGDxQBoE62Etyd6BM23Img2ZV3ClhsV3gKofpJi2CZ3B8QCnqEvvSR PeMr3n7ARy+q6cVG/ITJQfqjmY/hzTr2j+r8/TKntOtEacMzXk10Jqcok0/3uElkR/RVDb b1Dnqw2RUIG/cdm+IIZZYdZLcq2w4Ao= X-MC-Unique: 6WtMKKLbPGmKBks8W2fb0Q-1 X-Mimecast-MFC-AGG-ID: 6WtMKKLbPGmKBks8W2fb0Q_1749823701 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749823700; x=1750428500; 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=81vpRbPBsl4TxnkuqSVUCogqP7kEXR/iTLHp+dsYNmM=; b=tDtcOYrcHJQqmPEVjhzETp5Ixnc//0zyKq/kHokvkugqFJKUXhTrkCKsSDuVP755eH 62CQt4cFWFGIbAMbtSjQi3fASIRWBdo+kbKtsJYlloGDeRxGavzITzG1+P5dxyjnEzQI 6Hl1V5S09HriDYBoy5CHmUCS1lbavF1lUIGvBk/CmNSDj1AU7GsAA3VtEevDwSWkaEm8 vdZOJPrRw/AJ3Am9dSsgAm37JpsW0Y4iT1HNOovMOot7IdgpL1JihYMsNv9dWCqVjDXB ZwOpvjL+Vfoq569tq952p8RTq6D+C13bi7rLshGf1P3DZeoA9+LMrMdTeOgHWicWiHBx mfhg== X-Gm-Message-State: AOJu0YxjFeZSO91v9q/NOYQNbLPKU65vUk7CDCgMMqIO5vJO3MYc3ZJR EO2r5lCUH9OLdjbIXTjApTDtKCHrSBm1+Nch5AyUwPGxNVzrc5wfv5yBHQyVUiavjfHlovnyg+i 570RuGTjo+8e2HO7Iyh7XZWVxSwrvc3bRKywGqeEeZU5XiT3sGhbJxAsBVdVH2yYZVnrVHMKESv O/JkYc21BOXkVRPIDIe/XH1zwQqyf6gO42A2xMNw== X-Gm-Gg: ASbGncve3CzkdqMrD8scgqko64VlMi5fYaytKfctIoNe++NmgWyluT47NJdffSYyrCz FM9Qpir2WFke3hYytJT6GZjiRL2t5PAyZ30LczTTLCRE7kcjQ4tLIcmbaAS8HX3dUBH48FVmZzF cIbF8zJJ+S2JbfLX9vx8EW++ov/BT2faOJJ2Ox0C4Jy++nS4gMQeQDA7X8sIsbIiu4qdkcMU/WB xd9HrXfXu7urDVnwvnxHDVmygCkHYvAVPTQxxP0rUIn41kdO2GEhVusBA9X3e/XW1pWYLxxV8hu FX2dG8tJbCI= X-Received: by 2002:a05:622a:4c11:b0:4a7:1446:4001 with SMTP id d75a77b69052e-4a72feedb8amr45183241cf.24.1749823700205; Fri, 13 Jun 2025 07:08:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH4HLYN8v/5xHROP0ltWtOSfOaLhMxOQTTFEabBLoz+E7A0nmQNWAdq2pu08ZOh2UwF7CiZrg== X-Received: by 2002:a05:622a:4c11:b0:4a7:1446:4001 with SMTP id d75a77b69052e-4a72feedb8amr45182871cf.24.1749823699735; Fri, 13 Jun 2025 07:08:19 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Juraj Marcin , Mario Casquero , Fabiano Rosas , "Dr . David Alan Gilbert" , Yanfei Xu Subject: [PATCH v3 11/11] migration/postcopy: Avoid clearing dirty bitmap for postcopy too Date: Fri, 13 Jun 2025 10:08:01 -0400 Message-ID: <20250613140801.474264-12-peterx@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250613140801.474264-1-peterx@redhat.com> References: <20250613140801.474264-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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1749823783700116600 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 Reviewed-by: Fabiano Rosas Signed-off-by: Peter Xu --- 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