From nobody Sun Feb 8 20:28:47 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=1769540002; cv=none; d=zohomail.com; s=zohoarc; b=jMURAqKKXK+QO8WOircQqoAttbWdZ+pxRo636x0g7TwSWATNtPMnUUm63yokNOGbuEincwNpauNWQlqqPT1Cn+XBOJMbYpgy9EI9Hk3U3QX2twyMouwJHrL2TYmbNK0GkdBhsxwBtEDpOtVu9uVKUwhPUD1RlpzYR5lU39FgrdY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769540002; 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=z915HfiCgLhqURJikNpU2uE24hBu9+Px9ozkKqRlxGE=; b=j3ODyi2j2FlYMsm1dr8NEIICZyAlkdLy6IVoxstdMl82+7kISoLvjOEIkk0w9T90mQSXcnMXFCcz41M1XQmsPm6Mhq04skrBMbiyafPIztYMOt7Ft8A80/nF5942GYbKadERnMh/tKOOUPsnqJZc0QEPAa79JydEaEHKsaazE5o= 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 1769540002027826.5387906311063; Tue, 27 Jan 2026 10:53:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkoBY-0002sW-2X; Tue, 27 Jan 2026 13:53:08 -0500 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 1vkoBT-0002nJ-MP for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:04 -0500 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 1vkoBR-0000fQ-I0 for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:03 -0500 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-636-EPgAUSjaPH6JQiQrOUXGWg-1; Tue, 27 Jan 2026 13:52:59 -0500 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-890587d4e87so226809686d6.0 for ; Tue, 27 Jan 2026 10:52:59 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-894d3740e54sm2338466d6.35.2026.01.27.10.52.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 10:52:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769539980; 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=z915HfiCgLhqURJikNpU2uE24hBu9+Px9ozkKqRlxGE=; b=CkerWnj1HLFPpkkeka+NvyxP9bF1rKaRVkZY9A4zU1bRbpWx+RLp3ptZ1CvOB8otCp3h9e z4dcjYCPxTsmdbk4UGd1oyoEDZO3RkaLpTJuij+c1eV5TaiyvLIDVspHgZN4fHKHJ9MaBc 1Q3AgnAuny0VCfXmtUv14qu7CfK3fTI= X-MC-Unique: EPgAUSjaPH6JQiQrOUXGWg-1 X-Mimecast-MFC-AGG-ID: EPgAUSjaPH6JQiQrOUXGWg_1769539978 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769539978; x=1770144778; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=z915HfiCgLhqURJikNpU2uE24hBu9+Px9ozkKqRlxGE=; b=P6Xpv6pST5lDuY1dTxa0jHncK22/XAcnIlF9u9zcuG/DvkjGhXcO0LCQ4lJjDTfg3E SsyukO2UIh7eGdOBVR4whoFUA3tq1+okOEEuOfTHVV8He2v18rzDTPpkWoj6NyevaiN7 Bq0d0W751vkZQWqtLD3n+04hTkGJKFWfQb2cGyCN6iP25TXARPpAB20Psa73f22Ia2/N urCtXzy5JwiNpj+Vtx4w7mnyNhqk0G6aNtJjZaenCIw0G11L/hx66H/ZaWr4l47p+uN7 d92OLoyBly+lhIVHQdR9MAY8vB+mY5yC7aMEUTK+P361Z9cY3oXIG8YdhqTzDQinJT2M j0Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769539978; x=1770144778; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=z915HfiCgLhqURJikNpU2uE24hBu9+Px9ozkKqRlxGE=; b=GpNEE4spEzbI9JVhoY64CMe51OnUAtVA0Nhn52an+zKMf3q5UyWJDzlD8FxBu/tj2H wg6sH8yBfB2zuxvBRg8c4Az8rY0VzPt4WdYLq68pwDE11v161Mb3kFtjWy22yGYtnSdD RRDcLU7/ttNnf/4KzimXFdauA6sX+PuKCiGsgdFgM5DcgglrrCU0pLv7NGbFhUh8Vt3b k9M7F+bpUhiOTQWuqcfmLiyYBWt6MBPHAeLjRnFSyFNxK9DQaT9AykeQrrOmmPaHQweB fEwhgO9F082DTRhfgRLyFYhKi1I3gze7SJ4BOFo7VtLwEn1Ni44NQqXnnZAMw9JDQw2R XQLA== X-Gm-Message-State: AOJu0Yzz+Q1Sdyhirprs/FcQb7tAJbKNEhr+TvYUYXY7oPWVy8/JcN+K R9Jm8NzlJfvfuYJpgTb7BiFFcRAyDwK+uWO8Nkuqs1+DHakrDw0zW+hbIkwNib+GBFlCYZG9wPZ 0gPzZ0uzwNCep6x9QpiGJsqjgKhQSY5xJ+AqYWUOtDGom1WU4uvO2NhOfifNwGln0JYcvf+9scw sJIR3WSFrtDGFQ11Plushe4RuYy2oHqJZBEf3Mvg== X-Gm-Gg: AZuq6aI+qBKN0Kk1uj6gQNJOxBA2Zqcd6OUgcX4f/hEUD6PLH1JzprYbblBl8VqXYWc HYrY9ZDTv+bHMpWbRUTN3EvDuBGnjkQRROyrUdXXZD3ltMpDgH28QfP7wzGXZRu1iqlAIRPyZz9 a8Aor3ub2KOjsVyLsRhER1F4jHtIJ75eCllFqzJ4aGvzFMqFgsYlnrElsZrhk0vBlx2AWlbHZAf DTC2vnR+aPwoogAQ+NiZ3KlDrjkcRhFztmKtEJTfEonvSHYWN9pi8onHSAlU4Xmm25ESu9/1fXg nHfaESjUVwxskD8i4+ZawMfolhXXCAB6TtbkrazBVP8KobFpRauIzCGy7PrSsgDbVQ650GRWYm/ 4 X-Received: by 2002:ad4:5bc8:0:b0:894:662d:dad2 with SMTP id 6a1803df08f44-894cc7b96e2mr37523566d6.11.1769539977857; Tue, 27 Jan 2026 10:52:57 -0800 (PST) X-Received: by 2002:ad4:5bc8:0:b0:894:662d:dad2 with SMTP id 6a1803df08f44-894cc7b96e2mr37523256d6.11.1769539977433; Tue, 27 Jan 2026 10:52:57 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Lukas Straub , Prasad Pandit , Fabiano Rosas , Juraj Marcin Subject: [PATCH v2 01/24] migration: Introduce qemu_savevm_send_* helpers Date: Tue, 27 Jan 2026 13:52:31 -0500 Message-ID: <20260127185254.3954634-2-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260127185254.3954634-1-peterx@redhat.com> References: <20260127185254.3954634-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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development 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: 1769540004309158500 Content-Type: text/plain; charset="utf-8" Split qemu_savevm_state_header() into two parts. This paves way for a reuse elsewhere. Reviewed-by: Fabiano Rosas Signed-off-by: Peter Xu Tested-by: Lukas Straub --- migration/savevm.h | 1 + migration/savevm.c | 58 +++++++++++++++++++++++++++------------------- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/migration/savevm.h b/migration/savevm.h index 125a2507b7..5d815af742 100644 --- a/migration/savevm.h +++ b/migration/savevm.h @@ -37,6 +37,7 @@ int qemu_savevm_state_prepare(Error **errp); int qemu_savevm_state_setup(QEMUFile *f, Error **errp); bool qemu_savevm_state_guest_unplug_pending(void); int qemu_savevm_state_resume_prepare(MigrationState *s); +void qemu_savevm_send_header(QEMUFile *f); void qemu_savevm_state_header(QEMUFile *f); int qemu_savevm_state_iterate(QEMUFile *f, bool postcopy); void qemu_savevm_state_cleanup(void); diff --git a/migration/savevm.c b/migration/savevm.c index 3dc812a7bb..e26656cca3 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1282,38 +1282,48 @@ void qemu_savevm_non_migratable_list(strList **reas= ons) } } =20 -void qemu_savevm_state_header(QEMUFile *f) +void qemu_savevm_send_header(QEMUFile *f) { - MigrationState *s =3D migrate_get_current(); - JSONWriter *vmdesc =3D s->vmdesc; - Error *local_err =3D NULL; - trace_savevm_state_header(); qemu_put_be32(f, QEMU_VM_FILE_MAGIC); qemu_put_be32(f, QEMU_VM_FILE_VERSION); +} =20 - if (s->send_configuration) { - qemu_put_byte(f, QEMU_VM_CONFIGURATION); +static void qemu_savevm_send_configuration(MigrationState *s, QEMUFile *f) +{ + JSONWriter *vmdesc =3D s->vmdesc; + Error *local_err =3D NULL; =20 - if (vmdesc) { - /* - * This starts the main json object and is paired with the - * json_writer_end_object in - * qemu_savevm_state_complete_precopy_non_iterable - */ - json_writer_start_object(vmdesc, NULL); - json_writer_start_object(vmdesc, "configuration"); - } + qemu_put_byte(f, QEMU_VM_CONFIGURATION); =20 - vmstate_save_state(f, &vmstate_configuration, &savevm_state, - vmdesc, &local_err); - if (local_err) { - error_report_err(local_err); - } + if (vmdesc) { + /* + * This starts the main json object and is paired with the + * json_writer_end_object in + * qemu_savevm_state_complete_precopy_non_iterable + */ + json_writer_start_object(vmdesc, NULL); + json_writer_start_object(vmdesc, "configuration"); + } =20 - if (vmdesc) { - json_writer_end_object(vmdesc); - } + vmstate_save_state(f, &vmstate_configuration, &savevm_state, + vmdesc, &local_err); + if (local_err) { + error_report_err(local_err); + } + + if (vmdesc) { + json_writer_end_object(vmdesc); + } +} + +void qemu_savevm_state_header(QEMUFile *f) +{ + MigrationState *s =3D migrate_get_current(); + + qemu_savevm_send_header(f); + if (s->send_configuration) { + qemu_savevm_send_configuration(s, f); } } =20 --=20 2.50.1 From nobody Sun Feb 8 20:28:47 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=1769540079; cv=none; d=zohomail.com; s=zohoarc; b=EK/JaTTSz+u3AfuCQG5K+AZH1YRXMz2VNdyjwkSVqfNYiRStAZlxyo5MFLx/jYCO7u2vj7WKPjyQQUlnpUDpzLe3BgSyX9SdUQp+iNnYUS3qxzRuJd+UEHWVl3BQnu7KbqzG9GLIEpqNIqg9szaHrldHx685XeKoh7ieSJcGBmE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769540079; 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=k9iG6ODV3fpVVvI/5k1Znn+pIB2Q05y7+ne9IRde4a4=; b=C5SjNH/j4z4L0UGQ4fNQxtILKDHb76VeCiAoRhSoMlczUHot2p0ohAnWeoT23EHpPBVUvf+QDLReLO0G590gMbuqJxs0lB2na/xUkiEtzDPQIOjxCdViIzr8YP08EucemtguV5NmUBYMtqIX96SdxfT7dhlZRJ6dV6LRZpTRA6o= 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 1769540079375575.2627395245252; Tue, 27 Jan 2026 10:54:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkoCS-0003hP-5O; Tue, 27 Jan 2026 13:54:09 -0500 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 1vkoBU-0002oB-Q9 for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:05 -0500 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 1vkoBS-0000ff-Pv for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:04 -0500 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-57-EUH2Tg8XN2ukH49Y-oHS2Q-1; Tue, 27 Jan 2026 13:53:00 -0500 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-88a2e9e09e6so281716096d6.2 for ; Tue, 27 Jan 2026 10:53:00 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-894d3740e54sm2338466d6.35.2026.01.27.10.52.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 10:52:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769539982; 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=k9iG6ODV3fpVVvI/5k1Znn+pIB2Q05y7+ne9IRde4a4=; b=V47KiprH6RdbCiRCxGPisq2HDvMIt95Gp8hLO0/oygjU2483KgeiCV8DxYtNRR3gqZN/Tj k5op1jTEeNjMSRY1UZ8YiNvFh13Y+05lIfe2UhcZnLpnZxuGNWA1UBgN//j2FdY/CDxn2Q iRJRY7CglHJLSVTEgCfvwTHIDNK1WXU= X-MC-Unique: EUH2Tg8XN2ukH49Y-oHS2Q-1 X-Mimecast-MFC-AGG-ID: EUH2Tg8XN2ukH49Y-oHS2Q_1769539980 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769539980; x=1770144780; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=k9iG6ODV3fpVVvI/5k1Znn+pIB2Q05y7+ne9IRde4a4=; b=uFPHpqPBmc1pgbGlE2OHcgif9hh3rgM6MER2dshlThkwyScH61CJZP6raxiVqCAKgt 5249NZj5vFSOtESMpJiRmWvOiC1MFx6KWoLa+V0zBBtlVrUHoQ7B9TSXRLotw81/JfE1 vOtg4vfklD2I4zR+ZWsHNaonLejgddHeVXf95+7eEFaVYflZPZZv8Z1qW5rvnmjussCx 2moBgru+YWXzrBirwWjZMUOOcRzakoVd2ofH5vP7ur6+Gvnm8flfhp2z9fiSagu24ZUK oJnVOlBJPFzHWUo6XcbLYN2f0AGmYdHSZhjNj8sljxlSJhjwHWFdqz8WJNXY8hQFDXfZ KqoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769539980; x=1770144780; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=k9iG6ODV3fpVVvI/5k1Znn+pIB2Q05y7+ne9IRde4a4=; b=h7ooeCjej6q5ueZbt6rWOAWuRKLrF2bS1AJ9mYj7JRBNtgU05n8FYg1axn1DI22MNo o8b+N6YiS5ifL6Ae+r1nzkWk+svDH7BLPJ/q0fJm/aqoSfZalAEujBAx3WCLXUWQeZj/ 3kyD4RccJBBExUUmF0XV68vgR+yiFmCnScLibn5O9tQ/lkKTSfQW8ZlvT515REqsCAYV uSv0E9quAZithnLBLGD2mKxyCbr1J0XjYwB8O/lH58ATinWuslvYmtkeDIz4iivay7aO qAKguW35mtrnFNGzmyfFFsyIhAbDbTgyyIXAd7FvhXQS9hVlae8d/WBxBq2CBi+5t6ES 4KKg== X-Gm-Message-State: AOJu0YzvgzY2OBUkihd3aDtrSTOa3sxLA5s09pFJgxmS0r5uN3UAsdBt M40Pe0PwkMerqvWyT81EWDsXHDTgJ2aC1JgzeCTx9FydKGtzLwtexVMJW1V6VdZJkQVi8wAdykk xsweJ42GCNyyRz8Dx4ZT6Qw0Bk6LJ4wqDBgFXBjQAyqyB8+c9oV38v2o9eLll5Sh3/8UAlkhkM+ 5RY3JHQoZV5gi4h+nwleT61XHxgHpnqFOgtihBUg== X-Gm-Gg: AZuq6aJZTbaUK7kX8BbQVQp3e1tYsg+67hKQ3cGUI5Qn+9rgR8NocnC+fnovlb/JnoU k6QTDxIbOh/N4RKCeKPCSlx49B+kZAop9y9zGmGSsresuZsXc4tgETsA88JPPBDcAZnOqZWw4W0 n09pRvm8U1cr+SHZFfGCqd/svuNLzlgd6nZR/7cw5qjCbw+0IDfCF8W4wDTD8iJKUTfVKxD3BzD rKm9+VYtTTSh67R5TpqH9JYeHE72mDTAyhXB8YJEjtRTA3vm4W8Lx7rur9U7C6vzw8UEF7voa7f iFDQ1KiJsjDBhFeRN9ga9EK5BQL7MrQE9eFufXLd4d7lZsYtpEcxkOJJQN0+gtZH2PhBy32/N1X C X-Received: by 2002:a05:6214:20ea:b0:894:6f51:fc2f with SMTP id 6a1803df08f44-894cc8fe2dcmr39806016d6.47.1769539979932; Tue, 27 Jan 2026 10:52:59 -0800 (PST) X-Received: by 2002:a05:6214:20ea:b0:894:6f51:fc2f with SMTP id 6a1803df08f44-894cc8fe2dcmr39805516d6.47.1769539979342; Tue, 27 Jan 2026 10:52:59 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Lukas Straub , Prasad Pandit , Fabiano Rosas , Juraj Marcin Subject: [PATCH v2 02/24] migration: Use qemu_savevm_send_header() in qemu_save_device_state() Date: Tue, 27 Jan 2026 13:52:32 -0500 Message-ID: <20260127185254.3954634-3-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260127185254.3954634-1-peterx@redhat.com> References: <20260127185254.3954634-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_H2=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development 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: 1769540082104154100 Content-Type: text/plain; charset="utf-8" Reduces duplication of the other path where we also send the same header. Reviewed-by: Fabiano Rosas Signed-off-by: Peter Xu Tested-by: Lukas Straub --- migration/savevm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index e26656cca3..64bf445c98 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1872,8 +1872,7 @@ int qemu_save_device_state(QEMUFile *f) SaveStateEntry *se; =20 if (!migration_in_colo_state()) { - qemu_put_be32(f, QEMU_VM_FILE_MAGIC); - qemu_put_be32(f, QEMU_VM_FILE_VERSION); + qemu_savevm_send_header(f); } cpu_synchronize_all_states(); =20 --=20 2.50.1 From nobody Sun Feb 8 20:28:47 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=1769540038; cv=none; d=zohomail.com; s=zohoarc; b=NQXx7ItlboXP0wdQIRqZ7jGFZJ3POTsM+cNZjNaIX1lizLxTWXoBt1aUjzBdBmLcpTYNMFZCa9DEqXt6Vv9eD3FILHLDM+hfPd45ZGwUvQA7WT2AZp/Rfz1E6/N3PBSOQsXK3YOxfd9bBu3E4l8Slmmjh2eeCB/y5iCHR+8wruo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769540038; 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=uDn7c5HvZHkPnAmOw0nvWD++OXb12kobFYVEkU88Rag=; b=IShnSpSWf2O1+bHDVnGwO2pZpFYCIvTT0t7hEECZ4CVAtBB9J1yp2bj9n2Faa84QklLPTKEqEOlw6iV2ekz03VAboeSgtxfB3JhRASll7rzDYypXWJqRX3Ta/V4pJoQRhHq4iwXjCp2xs+8i2lJbnXJcEmKc0C9Osr1TGRiutRU= 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 1769540038182615.9612333838265; Tue, 27 Jan 2026 10:53:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkoBx-0003Gv-Kb; Tue, 27 Jan 2026 13:53:34 -0500 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 1vkoBV-0002oM-70 for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:05 -0500 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 1vkoBT-0000fo-OM for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:04 -0500 Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-125-jM90Q4SKPJy0lCjVxO2QpQ-1; Tue, 27 Jan 2026 13:53:01 -0500 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-894769f8732so290374746d6.3 for ; Tue, 27 Jan 2026 10:53:01 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-894d3740e54sm2338466d6.35.2026.01.27.10.52.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 10:52:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769539982; 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=uDn7c5HvZHkPnAmOw0nvWD++OXb12kobFYVEkU88Rag=; b=SbWZ2HhtdBd+w/CnGM7uhKgaBwyk2O1UyxplhBNVs3Sj3vQiIEApIVpccVLXAcu7SDaxpK 2Wi5kv7FY44wcLxHXs9fVz0mMfzW0GeG3+4wevWVW8ITkGiwG/UW9afel4BRK423jlNKES pGezKbFNuztnNyzEdpblo527OoIndEc= X-MC-Unique: jM90Q4SKPJy0lCjVxO2QpQ-1 X-Mimecast-MFC-AGG-ID: jM90Q4SKPJy0lCjVxO2QpQ_1769539981 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769539981; x=1770144781; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uDn7c5HvZHkPnAmOw0nvWD++OXb12kobFYVEkU88Rag=; b=n+Gb9r19V8EE4uGdWR3oo9Go4em5lXdIl0h+dNFsz1UXHlhuTaVewhxDSnI+RSVFdQ j7ya+sQFYz0PEe10vNAymi2jwIL51qsJ3+u71clp8subR4c1PjuAxwBhLWIVtifTbMLr 5UZCO2082Je31Swhe/5Rhl+RNMITgj4LTniJtqNMRDhMEFCjxSRtxrhuucbDVUyQ2/Y9 kWDCEWE7sQxjDQcsmKRnFYWiHYCSbK/fd6soLhG2ddp4i8GuNQ8lT9G0bmRKTZdpK1MA +XMtNRGGkpMVk47NQA0+UQAp6zOUQhISG1mnEssSVM1uLBSrBo4bNydDWevMBNsZ9Wx5 Q7ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769539981; x=1770144781; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=uDn7c5HvZHkPnAmOw0nvWD++OXb12kobFYVEkU88Rag=; b=AZ95zO9CFRhWwYsgO/C1LasuXrMaxd/MyHx3E1rBg/shKSiwAhDn2ysJ+p9FLxn5Wj rjCE5oITjfj/RS4v9d1MDYjxhW+eoxomA4iXLT0Ijthw+rXNl0db3qQ9QS8cSS7/nU5q vszINKHCvRnSz+V50rKg9zJHtRXfc+1n+np6Zl4DsHuePi5evHIqxqcMv73zb230XAZJ 0szUkWqYQfzMCirMn1pA03pvT9Js5TOrr6tiaBSitQL5pa4KVKA6uAngPIMeCq7aS5Dh 3HsJqY3B5TdL+ouhklpzEbnuLBxoAg0oqfWi7fYn0pTWJkPGMLAcWdYdQ10N1X8Zds/C CKNQ== X-Gm-Message-State: AOJu0YwKtYdHZroTgHA+WD+DbS9eN+IqHZtmbyl4drflk1mBxFq+Qzl+ qOEvevuVUjaWalpuXvccY/Jg8YkO7gF85X2bwse02ARBmR1oLBBnv/F8idoakHQgRrebV0hpwGp kBfN6dNN9c0xY7qwFzaZfM8MjiyzaMGEoxadnbdu5nPvASf6gGeoxlxLEkWnT9HSxpq0w9wR5nT ji87kiiv1ytIeFvMOo/zXuUG+Wy0u2Y7NXmEoTWQ== X-Gm-Gg: AZuq6aIa7bxeFSIII7wumyl6XPwp/sBOIGhtf7vcA4xc2+T1wPppCw7T+4WJe7umaxz MiuDYMqBZGihMizDdP5nLw8FzjGiGlAFNLACD4yTPhHi7e/oduyK+a+f9k795cZPs2TSicY3kOX aRaGg6rp+uN2KV9Fu8eOrdZlDLukmjrsN42+VX18aCOd2vFLD291x304p2U0RO6FZnH2vNeBQMh GocF5wal6GuBMVPVLdZmVcDz8/5lKFmXfngfjy9YeAbt54Lj/Fy50Y+5iykizpq4PGD4AQcqSOi HJOuBEKYiHy+K2e0fvPjDBQSGinLcLZA0O4/m1o35FsLwnqOdW+zioo/z8wuxLMPqu0ODV9QzxZ x X-Received: by 2002:ad4:5d46:0:b0:87c:152c:7b25 with SMTP id 6a1803df08f44-894cc7b9c61mr43017956d6.13.1769539980764; Tue, 27 Jan 2026 10:53:00 -0800 (PST) X-Received: by 2002:ad4:5d46:0:b0:87c:152c:7b25 with SMTP id 6a1803df08f44-894cc7b9c61mr43017486d6.13.1769539980281; Tue, 27 Jan 2026 10:53:00 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Lukas Straub , Prasad Pandit , Fabiano Rosas , Juraj Marcin Subject: [PATCH v2 03/24] migration: Remove one migration_in_colo_state() occurance Date: Tue, 27 Jan 2026 13:52:33 -0500 Message-ID: <20260127185254.3954634-4-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260127185254.3954634-1-peterx@redhat.com> References: <20260127185254.3954634-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_H2=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development 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: 1769540038351158500 Content-Type: text/plain; charset="utf-8" Move the send header operation directly into Xen's QMP command, as COLO doesn't need it. Reviewed-by: Fabiano Rosas Signed-off-by: Peter Xu Tested-by: Lukas Straub --- migration/savevm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index 64bf445c98..61e873d90c 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1871,9 +1871,6 @@ int qemu_save_device_state(QEMUFile *f) Error *local_err =3D NULL; SaveStateEntry *se; =20 - if (!migration_in_colo_state()) { - qemu_savevm_send_header(f); - } cpu_synchronize_all_states(); =20 QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { @@ -3335,6 +3332,7 @@ void qmp_xen_save_devices_state(const char *filename,= bool has_live, bool live, qio_channel_set_name(QIO_CHANNEL(ioc), "migration-xen-save-state"); f =3D qemu_file_new_output(QIO_CHANNEL(ioc)); object_unref(OBJECT(ioc)); + qemu_savevm_send_header(f); ret =3D qemu_save_device_state(f); if (ret < 0 || qemu_fclose(f) < 0) { error_setg(errp, "saving Xen device state failed"); --=20 2.50.1 From nobody Sun Feb 8 20:28:47 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=1769540054; cv=none; d=zohomail.com; s=zohoarc; b=IJL4BNYoStfspJ9+KA0eil98fSFwI5NbxHOgY+k3Mz96H7zi2b3wbWdKrIXnJmVEPgWNaJ/kE0DwFb56lo/sgQt/kCnS5wwDkKD9znzYpBqn6XBa6Jlfizzlut6I9onzYXnjFrI2WhCEyyKIm9c7dajoPANNj08yufuUpms9H2A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769540054; 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=yzQGZtVwGYdVu30qlQ1Yo9nfbVeeR0WqE9qJFYJ/6e0=; b=NcaEJPsAA5ufEaAh7d3zZqic4U4JiUiNUdzATmfs42I/GQjXSuTc67cF/ins33kIGBiqdon/7rPblxR0gUfkiZfmuoJjaOe7/zD9euHzhUO8W2el6qmo5+ij1+2spMiNWVoccThQF5668veAHIGxXQZtsw+8J9BphZ9cgmq4SWk= 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 1769540054455357.0094868380447; Tue, 27 Jan 2026 10:54:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkoCL-0003Z5-VQ; Tue, 27 Jan 2026 13:53:58 -0500 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 1vkoBW-0002rR-MZ for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:06 -0500 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 1vkoBV-0000gA-7M for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:06 -0500 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-275-jM2dCNtqPT6eveP4VRcawA-1; Tue, 27 Jan 2026 13:53:03 -0500 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-5014ca48a56so270178411cf.1 for ; Tue, 27 Jan 2026 10:53:03 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-894d3740e54sm2338466d6.35.2026.01.27.10.53.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 10:53:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769539984; 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=yzQGZtVwGYdVu30qlQ1Yo9nfbVeeR0WqE9qJFYJ/6e0=; b=E5sDNbJDA+t5PBnTwS401Dp/3aDbHZTleWikHts5Shh6/hr0TKaijNdSWFgiNBlaw7rtpt YmhWA8XI3vBVY7BcRz3emTTeXVL9cVHu9MrBm7AAk2T5D7n6PdL9GBBW32IC+xqYPC3fIq LiHTjIxmC2KwqddCPiJ0EmUSQ7GFStc= X-MC-Unique: jM2dCNtqPT6eveP4VRcawA-1 X-Mimecast-MFC-AGG-ID: jM2dCNtqPT6eveP4VRcawA_1769539983 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769539982; x=1770144782; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yzQGZtVwGYdVu30qlQ1Yo9nfbVeeR0WqE9qJFYJ/6e0=; b=e+6ZOrUAUcs1jMwD9qBNahPulOGP/gppR9t57O7+AGh4HjR0lTjaqWAvtoBBIbqbBg ozqZbn+9BJ5GuzSTfrDk/txxRiPT4iokQA4mQn7WfE3tlQAMn0p6NfwndKHvx72S6xZA AhDB0HS9/2LrCaIgyBVv8irpYQ6jb0dkMDZuQPiZhS4Xb9e+573DghPzEp22Adzf2pB1 ZviLPEBok9VKCwb0lvQJ6+1zNvGyyR7nORwsx6yv7lmJGO0kzXS9sLH9AO74ECqg7eHh MQ0JeNo6wJOkNh9qZ+Tok0rZTI01njfiJW4nrFuHHo2tcQa+hwSYMjvEwJ0RR+HV7Vq2 b37Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769539982; x=1770144782; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=yzQGZtVwGYdVu30qlQ1Yo9nfbVeeR0WqE9qJFYJ/6e0=; b=Pipy59+Pil/+qmgudDgMUcwj7IgOJlhV2HawFENImR3oAmrGVNf4CjKLheFW7vjLfm FG4i+zJyqYvlm+pDlOTC7yDjBV1iEM61uyNWlyBBMFPJSvPSLwshibxobJDwzIi6jvZi lEYWKbFUrjaNluQl89eqGIq/Zyxa3T8w21CaGcPyF3HshU1kHF+i0MbMN24kcj2cbCp3 xDC/wfNmYM2GkvcXC5Z/yc3ZVcfiAzB6kV1wX6h6bURsKJW13WXCHywlWZ6IJTgU2CKa wtNzivzBItPq8PtCANY+DpSRkcfpw1NidH820lROFhZGc6hqr5JmrodOHf0F/JCZuevA w8TQ== X-Gm-Message-State: AOJu0YwNFfdDSrgotLs3rsF5F8xx+ZNaD2qdDbZtHCvU4boRSWSz8R4G VR4kLdSyjA3E5I44+uV8lnN7V+ylgbVZy1ambgrgbYgvrMut9HRxiffPVN7O6Xr8j0r0W4i6EdR mVAthlISQ78ePjhQRRtI13xxdhJ8fs1a6S/lmjyRLU76pPoV42EpPHQA9JbduZc8XJ583muLrWq Ehm4D0IjcPG6aJAWvpPsNvYRUSJN6NDSOnzgixTw== X-Gm-Gg: AZuq6aIIulxq4zj4UeWjsd9nGrKrIhvsR6VPNvhoNV6J/m3RjxevECWkUDJH64PT+Bk 3qw3AdE+LEmRSjnkmGl5kIjuCdoy7jG55R8jyI5DFwfzQH7wKZ/VbN7WZ5DH6pw5Xs5/GGc3ROE jV0e6jdzzcjuZOGbCjPTNYcQfbbvnANX4L7Lfg9bR0ibTLQjRmNoklbb4O1BAlwQZF/flbwi42k 73/HSvi0/V/nOhA7cqDVcMwrq7kH9jWUMRkxrU89WTKHLjlnqxpVxSGUSkSZ/piKaGfrq1HdUPc MSS9mUidcooj2MQNe7XMcInEMXFwsC2k9NfpB96rVG8KS1FdYQy5DMoWvuSQS2KWcm9IL/iD8EB P X-Received: by 2002:ac8:5e11:0:b0:501:19f9:3267 with SMTP id d75a77b69052e-5032f74b085mr36555801cf.6.1769539982408; Tue, 27 Jan 2026 10:53:02 -0800 (PST) X-Received: by 2002:ac8:5e11:0:b0:501:19f9:3267 with SMTP id d75a77b69052e-5032f74b085mr36555351cf.6.1769539981698; Tue, 27 Jan 2026 10:53:01 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Lukas Straub , Prasad Pandit , Fabiano Rosas , Juraj Marcin Subject: [PATCH v2 04/24] migration/savevm: Remove SaveStateEntry.is_ram Date: Tue, 27 Jan 2026 13:52:34 -0500 Message-ID: <20260127185254.3954634-5-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260127185254.3954634-1-peterx@redhat.com> References: <20260127185254.3954634-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_H2=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development 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: 1769540055805154100 Content-Type: text/plain; charset="utf-8" It's neither accurate nor necessary. Use a proper helper to detect if it's an iterable savevm state entry instead. Reviewed-by: Fabiano Rosas Signed-off-by: Peter Xu Tested-by: Lukas Straub --- migration/savevm.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index 61e873d90c..f1cd8c913d 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -249,7 +249,6 @@ typedef struct SaveStateEntry { const VMStateDescription *vmsd; void *opaque; CompatEntry *compat; - int is_ram; } SaveStateEntry; =20 typedef struct SaveState { @@ -816,10 +815,6 @@ int register_savevm_live(const char *idstr, se->ops =3D ops; se->opaque =3D opaque; se->vmsd =3D NULL; - /* if this is a live_savem then set is_ram */ - if (ops->save_setup !=3D NULL) { - se->is_ram =3D 1; - } =20 pstrcat(se->idstr, sizeof(se->idstr), idstr); =20 @@ -1866,6 +1861,12 @@ void qemu_savevm_live_state(QEMUFile *f) qemu_put_byte(f, QEMU_VM_EOF); } =20 +/* Is a save state entry iterable (e.g. RAM)? */ +static bool qemu_savevm_se_iterable(SaveStateEntry *se) +{ + return se->ops && se->ops->save_setup; +} + int qemu_save_device_state(QEMUFile *f) { Error *local_err =3D NULL; @@ -1876,7 +1877,7 @@ int qemu_save_device_state(QEMUFile *f) QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { int ret; =20 - if (se->is_ram) { + if (qemu_savevm_se_iterable(se)) { continue; } ret =3D vmstate_save(f, se, NULL, &local_err); @@ -2648,7 +2649,7 @@ qemu_loadvm_section_start_full(QEMUFile *f, uint8_t t= ype, Error **errp) se->load_section_id =3D section_id; =20 /* Validate if it is a device's state */ - if (xen_enabled() && se->is_ram) { + if (xen_enabled() && qemu_savevm_se_iterable(se)) { error_setg(errp, "loadvm: %s RAM loading not allowed on Xen", idst= r); return -EINVAL; } --=20 2.50.1 From nobody Sun Feb 8 20:28:47 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=1769540068; cv=none; d=zohomail.com; s=zohoarc; b=NQB4egzuKN59qN3JmWN9CCHvFXSXImUaV14TAGdIog880viZGqLU9xaPX/G2HXHyNz697nZLLxx8zgdJVw13wtif/XLiS2qa9GddPeXeAfW4f/X4l2DsTyxVAp73SXv3ur5Q0Ztrmxrbonw6AWKnaWdDwceZbx1ZksIzRialxoM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769540068; 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=RcEEeA3IAzUX6E/mkEQIUngWTHTkfCumqYLXJe5PBpQ=; b=fE0ta0n/vb97UB5O8hYpb5C+zaBWXln3dTT6bhf38TxYVCnBs6r4GES6Ytlb0Tr+WoLffdUhExosbb4DTOIzV+3Katro0/s2Vz+7PxM2JU3NoRPkX6PgDGAAC8KzBMfO/FiCakJoFdpvbx8L7J4gyOD+UsChNI1iCBLN7KjB9cg= 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 1769540068148496.110363075318; Tue, 27 Jan 2026 10:54:28 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkoCg-0004aA-VP; Tue, 27 Jan 2026 13:54:19 -0500 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 1vkoBa-0002yn-0l for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:10 -0500 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 1vkoBY-0000hJ-7d for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:09 -0500 Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-317-ZtASXJwWNbOJ07ksYl0RUQ-1; Tue, 27 Jan 2026 13:53:04 -0500 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-894769f8732so290376226d6.3 for ; Tue, 27 Jan 2026 10:53:04 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-894d3740e54sm2338466d6.35.2026.01.27.10.53.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 10:53:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769539987; 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=RcEEeA3IAzUX6E/mkEQIUngWTHTkfCumqYLXJe5PBpQ=; b=gUezxJrmws0CCtoopefbejnsZR0VkGmea7QJlUgEUmiS0q3XJoxzqk4TEjKD0FxgFBM5cy D89XxHQoOGrl5nt/bebooet+FYwLgmW6rwcr2FhVNS7rMfICgdvVLB1/fbXz9T5q4F71Xw Eff9loTVKMWk1CORmux8xXqTbkkrxIk= X-MC-Unique: ZtASXJwWNbOJ07ksYl0RUQ-1 X-Mimecast-MFC-AGG-ID: ZtASXJwWNbOJ07ksYl0RUQ_1769539984 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769539983; x=1770144783; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RcEEeA3IAzUX6E/mkEQIUngWTHTkfCumqYLXJe5PBpQ=; b=g2yjqHldyr6InyZBQyfzceljY8xhoOKrM/BmCkuQfLRSc6eetu4yDtg3GSe8AELMc3 Cf4NznKW5m1aEh2t+txcMZCjsGhDlZtSio//CNZO64gmh6fO+QXImUFRQT8RfNBT8AEb Ml5tT74+OblJhUaPFHN7LaQf6102Gs5gpCDkqFGD6NWPTu80XfT2QZwxjgRhmFNQ2+0n h1dkdvNg/I0HHuOUbXo2C/PMYKr1saLrXvLm6suTdOhX9H+Tk4cZawGL8li8lnSYlWCm wJITgIuz1czuJHyomh97UqTzOGf6mBCn2gY5nBApc5zQajoCxTrZIInKc8SKE1sxhrNo 1ELw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769539983; x=1770144783; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=RcEEeA3IAzUX6E/mkEQIUngWTHTkfCumqYLXJe5PBpQ=; b=dz/EdziWqTuzEPojINFWQEPxltZOgcRf1MvPioPjO2QJMl4Qee1xdiuRnlNO4iiNlr gCPZLvg0+N6SqwH6vsWWZjJd3oSM26Z80CtA/aJ7SbwvtF4Tc2Ea61rsOtJDBlHvfBKj kQsTQzlzOVfbHOeYdff+LlLe1L7WT2ipu83NsjjublRDGGJPxF9apmFAcDaoqHbbotIv cixOCetH4AmrkrhIZEwms7fbHEFF/7zittfQSjpKzw3jD5SQA/QPHJqjiM90DY/lbOsX GIMbXd+09Q3PA+jdOHvxJ17riaMm0Coo4PyhYg8KDQBd8f6WemAebbUWYa2T3dfG8BUZ +9vA== X-Gm-Message-State: AOJu0Yw3lCsn0Q6krwohZJcjTuX7szsvaGWXQdwL00UIaGut8p7kgzez nOsJl19Ze8cfxLPV2ElASn0LvtPYQqChUq/x2I7Ji3K35bQVfZpilKlvIlX0aP87JO3cV/fl8bk nLgtOQKFOBv0KJ9u+8IpXlh1kafcwLBxfR7P7mXlVDwNcepTU3KwBZxG9kgIZjnaWy0DHCHARqH UTKGsjr09/7he/DHUuseuzYMgyO8h8ZGSedUNOEA== X-Gm-Gg: AZuq6aKo2NBq4Wp2fe1WWplLGz1X0OHqlAKisyphzGxbWwA464Po1Cvh1Atgb49z/VV XlPKCIaYAQJg94IcF48Ct0r1bCAlNr+0rEyl7HhujbECPyxZiCeVgYLca6mkjVdqMnFlZ5lNEvo rQCQ5rg37tgupJ8+oUKm905C2BygMb0II+iUBWx0BETQF5Uk+PiiBqgqr+knHmIIVL2TSrEfAuo yjyqmvfYWugdpsRr2flONogqw1v7eWULbY+1h19VkYNrybJBVIWik8n/t8K9vcDIkRNv7RFN6yZ zj3Bsgze0rdLMLB9/JlEaz26bT0vBVkAwKnPk+2+PIMZnq6jIfYOGUf6TuMhpUWx8B3OgvDYE9X v X-Received: by 2002:a05:6214:f2c:b0:894:6e62:ac9b with SMTP id 6a1803df08f44-894cc93d518mr37561496d6.57.1769539983306; Tue, 27 Jan 2026 10:53:03 -0800 (PST) X-Received: by 2002:a05:6214:f2c:b0:894:6e62:ac9b with SMTP id 6a1803df08f44-894cc93d518mr37561116d6.57.1769539982764; Tue, 27 Jan 2026 10:53:02 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Lukas Straub , Prasad Pandit , Fabiano Rosas , Juraj Marcin Subject: [PATCH v2 05/24] migration/colo: Unwrap qemu_savevm_live_state() Date: Tue, 27 Jan 2026 13:52:35 -0500 Message-ID: <20260127185254.3954634-6-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260127185254.3954634-1-peterx@redhat.com> References: <20260127185254.3954634-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_H2=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development 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: 1769540068576158500 Content-Type: text/plain; charset="utf-8" It's only used in COLO path and only contains two calls. Unwrap the function. It paves way for further reduce special COLO paths on sync. Reviewed-by: Fabiano Rosas Signed-off-by: Peter Xu Tested-by: Lukas Straub --- migration/savevm.h | 1 - migration/colo.c | 3 ++- migration/savevm.c | 7 ------- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/migration/savevm.h b/migration/savevm.h index 5d815af742..528607f09e 100644 --- a/migration/savevm.h +++ b/migration/savevm.h @@ -64,7 +64,6 @@ void qemu_savevm_send_postcopy_ram_discard(QEMUFile *f, c= onst char *name, uint64_t *start_list, uint64_t *length_list); void qemu_savevm_send_colo_enable(QEMUFile *f); -void qemu_savevm_live_state(QEMUFile *f); int qemu_save_device_state(QEMUFile *f); =20 int qemu_loadvm_state(QEMUFile *f, Error **errp); diff --git a/migration/colo.c b/migration/colo.c index db783f6fa7..e05736ecf0 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -471,7 +471,8 @@ static int colo_do_checkpoint_transaction(MigrationStat= e *s, * TODO: We may need a timeout mechanism to prevent COLO process * to be blocked here. */ - qemu_savevm_live_state(s->to_dst_file); + qemu_savevm_state_complete_precopy(s->to_dst_file, true); + qemu_put_byte(s->to_dst_file, QEMU_VM_EOF); =20 qemu_fflush(fb); =20 diff --git a/migration/savevm.c b/migration/savevm.c index f1cd8c913d..529cf310e0 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1854,13 +1854,6 @@ cleanup: return ret; } =20 -void qemu_savevm_live_state(QEMUFile *f) -{ - /* save QEMU_VM_SECTION_END section */ - qemu_savevm_state_complete_precopy(f, true); - qemu_put_byte(f, QEMU_VM_EOF); -} - /* Is a save state entry iterable (e.g. RAM)? */ static bool qemu_savevm_se_iterable(SaveStateEntry *se) { --=20 2.50.1 From nobody Sun Feb 8 20:28:47 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=1769540037; cv=none; d=zohomail.com; s=zohoarc; b=FRPNZFwW/vkjChBGBEcIrulYpXBWA4aS1+teZYNcur5v66ZnWW15S8fWv2/LrK6v8yCCCS4i2O4sNH/kKdyMyhVmQLEs1R8ExOEHIbwVTVrx8NFe1ZGebBB0hbr9o3qiw/OSErZC3ECUNLFGmFqkT4z7CGN+dLb0GDuIrxvNpss= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769540037; 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=6LzUki+sPhQhvyEIU1MKBUpR5kFqW6js0HgQEmVSfWo=; b=UaEFxxZ7+6QkNINCRMK3JslQ4g6swuT7zGXp7/lCawwia/+PktQZ926A9jf/PwB0uU+QKu02sWdGmy6sSQzvn5OqLdvJb0zAG6AZBI7wMsN2gZd41Qo7T/Ybv/vi4iBCYRELAn2UHs4tGHiRA9RR0OW05afEPlRs1iqNeEJ1QeQ= 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 1769540037405313.40184952056416; Tue, 27 Jan 2026 10:53:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkoBu-0003BL-G6; Tue, 27 Jan 2026 13:53:31 -0500 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 1vkoBZ-0002x1-7q for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:09 -0500 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 1vkoBX-0000h2-ND for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:08 -0500 Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-479-3Y3GiM9WOoOBkkDd-0_y_Q-1; Tue, 27 Jan 2026 13:53:05 -0500 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-894709fbae5so199286146d6.2 for ; Tue, 27 Jan 2026 10:53:05 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-894d3740e54sm2338466d6.35.2026.01.27.10.53.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 10:53:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769539986; 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=6LzUki+sPhQhvyEIU1MKBUpR5kFqW6js0HgQEmVSfWo=; b=XzTB3HSHXkJs7uOrIO+QacVLaAAkw5khPVB8bBtdInjTALW7WXRsM/0MGriGUB1t7j3Xsj ZZ725J2NJmLUjyhDYJXjKW+RiOXhPp0syK+P4MM93DuA4QunIUWP0uCxzi/hOYhVEUk25W LKk0L3f4uSXwwSVUfZdGhvidco0xIIU= X-MC-Unique: 3Y3GiM9WOoOBkkDd-0_y_Q-1 X-Mimecast-MFC-AGG-ID: 3Y3GiM9WOoOBkkDd-0_y_Q_1769539985 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769539985; x=1770144785; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6LzUki+sPhQhvyEIU1MKBUpR5kFqW6js0HgQEmVSfWo=; b=dYhVuFTfTfXWImUQ2LdHv6o8eCfRxZSKZUmirLspRQZMBERhkEPd9Hti19qITf9KXv YjCvKWXRxncELf+A/2mdMfbqUZTVY5HXU2GocFtDtOg2HvnAAb909O08Pp8lpP3vq/9Z SjG9tNUcQvTlPs3w/n8FwNWCtFfLIXQHq7ooGfgzSM54EvDW7GKdLu3okXQG5i0cA0s8 PLPo8fY4mBjy9+NStEEF1X5IBcp83kAxeYGGyCvj9g9l0IMZOOUQLvT6Rrb7SrxtLITW ywON0JtwpEcX0NEADW5F/vn9GiMpSTY3UEqNjoD+SlkmGUhEnK32ZHryrBUUJkq/8gN7 IZgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769539985; x=1770144785; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=6LzUki+sPhQhvyEIU1MKBUpR5kFqW6js0HgQEmVSfWo=; b=P74R+KhAr2crXFJPE/QWrDK/nN4j++/ubdAOZQVaK/nDda+v7bnerEeQ87o7HWtcA6 7r9p2uHaIqJZ11v1+m8EdzHRTn1+5oKEGPobIEokDvcondFWC23ZlrA5oHCH4jOJi8yy 7cPBM9fSBeO78JWh4cKcxIXewZuvEDOqeN+ytF//q6yzBZ7lBAqa12ML31ZIMz/WoSms C+z3O0RRNwNpv7NIQLzkV1ajBIihEmytnp9WDdn4DmkHhXp7cl41ydLeTT/Lj8+Vgag1 dhp8gEjq85MU5RxwL1AvFrqN2IAdet0rVM2WL7JQezHoTOlb/MBTF9ZuB9H51Ulm++Gv w0tw== X-Gm-Message-State: AOJu0YzAMJYoKXkpYw81c19X7Izyd+V2iC67aFTYmUEVjZkJePSj1i9D 5xSM6rMcCBhqRsD4fkLPWohucT07d3/lsWBC3x8sBzpVwktYAiAtcEWYFvDgZcdwh2cqjzZBAGa kFBwWnzfUhO6sGguYh6/X3N5EdCCgUpCk89gy38F1BZfcllprUVY60d2s80dcee9ImmKRY6PJYL v2hnvnzaKm1JJM1hJ7cYmDx6WeBTK+VaFfhA9ggw== X-Gm-Gg: AZuq6aJ2Av7xDMnVyz1kfaJ/OB/kiVhWiBnTqNEBX+Oe7sMhX/sP+wcj07DVWtaCkcB zAOE1lUxGxyW85NhfzzhqldP6S/PZdwrZYjusG0Pn5Uq3H1mnpZ2YsMRl4kyvz/HA0nKTBOic1m FP7u7Vj4hVJ/ALsg54p7wjrBwpVs2afhGcvhXXSeXwzuKMk9WiZN1nGJYPhbM/VEhhSuLpJvcol SHmBTItuR75X2Po+4hIBqGqCRADpABGqsJG+gaC+JYAbfzYByABXOLfU77yiRyMtSL/YzsVtjHF Jm4669sxHJwfE8sy9BFJkplqEixIrv8/CgoMNfzTwWY2hFYPW+yVF+UHjfksoWhNO803s5wsZL5 7 X-Received: by 2002:a05:6214:c4d:b0:890:58b4:3e7c with SMTP id 6a1803df08f44-894cc8fdc8amr38580266d6.33.1769539984768; Tue, 27 Jan 2026 10:53:04 -0800 (PST) X-Received: by 2002:a05:6214:c4d:b0:890:58b4:3e7c with SMTP id 6a1803df08f44-894cc8fdc8amr38579976d6.33.1769539984232; Tue, 27 Jan 2026 10:53:04 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Lukas Straub , Prasad Pandit , Fabiano Rosas , Juraj Marcin Subject: [PATCH v2 06/24] migration: Remove call to send switchover start event in colo/savevm Date: Tue, 27 Jan 2026 13:52:36 -0500 Message-ID: <20260127185254.3954634-7-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260127185254.3954634-1-peterx@redhat.com> References: <20260127185254.3954634-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_H2=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development 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: 1769540039506154100 Content-Type: text/plain; charset="utf-8" COLO (in case of periodically checkpointing) already have switchover happened before hand. This switchover_start feature never applies to COLO. Savevm for snapshot doesn't have switchover phase and VM is stopped for the whole process. Remove both. Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas Tested-by: Lukas Straub --- migration/colo.c | 2 -- migration/savevm.c | 1 - 2 files changed, 3 deletions(-) diff --git a/migration/colo.c b/migration/colo.c index e05736ecf0..c344943173 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -453,8 +453,6 @@ static int colo_do_checkpoint_transaction(MigrationStat= e *s, goto out; } =20 - qemu_savevm_maybe_send_switchover_start(s->to_dst_file); - /* Note: device state is saved into buffer */ ret =3D qemu_save_device_state(fb); =20 diff --git a/migration/savevm.c b/migration/savevm.c index 529cf310e0..d41be3a4a2 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1830,7 +1830,6 @@ static int qemu_savevm_state(QEMUFile *f, Error **err= p) =20 ret =3D qemu_file_get_error(f); if (ret =3D=3D 0) { - qemu_savevm_maybe_send_switchover_start(f); qemu_savevm_state_complete_precopy(f, false); ret =3D qemu_file_get_error(f); } --=20 2.50.1 From nobody Sun Feb 8 20:28:47 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=1769540024; cv=none; d=zohomail.com; s=zohoarc; b=JNijfg7IhfjqNE1OZNfKBoXXhHySGwP+s49K1TTWnpr+oN58HLpqb+NVFr0r7vvTlcc7qH9kB+bI6XQFoqphjoB34qTYZOKsXgvQvEcaKElQaYSzZvBvkywwWJm6nu5vhvNz41CDRbWZE5j6VR1kohhzERfpUixwcHwuieXm0aA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769540024; 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=GZQB1J2GnKkcSVhSmw1xL9j3DRaUqmRPYIrFKnPzwZI=; b=Bo7Hlnqa/+3wR+pDHq9cGqRbHc8tuOfmynE2ZMEHUU9MdC/ry736lyNuk0+4pIgu4/IptX9TT/W3upzR9nTWihcggfPgJXjiCDDlR7lrnb7RUjic/YdaULDJ9IviL5/z6YuvJXz+128/Fd9GdKqrT+8dI+SabQrRt9bAKNROHkI= 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 1769540024061465.93689249537715; Tue, 27 Jan 2026 10:53:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkoBv-0003Fg-OS; Tue, 27 Jan 2026 13:53:33 -0500 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 1vkoBa-00030A-H8 for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:11 -0500 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 1vkoBY-0000hU-KX for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:10 -0500 Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-209-8rXe7MI-OaCq3vjkVP77lQ-1; Tue, 27 Jan 2026 13:53:06 -0500 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8c52af6855fso755497685a.1 for ; Tue, 27 Jan 2026 10:53:06 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-894d3740e54sm2338466d6.35.2026.01.27.10.53.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 10:53:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769539988; 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=GZQB1J2GnKkcSVhSmw1xL9j3DRaUqmRPYIrFKnPzwZI=; b=hz/vAlWcyXTmd+UBxwE/mG2XXsM9hK/1IOf6l6smw9PMQJRC4g+ciaWz/pQMelY6uh8FNh usKUQQVodkj//TUAX7mLNAlDCKLLS87QO5ytc1g0TKoq0DHOjinePpSjbYunK0Hl544fQ2 kFeDndXeQXqz1aZsGnT7i1IGTiGJBvU= X-MC-Unique: 8rXe7MI-OaCq3vjkVP77lQ-1 X-Mimecast-MFC-AGG-ID: 8rXe7MI-OaCq3vjkVP77lQ_1769539986 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769539986; x=1770144786; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GZQB1J2GnKkcSVhSmw1xL9j3DRaUqmRPYIrFKnPzwZI=; b=ob8vKC0R/Hn1+sSk27Kw6oik6y9+07cU1wMZcTHDk1jZ/vZRrl1TGEmuAuMDFvryfI g2D2lZoWlR0hL2BPIUtK7zO9iI9NBOKA3JLmUtmyXWtWW0QT//lZf8U7ax+1Y7ATTxW7 a97e8sYqiIoVh6kkGnH65i5ahN/fmmhLDdYpGeQQrBRd/N3P1s+g85DaSjUas/ARerBI dAKYf1YmA91fJccag/l4ID8CIzOKT7CJK3QI/vpD3hhgCyxBatdMZu3AD1tjz4h0che4 mto0++nMLS8q/iuzeHXMTkK8dSMot7qSNs0v8D9K2+79VSv6lOE+iDk68uOjBsbc/zeZ b5Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769539986; x=1770144786; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=GZQB1J2GnKkcSVhSmw1xL9j3DRaUqmRPYIrFKnPzwZI=; b=bUEJ1cj+9c6fsX6xbmZuq35IEqApHRy3TKhAV83gBreo9naxUap7xKy7Ra3gGDFhje EpnOQsi12d5V/mGXW1kVbVL6wYJgH3N4cGLtqJ+zA+CpcMl1LjIvmJdHGHvw1rQkdOnh qeIX7IF9Yhol2KzQuNffYw3FHmDB2MIepyL/iDfqVnLBJ4tgtjsbs2lmrjwfeX+EFv7l juOTbX3kDXNMJW8Onpgt/9M1QOwNVp6MaUyLTUJLRbR2Qay1GMSEwUDAmuB+xN7B+TUr pAncPDygTh5d583L0Uqt5WFLcYy1T4N7THhWN42Z6JtJDRDg6D08a0xH4KohzEfUhPe5 opJg== X-Gm-Message-State: AOJu0Yxj5YsXM3S56kbqSTQ4v5xxkjzLHZ43QwIQ2CA+UgV9AoVflK2R RZBfIb6nfE/WfDFeqXpTZ9sgSPItPlwx5sasgi4tYmwTaX/Os67uBTamOlEnR8q5i19x9NyvgDu Orw1KC5MR+WvZXBicseVLKjlrMiwIxGIY0iA4ufWA8GoixnQM1dAnf6CkT1eIPsq0MaolHIJSux k7eMazorhfFz6/OlY0LEs0EhoKJxsCH1bGXLKXNg== X-Gm-Gg: AZuq6aLDsLl/dR1EoQtVl8pwXIozsG9PJuI67ANzTupA+igSJs6wR4LDz+ljyfkgmX9 GhMa8tPvhj8chayei1UaUgJQ+bwmdYR08ymcedNjBNBV2audofpc0h+OsX1sYcafboA67cFiXYl D1JE8EZtvYP8siO/tw+Djv+EH6LtRJz0HrwTi84Y5w7EQwuvk5IwBG59gnKxqrK2AAo/OqDcmgN ZOZ4llHIufaplFbRm5JNv5JlMHjHK/ADmJdBmGj8QMbdjb+R/y2G+hY/VfUxzquIGZaHDvSN/3o etqZmTNQ93Svvza541Ij1kNhXDGUDBgXolxn3vkmjHL0sWBfvexzmThDH6uEAcBZfLOUGoE81vq k X-Received: by 2002:a05:620a:1988:b0:8c6:b45b:9e2d with SMTP id af79cd13be357-8c70b873b49mr355903485a.26.1769539985828; Tue, 27 Jan 2026 10:53:05 -0800 (PST) X-Received: by 2002:a05:620a:1988:b0:8c6:b45b:9e2d with SMTP id af79cd13be357-8c70b873b49mr355898285a.26.1769539985167; Tue, 27 Jan 2026 10:53:05 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Lukas Straub , Prasad Pandit , Fabiano Rosas , Juraj Marcin Subject: [PATCH v2 07/24] colo: Forbid VM resume during checkpointing Date: Tue, 27 Jan 2026 13:52:37 -0500 Message-ID: <20260127185254.3954634-8-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260127185254.3954634-1-peterx@redhat.com> References: <20260127185254.3954634-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_H2=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development 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: 1769540026325158500 Content-Type: text/plain; charset="utf-8" COLO will stop the VM during each checkpoint on either PVM or SVM. Accidentally resuming the VM during the window might be fatal because it may cause the RAM and devices state to misalign, corrupting the checkpoint. Hence forbid VM resume during the process. Reviewed-by: Fabiano Rosas Signed-off-by: Peter Xu Tested-by: Lukas Straub --- monitor/qmp-cmds.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c index 1ca44fbd72..0c409c27dc 100644 --- a/monitor/qmp-cmds.c +++ b/monitor/qmp-cmds.c @@ -84,6 +84,9 @@ void qmp_cont(Error **errp) } else if (runstate_check(RUN_STATE_FINISH_MIGRATE)) { error_setg(errp, "Migration is not finalized yet"); return; + } else if (runstate_check(RUN_STATE_COLO)) { + error_setg(errp, "COLO checkpoint in progress"); + return; } =20 for (blk =3D blk_next(NULL); blk; blk =3D blk_next(blk)) { --=20 2.50.1 From nobody Sun Feb 8 20:28:47 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=1769540102; cv=none; d=zohomail.com; s=zohoarc; b=j+klnzngtJEBu1ARea/EjegHjUX3Hh+f/YV6XwJWCq3TdTu01o42IZ/hGDIFCmvTAIcGJb+OxlfxmmjphnW5ur0P7FSNV2+YWW9U0gvTkKa8S5WRWWfIJxj40OKLpSf/46zguBEuGxmzi7v6rq/D+Ll0ngQV8atbPcOKZBstXYs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769540102; 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=hq+OcBvU/nIAaBDI0fi5KDSmQjBUYY4pgykw1erxlUQ=; b=QZmWOpEHqPF+vL1teg3umM9rU3Hzz/bsenrVesooOhRRcAw1zRoXjITWwe45cO9XO9XI1bil6oiUvTkbR0J3r90wgmqebmxrFKOmTeod+tslNCYvAlbCH0aHu67CVcBDkEnkj8MUbndsp8W+kxIDfDR7iF83vOhvtJSuJ8x4NwU= 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 1769540102578800.3709656338418; Tue, 27 Jan 2026 10:55:02 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkoCq-0005rr-Cl; Tue, 27 Jan 2026 13:54:28 -0500 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 1vkoBg-00035T-B9 for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:19 -0500 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 1vkoBe-0000kM-UM for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:16 -0500 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-107-3Au40x1tNe65cMURUhK6BQ-1; Tue, 27 Jan 2026 13:53:08 -0500 Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-5014c9ee70bso167953871cf.1 for ; Tue, 27 Jan 2026 10:53:07 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-894d3740e54sm2338466d6.35.2026.01.27.10.53.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 10:53:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769539994; 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=hq+OcBvU/nIAaBDI0fi5KDSmQjBUYY4pgykw1erxlUQ=; b=O2keZM4hmQ3uQlvUnzac3KHeEk37lCqX6hp9ZgftTOrIwj7OlClrS9bMxsoX8dueX9Wh7Q fg3Yu0TQwrPKkb/jMoZNz94pL9yxAERIwIQ08vAsZFgE3uSSTc7PtY+rR1WMxsDEsjlt5b 22+9mAD8lTaHRJoz7xPLlMaMBrGaYBo= X-MC-Unique: 3Au40x1tNe65cMURUhK6BQ-1 X-Mimecast-MFC-AGG-ID: 3Au40x1tNe65cMURUhK6BQ_1769539987 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769539987; x=1770144787; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hq+OcBvU/nIAaBDI0fi5KDSmQjBUYY4pgykw1erxlUQ=; b=d7K8N6p2c8msnBRdQiwQ6SvaNfU32i+Eahr8xufs13O1uat4qRQKVizhIRZWeo1lfW wUFgoPKfSGdw+IRB8t52NT5YrrhvNcTaB0zgbzF7dGJrKcUSnlbOGbqMMhL316xQSP0a D7m3SZeXx89g8oyMLSoDpcFSFEaXYA6kZvtxhpgtZrEKFhkA6rG9R7otQdFX+Z4RsWPh U3Rw8hnWNtEoyE+WkQ1iaCyPyTvqhzFbxiIsYYfTujhwmoFAR5UEVkcDjIGRpFwQT8y6 eJKsu2lxUdwQcFGdyQVjtSadYObL0A0YNWow6eYb833hpjrEqRopcC4ZJjTqS+xirX0G uliw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769539987; x=1770144787; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=hq+OcBvU/nIAaBDI0fi5KDSmQjBUYY4pgykw1erxlUQ=; b=biVSFKMSM8Q2OFeYv19PH2N9moad/K+66Oja1ywh+66osKP/sr0taDFk+P/XblhRwy Nf/fnlWz0biWxAKKfejieTnTgfPRF9Yi/yKoBMTsgtyIhQjz3T2k4F90Dzj0Brs8kjsY 8tLlYVXDjquGXvVCugFLIhn/TdDKk/pWtgBBrhStRauAE2p+Fu1ZV/Zj759EZGF3PcAw kXDNfUTLWD4uhTWVymvL6QW7wHDYx6hJ3SeSJda3Edgri4zVsAEZqyhUhIFihkr+JYzI TwcsOXnzC954/fbcHuOTnZrLH1kPzsnHhlZHC8eE90EGa+RW0ge7OFjwa/QE3ohfshoI G8XA== X-Gm-Message-State: AOJu0Yy/hyviGuNTfCoQkDvFbzBI/sfM27u4z1OCeVOJZS+EbXcV9l20 iU8tCmp9x8O28py8aCHuuSaHI7Mj/xYahknwvq3FD+quIYr2aauD0+bcKqLE5PzQ8WkK72WUAKl rQpbcwTsMWY84rAhYB5F9EnjEeZJrJu2ALzQ8Rl24yIg8yabCCJDI1J/c8ogmCdScYehC0bvgZ5 dbDMGJ5TcPz3Y/ZRW7KQz8D/o2VkP22X9MrgGE6w== X-Gm-Gg: AZuq6aKWdA+UJ02rl+Cf25050jjuIYRGp1P/bFsjZTVc4E4cEGxbng2PEYBbrhG+1h6 0SNgCGOLhYaFQ7E+bTBA/CiQvVaRnZi3JNLYGhGFAk4xmBoLLecp7TnOz4rmm6hGlh5yb4whEg4 XpMvpsDn8oFBG6qacKT4J2XCB12/9lYJrFQ3yi9n2paj4QT8ThYKEnSiELKf3ZOPlqXSfedZHbd WZORbUQCCpY65O0XLhyzGWW2xl/ayaY/6QAmxBonDvWP+3aAufomFeETi16oUb+Qpj4V578tP9g o4J0XisecXo6HBsfEQh3NDzLelnUsg1FRzedOGmGhUlEPy4elBQlrZmiKQHBmH73+h4MSsRbrSU E X-Received: by 2002:a05:622a:190f:b0:4ee:2510:198a with SMTP id d75a77b69052e-5032f8fc0d2mr33352051cf.39.1769539986966; Tue, 27 Jan 2026 10:53:06 -0800 (PST) X-Received: by 2002:a05:622a:190f:b0:4ee:2510:198a with SMTP id d75a77b69052e-5032f8fc0d2mr33351451cf.39.1769539986184; Tue, 27 Jan 2026 10:53:06 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Lukas Straub , Prasad Pandit , Fabiano Rosas , Juraj Marcin Subject: [PATCH v2 08/24] migration/colo: Use the RAM iterable helper directly Date: Tue, 27 Jan 2026 13:52:38 -0500 Message-ID: <20260127185254.3954634-9-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260127185254.3954634-1-peterx@redhat.com> References: <20260127185254.3954634-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_H2=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development 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: 1769540104706158500 Content-Type: text/plain; charset="utf-8" qemu_savevm_state_complete_precopy() has a weird parameter called "iterable_only". It's needed because COLO saves device states in advance. To make dropping that weird parameter easier, let COLO directly use the RAM iterator helper instead, which should make the code easier to read too. Reviewed-by: Fabiano Rosas Signed-off-by: Peter Xu Tested-by: Lukas Straub --- migration/colo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/colo.c b/migration/colo.c index c344943173..f92803dd29 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -469,7 +469,7 @@ static int colo_do_checkpoint_transaction(MigrationStat= e *s, * TODO: We may need a timeout mechanism to prevent COLO process * to be blocked here. */ - qemu_savevm_state_complete_precopy(s->to_dst_file, true); + qemu_savevm_state_complete_precopy_iterable(s->to_dst_file, false); qemu_put_byte(s->to_dst_file, QEMU_VM_EOF); =20 qemu_fflush(fb); --=20 2.50.1 From nobody Sun Feb 8 20:28:47 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=1769540075; cv=none; d=zohomail.com; s=zohoarc; b=jCb53FYxozhWN3sLm/ZWqZQVVK9SS8m7MNS76/Qg/o7kBPCkkxiwTGD6rkgFQW1dn7PernF0ITcvXhLi+Gd/U3XcVs9lXwLUwNiKAX2ZhKg4T3/nnY8yshdL5LTm5LQGpK/i5sTZ7KFzRdyMcEXaDIOaaFQEE1LHD5eM07oIxUs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769540075; 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=YRGJSJKdyQVd/Cr4isDC+mRPgefExLoIMOCxpKtf0ro=; b=Ttt49B3A9ETO8fV1xoJFWwGjKVQkAvoxaPB0wQxcFaouwcmKH4PlkYVZiEBxlC9Nkd0ouC2AUWinuYgmH9wMqXAlc0/Ll3RkX+jd/6NMjEiP0helVO6lLJx+/TZZxhT/kX3Bp4jv2SdU8celEHHK0sjkKBaAB5kaQaEoNnRbF6s= 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 1769540075153876.5412658922436; Tue, 27 Jan 2026 10:54:35 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkoCk-0004zb-MY; Tue, 27 Jan 2026 13:54:22 -0500 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 1vkoBc-00032n-JZ for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:12 -0500 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 1vkoBa-0000iM-Qn for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:11 -0500 Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-224-lqcKdswJMGyRxcRuL05FYQ-1; Tue, 27 Jan 2026 13:53:08 -0500 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-8946b186018so252497386d6.1 for ; Tue, 27 Jan 2026 10:53:08 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-894d3740e54sm2338466d6.35.2026.01.27.10.53.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 10:53:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769539990; 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=YRGJSJKdyQVd/Cr4isDC+mRPgefExLoIMOCxpKtf0ro=; b=HHvCzPEh5F9/9IlgWXUFEn6cFbUB87l/yS0Ovw6Nds4W2kgkdgI7TE9F+mx/H9VyjT7uYC aXLrE4hKgvLekoHMfsRPw64ZTPaMEdt1+NHxqzxEiztsDrrg981UBru+CAG76+WIxJNnuO xPFUJG7uqnevmbsSYoEyo4Aoj+qhuNI= X-MC-Unique: lqcKdswJMGyRxcRuL05FYQ-1 X-Mimecast-MFC-AGG-ID: lqcKdswJMGyRxcRuL05FYQ_1769539988 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769539988; x=1770144788; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YRGJSJKdyQVd/Cr4isDC+mRPgefExLoIMOCxpKtf0ro=; b=GftCUbQhDCt8rtsrXdSPpLnC5lKhY5XFH45Yb8j1FG9yCsVhjLuDJWa/t9cF0/bIG2 neb1PVOusRc+4KP3gYa7NNqb5i6CU/b2GPA6ALY5w4pGtM92Y5NwHGVzjHvvzv9nB7nr ZUX4K6X+FmSY3KinRloWDUqHxxKID67R+EfiE+mxW4c/cxEIxBdUYum5iK9dY4nh9Rcz ORaBLsZGMPn7yHljSTwxBH/DaMsucj0FnMZtv9Q20dqhaIoFfx7wng3f/0mfZVZHracX DGt4O+alrc5hLF5cdz8/4roO3yVQiSh2huOmGDXDFEaG4YidYEkc1obvAzhOEmsF0++L s5Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769539988; x=1770144788; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=YRGJSJKdyQVd/Cr4isDC+mRPgefExLoIMOCxpKtf0ro=; b=wa+D3HsEBl1qeoCdiy1mG9+I7oB77KZ9CzSBHkDqUmH26iObe6N8QabQTA1B4Ddv0l rDgkUqbzJcsYn3ayAIopA7mdudyP5ynUXAwwahABRhrTj3dNirASonusLDd1sBpm/aGH ycsSG5O/qRRgVtCDwl7ADLZ30WXYn0xTk2Tj7+5WFPmw7Rxh9iS+uFPUoTaUA01kQEbc /rnkWX8OviCo1xRIzdXIJNVxloxi3zr1hvu81URSnWB4nUsx489Hm9JgmQHtJB+UM/eC b9xXrJjH1j0vq5XvIGigk97H9yLKeaYY36gPwjSinKaI2NPRNDZE97rn/63WLv1cXLLJ he+w== X-Gm-Message-State: AOJu0YwOPwvRhksXOUjTpfu145btw50HDJVVGEb8UmA5FdIrUh9K4I2/ udIQniqw9cXmu2kYHdFmg783j4Lx7sAr53e3kdjxZdnOwV0Tch6nmdXR4H1LWjLaPhBwtJWXfKM XoCnONEKakjaswfg1MCtO7kNJJ0X/gCDd1C9/8MgsxGDwFqf7cAQ+LSaYM+/XDG9kww0d2vlFRm a77ryB5oDdNousm+aPp1QBa66gC2cttuTooi77gg== X-Gm-Gg: AZuq6aKQvihLn8m+4Lykp/CctZzoGMcBEjniGRm6XUfeQwQG0496U5Ckn1NsSMeyLl9 4qtkzS1HoAYOUbG1uGih7rkW1oS32zIZ3MUszMiVYclVh5msyTU8f6bDZTk3GatHxvjT4L5Ozia SWA2MII7nACv75/iMABt3JPl8ZSZfU7pdNZGS4tBUi+LoaF+jyJDih8sn40jDuNrQdAgpIsG7nO sAT5tfWYy6A79N4OvbZmN68ekdlrVMHfRKQ2QJ8ZFF156ma/AkNN3zOGM8CkRG4UC6FMPerqXTv GGHRlr6iXenrkwmNbGKmOWhhi/N1MCyD8sve0iO2vI625fGvWPK5jh4lAtlfoERfb+ULlzbRnwr 9 X-Received: by 2002:a05:6214:21e3:b0:7e3:cc6e:3c89 with SMTP id 6a1803df08f44-894cc955bf3mr38752366d6.56.1769539987752; Tue, 27 Jan 2026 10:53:07 -0800 (PST) X-Received: by 2002:a05:6214:21e3:b0:7e3:cc6e:3c89 with SMTP id 6a1803df08f44-894cc955bf3mr38752016d6.56.1769539987283; Tue, 27 Jan 2026 10:53:07 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Lukas Straub , Prasad Pandit , Fabiano Rosas , Juraj Marcin Subject: [PATCH v2 09/24] migration/colo: Document qemu_fflush(fb) Date: Tue, 27 Jan 2026 13:52:39 -0500 Message-ID: <20260127185254.3954634-10-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260127185254.3954634-1-peterx@redhat.com> References: <20260127185254.3954634-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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development 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: 1769540078125154100 Content-Type: text/plain; charset="utf-8" COLO caches all device states in a buffer channel `fb'. Add some comments explaining the flush, that (1) it's the `fb' not the main channel, (2) on what it updates. Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas Tested-by: Lukas Straub --- migration/colo.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/migration/colo.c b/migration/colo.c index f92803dd29..1b94e0f0ee 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -472,12 +472,14 @@ static int colo_do_checkpoint_transaction(MigrationSt= ate *s, qemu_savevm_state_complete_precopy_iterable(s->to_dst_file, false); qemu_put_byte(s->to_dst_file, QEMU_VM_EOF); =20 - qemu_fflush(fb); - /* * We need the size of the VMstate data in Secondary side, * With which we can decide how much data should be read. + * + * Flush the qemufile cache to make sure both bioc->usage and + * bioc->data contains the latest info. */ + qemu_fflush(fb); colo_send_message_value(s->to_dst_file, COLO_MESSAGE_VMSTATE_SIZE, bioc->usage, &local_err); if (local_err) { --=20 2.50.1 From nobody Sun Feb 8 20:28:47 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=1769540079; cv=none; d=zohomail.com; s=zohoarc; b=DTeEGdJ5psnWWSrULPvz0lxDq4R01mSkZTsMc6kYFdrdGbTV+kyXmErgjB9OoFpUQf4gYU8SILGzKhMBL946EWInEEltTgl7Ux2mKXGy21pM09dHxwDD97IqEyCyCGO/svPEjYvpCxMtpl8h28fkr8BiOXrgcxastM71Pt8XW6Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769540079; 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=VQjHMvx3XPpUkrdVwOgSZF1RvbP7lisB8RqoyBnK7Q4=; b=Wes7I7mQgO9su+4XIWAqvGW41o3Ot7t4m74PjUZAHokR7YCaFgm9UsiXlwjVIi/FUN7z+6VDSiLkobmj+PkdGkBFtAfSwUYfrro4CDhUgSpUQkahxw9V8Brr8yQ65FYKHsWNY2vmLU5rAdPLQFK63i6jxS74auPA9HTEM19Vl5Q= 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 1769540079374691.509066361204; Tue, 27 Jan 2026 10:54:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkoCi-0004l1-3I; Tue, 27 Jan 2026 13:54:20 -0500 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 1vkoBd-00034z-SW for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:17 -0500 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 1vkoBc-0000jT-B0 for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:13 -0500 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-436-Ucnr4diPNlmqQ77fnM8UCg-1; Tue, 27 Jan 2026 13:53:10 -0500 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-50148a1cc44so269629491cf.0 for ; Tue, 27 Jan 2026 10:53:09 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-894d3740e54sm2338466d6.35.2026.01.27.10.53.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 10:53:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769539991; 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=VQjHMvx3XPpUkrdVwOgSZF1RvbP7lisB8RqoyBnK7Q4=; b=O5xgsa8HZM5jMingW6l3Ts48LUMgpmdJszCo2sG6EJGfxPxxZ/AB4dirJdfdU8/uAi5GfO mijHl9w4JKMWSKqsam9gBpoHvIoeOkW9pcmugF/UBFwL0z7rj8cflactPR7mZqYFpg3I/+ ZUXmwsayKogjuRBh0+Qc2l3lJ7lBsRU= X-MC-Unique: Ucnr4diPNlmqQ77fnM8UCg-1 X-Mimecast-MFC-AGG-ID: Ucnr4diPNlmqQ77fnM8UCg_1769539989 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769539989; x=1770144789; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VQjHMvx3XPpUkrdVwOgSZF1RvbP7lisB8RqoyBnK7Q4=; b=e6JLk8AvONW/Eigjb80aOyDC3DIRbBqlpHhEjvKYSezK/TJNTFcnAj3/BJE4sClzmC DOz7IkdSyvyCDGDlxKEHPUpupqoqLamvoFp/Vsb+OleWC81yCxuYQOtoBR2yk5jBelT5 kqth25NFs9d8r43FzsPcnAt1EvyuiNOEIYtJXki9she7maP/lRgqknks75oa+WyhhA5G aRP19AQaqeaSX+Z9P2wweGH9mWpFeYqpVdWMlBZAolrRBs1ed2ir31fiSqSo7bzD/O2o Rqx1pOWfMRqjI2/fUi0Q41DZGj3O3UKTPNxGaG+DalNNC+S/8V0CUP8oAk2H8LIvrrVH U6SQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769539989; x=1770144789; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=VQjHMvx3XPpUkrdVwOgSZF1RvbP7lisB8RqoyBnK7Q4=; b=Mm3wrgsx/tFoSunPBxj98kdE+bVM5lGu6CY492QF3+Kw09SGbIwybuVRlkN09kxGmY MXN0E5UGN9gGiOY1kK9P7uO33PRX5U3FNJAqRIwnzt/FNf6dmeW9sZTmyWa3QZW2jQNw p7y8G/+GAj6854CsaLUeMZtBp/DijK+gs3ICXb7m5cUDkbICbv2Rr6gxilLV+5bJVBDo 6g1miMUMXhBZtfOH00VHoR+Hs+pTlwqn0IPI/Ic6AnAlfjJ7DsDDt5vdwR/CaL0doi0a HaiZifhcU2bz5xo67KRAumFauLG+VAOAkQU/f5K4pJPXQOBhcyMUcGDyR/oCqE5C/+bg sXxQ== X-Gm-Message-State: AOJu0YzjpWnA+42gDLJJzZLSqAisaxXFBiAb+PJ170e/xRqpJpxB3eI7 vq3XnFWAglTiFDFgVd/eXv/GVgDa1KmJQPc/Wg9sbab5UvKcGXwFbALwKvmi62jLozGmYJ1mmYA F3QWQHjHwUOcQbBxtPUIbwPnB+FQa9WkWQt8uk/bNX2GAsRlkkmoh0ybgWO45VpYHeAp4+QI43i 7c+0fNMyXI/RlAJ7ldZvUsqeHuSJmc3upED7JASQ== X-Gm-Gg: AZuq6aJEGgwQBaAXXnONgFLdB8VJJ14hCjKL+Fq9iod9BSqNMY9GiprQ6SYS3cCIz5y f8Hy9+jOrvs688snJ3QE4r4aKPTzUFhRU2N+FnzKXiMU3v9I07Bs027b6NzJ4watbxEV8bX1HYU WofXCXIJHQHNgRkUoIIm+yuKU1kH0415VtwhUdAcfbdMcWZVUoIn+JiGvivypL/7Hl3dkOGLB7H +mVAAOnciq2tBHMVdw5wj8j/i9lzqxCZ0t4OEi81oCNx1NWo8/IGVIHytxzOf/RhlwP66UymZPl vj4fcZobGl0nWtRfmlTT9JRzaqXQv5YYNyJJHOFCzgAhHg5XHcxkVAQdp+d9k17fwz+lOVGzJGU R X-Received: by 2002:ac8:7d03:0:b0:4f3:58e6:6246 with SMTP id d75a77b69052e-5032f9fcc9dmr35501731cf.58.1769539988638; Tue, 27 Jan 2026 10:53:08 -0800 (PST) X-Received: by 2002:ac8:7d03:0:b0:4f3:58e6:6246 with SMTP id d75a77b69052e-5032f9fcc9dmr35501471cf.58.1769539988165; Tue, 27 Jan 2026 10:53:08 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Lukas Straub , Prasad Pandit , Fabiano Rosas , Juraj Marcin Subject: [PATCH v2 10/24] migration: Drop iterable_only in qemu_savevm_state_complete_precopy Date: Tue, 27 Jan 2026 13:52:40 -0500 Message-ID: <20260127185254.3954634-11-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260127185254.3954634-1-peterx@redhat.com> References: <20260127185254.3954634-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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development 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: 1769540082094154100 Content-Type: text/plain; charset="utf-8" Now after removing the special case in COLO, we can drop this parameter. Reviewed-by: Fabiano Rosas Signed-off-by: Peter Xu Tested-by: Lukas Straub --- migration/savevm.h | 2 +- migration/migration.c | 2 +- migration/savevm.c | 12 +++++------- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/migration/savevm.h b/migration/savevm.h index 528607f09e..ea01ca63ec 100644 --- a/migration/savevm.h +++ b/migration/savevm.h @@ -42,7 +42,7 @@ void qemu_savevm_state_header(QEMUFile *f); int qemu_savevm_state_iterate(QEMUFile *f, bool postcopy); void qemu_savevm_state_cleanup(void); void qemu_savevm_state_complete_postcopy(QEMUFile *f); -int qemu_savevm_state_complete_precopy(QEMUFile *f, bool iterable_only); +int qemu_savevm_state_complete_precopy(QEMUFile *f); void qemu_savevm_state_pending_exact(uint64_t *must_precopy, uint64_t *can_postcopy); void qemu_savevm_state_pending_estimate(uint64_t *must_precopy, diff --git a/migration/migration.c b/migration/migration.c index b103a82fc0..e3f1cc7b2e 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2752,7 +2752,7 @@ static int migration_completion_precopy(MigrationStat= e *s) goto out_unlock; } =20 - ret =3D qemu_savevm_state_complete_precopy(s->to_dst_file, false); + ret =3D qemu_savevm_state_complete_precopy(s->to_dst_file); out_unlock: bql_unlock(); return ret; diff --git a/migration/savevm.c b/migration/savevm.c index d41be3a4a2..da9a60c73f 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1717,7 +1717,7 @@ int qemu_savevm_state_complete_precopy_non_iterable(Q= EMUFile *f, return 0; } =20 -int qemu_savevm_state_complete_precopy(QEMUFile *f, bool iterable_only) +int qemu_savevm_state_complete_precopy(QEMUFile *f) { int ret; =20 @@ -1726,11 +1726,9 @@ int qemu_savevm_state_complete_precopy(QEMUFile *f, = bool iterable_only) return ret; } =20 - if (!iterable_only) { - ret =3D qemu_savevm_state_complete_precopy_non_iterable(f, false); - if (ret) { - return ret; - } + ret =3D qemu_savevm_state_complete_precopy_non_iterable(f, false); + if (ret) { + return ret; } =20 return qemu_fflush(f); @@ -1830,7 +1828,7 @@ static int qemu_savevm_state(QEMUFile *f, Error **err= p) =20 ret =3D qemu_file_get_error(f); if (ret =3D=3D 0) { - qemu_savevm_state_complete_precopy(f, false); + qemu_savevm_state_complete_precopy(f); ret =3D qemu_file_get_error(f); } if (ret !=3D 0) { --=20 2.50.1 From nobody Sun Feb 8 20:28:47 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=1769540066; cv=none; d=zohomail.com; s=zohoarc; b=T/mn21aJPIQcEbrAxn3J3DHkv6danvdQOY2jdTmi6i3lBdAkRnjeMmsGAy4XdGOHwClMaDvcoyv9DbBY0yQIzPwkN4yDQqwElJtrBaYzACoyxA3pePKwfjvAzetyQ5pHFk+HniFz8tpkyzsLMYihfGeozI/TWqQxHnbK2zRn1mo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769540066; 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=0OCGSzBZO7Qcay01osVXSmLFpVPre+Xa2F2P4gjiFVw=; b=OyiMc9EjXMmGOG4JOlRBVte5x0od4jVF7uxLhXjtsu1Ig1s832+Zwj841w7mKkWYhmv/RBmy3FFudyCewYg6n6VYHHyJWw77skxAHmSt7LmHfjgYLbBHc8a2qByzYv1gisqObJ20iHp/fGEEQn+91bE5wEQSft/98D68Dl1Y6pQ= 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 176954006683030.338414393565017; Tue, 27 Jan 2026 10:54:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkoCi-0004sK-MR; Tue, 27 Jan 2026 13:54:20 -0500 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 1vkoBg-00035S-4Z for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:18 -0500 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 1vkoBe-0000k4-0H for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:15 -0500 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-442-VsQ7tHHmO5yMzDOKJ2carA-1; Tue, 27 Jan 2026 13:53:10 -0500 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-88a39993e5fso188562976d6.3 for ; Tue, 27 Jan 2026 10:53:10 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-894d3740e54sm2338466d6.35.2026.01.27.10.53.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 10:53:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769539993; 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=0OCGSzBZO7Qcay01osVXSmLFpVPre+Xa2F2P4gjiFVw=; b=QgzIL1JP50bJ44aFPYTg3C96H/2deAkcwirMcJfZvsW2z7Z/yxZXsH7Pn8XrZg5TWwSKzl +YaDDY8q1H2eU2Py9z12uBA7VnhMGwDxVbchncBbsrBxxwYILgAELbldnSYOQeZh5pJDsN FSsVEeeBMjoN8yhxeFJ5wyFYOiNC524= X-MC-Unique: VsQ7tHHmO5yMzDOKJ2carA-1 X-Mimecast-MFC-AGG-ID: VsQ7tHHmO5yMzDOKJ2carA_1769539990 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769539990; x=1770144790; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0OCGSzBZO7Qcay01osVXSmLFpVPre+Xa2F2P4gjiFVw=; b=a8YdqkoG5zDIubZz6VUsdhs1DaI91wB1TMJRlZUqvIrcjfh23rCghl1CUTsqXS2yDl G/O0XMdnGo34BLJoMkW8yNQFieDktZLuMeSbCQFgLjMh50+/1AOZxFZ+Xu/+9wbzevxS L84QrvveLU9cFDH0WWGPdXLNGnipWGdP8iv9St8xay9Is9dQuZ8qL5vsExTuDXa6/tvP QgkikA9vjefokax9BVWdfuTzqZ41bOLaAFTw4MCZDwVX3u6yw5MnfyrXAbQH/B8vvCQO uGfcc1IUpleXx+kjX+aNH71jjB0TWy7FROBKDPi56HH1kEJMuh42Tg7GH4rfqhO6zm2o 7Nww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769539990; x=1770144790; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=0OCGSzBZO7Qcay01osVXSmLFpVPre+Xa2F2P4gjiFVw=; b=BjSDCGYRs7sGwJ19p/8yKZI14Q1WykZFkwaevzCl8H3mXIMpY+UGzmZfTBG7SzLjU9 3i+XkfLdFmzm66LLR0nduPCb64y16WH0aLIJUv5NDDMZ+ou81ICc5PZNYHwkIM8yT1Fm x47MrQRbIyTZmhqPLSHidx7RljO+iFgC3II4/xJPKhABcQRR/LZxgunecG0gM3s+VmXf rzMx+EoPGs2Nd9JpHuJm68iA5jvMyMckptDqkmV286L2jO/cwYn1CUBoK8km0gMWluBz V51FObhhg88EIqU9GYDb+VSlzr6DS6rSZ2SYD50pUXLVmdCJmbTKzgMTMjGYGEq/GYKy w+qA== X-Gm-Message-State: AOJu0Yz9JEAu87Y6dCqKtNRA7XevuO4imqb1/snAcJodEk3QnKSaJXER p+ogJyYSr32ckA3Qs/g2K3v53VBG9yrIi8920JfT1gp5menyHSzfs+l2lWLFUVBZd6fNOmz5RL1 GLyW7jwjXlWxOqMPJr12Cx2Qs9jkKUkRb/lqVQCxeeu+eqUIl4FTM6mOZSjlyUQ1qOlevmwjuU2 HACiUKvmS2ve+kdYdT8T8RGGvuEO7DxkW0tsXsvQ== X-Gm-Gg: AZuq6aIYy8xnqcmY1+wC/5Q4fv+7UGOSa31SbtBVncFOSlHjbIBYFpQx6I8Ci+6FuGG yXai+lmfQPIZOeQkvI3IYUENWPPm7fv3zJhIUpB7bJCOm7H8T9HophjZ2uQnYRDloTpJBTx3gRD 2CHGAzvJQi8cPsVskOfKUJeBmkSsk1MPaqUBRfDfj6pcFaq1mEXKs5PmENNUhO9rjn7p6ig8Xx0 Es54ScMUc4UcKbopLoKzgKaXXGuRzS90C6fCzOVa+2+uwudJ8MSXWEwDupKJ3FQbFDWFk77LP2A bXmiIIsiXofxEvSec6IFNHQ5uo5JHSE3u2B/Fv4fJg3948XZc9gfPLYfQwx9hjVJBxUSDrTqxfW W X-Received: by 2002:a05:6214:224d:b0:894:6f12:5da with SMTP id 6a1803df08f44-894cc9786bcmr38388546d6.57.1769539989767; Tue, 27 Jan 2026 10:53:09 -0800 (PST) X-Received: by 2002:a05:6214:224d:b0:894:6f12:5da with SMTP id 6a1803df08f44-894cc9786bcmr38388006d6.57.1769539989100; Tue, 27 Jan 2026 10:53:09 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Lukas Straub , Prasad Pandit , Fabiano Rosas , Juraj Marcin Subject: [PATCH v2 11/24] migration: Drop qemu_file_set_error() when save non-iterable fails Date: Tue, 27 Jan 2026 13:52:41 -0500 Message-ID: <20260127185254.3954634-12-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260127185254.3954634-1-peterx@redhat.com> References: <20260127185254.3954634-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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development 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: 1769540068577158500 Content-Type: text/plain; charset="utf-8" All users of qemu_savevm_state_complete_precopy_non_iterable() process return values. There's no need to set error on qemufile (which we likely should remove gradually across the tree). Remove it for possible code dedup to happen later. Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas Tested-by: Lukas Straub --- migration/savevm.c | 1 - 1 file changed, 1 deletion(-) diff --git a/migration/savevm.c b/migration/savevm.c index da9a60c73f..9d2109718a 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1688,7 +1688,6 @@ int qemu_savevm_state_complete_precopy_non_iterable(Q= EMUFile *f, if (ret) { migrate_error_propagate(ms, error_copy(local_err)); error_report_err(local_err); - qemu_file_set_error(f, ret); return ret; } =20 --=20 2.50.1 From nobody Sun Feb 8 20:28:47 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=1769540065; cv=none; d=zohomail.com; s=zohoarc; b=Z7w4hlhvgpM8qRnie+B3zjYD2rHy5CQpaxmq5+byx4T33PrtxjfRz8JP+LaGHw2u+CxX+sojSbrTq3is5PVnf9rEKsS6sI0lio6DCYgtXvnO6X/b58eRbZVNBx6nF+hejv8tqt9ahEKDnHTfDufIFF6rvXxRuOslQe/EZTAe0FM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769540065; 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=0U/KC4mRCm94WnZf9o8vD7nPLPznEjZNoKjE7aKYY3o=; b=ftZGO/CClL970USFyrX2gFBjpljENJ6HsM3aR3pv9UGN2aPf+vrlGdUul4ihnmZ6bOgOCtE651Mgt/NsjqrlNhvCODO3N8f4nXEIDTprbOjNPN/iP87WPsVUnC64R89cX6xxHuVl5n7QAlPz4ivftAt0BWglMZzrL8qfOUxcxuU= 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 1769540065862925.7672297673962; Tue, 27 Jan 2026 10:54:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkoCj-0004yu-W7; Tue, 27 Jan 2026 13:54:22 -0500 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 1vkoBf-00035Q-CI for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:17 -0500 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 1vkoBd-0000k7-OS for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:15 -0500 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-246-Yvnh7MxmMeKLaMDL2rcjVA-1; Tue, 27 Jan 2026 13:53:11 -0500 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-8c52fd4cca2so1897544285a.3 for ; Tue, 27 Jan 2026 10:53:11 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-894d3740e54sm2338466d6.35.2026.01.27.10.53.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 10:53:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769539993; 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=0U/KC4mRCm94WnZf9o8vD7nPLPznEjZNoKjE7aKYY3o=; b=BtOcWeVQ42WYFMT9lKPfgCE9N9QA0UQiAac241SapyDCu6Kt/e0968l57+TcQHcOWuQ2ht j3BaHWnYL+81lj6M5i1yZ6WWmQNj56/nzhD2jKwIKXNt6xZKrBM3MtZ8P81yvR5JMl6L8M KBJ9NXc+3PvYlk1TyGyPfbvhSMWLo1c= X-MC-Unique: Yvnh7MxmMeKLaMDL2rcjVA-1 X-Mimecast-MFC-AGG-ID: Yvnh7MxmMeKLaMDL2rcjVA_1769539991 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769539991; x=1770144791; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0U/KC4mRCm94WnZf9o8vD7nPLPznEjZNoKjE7aKYY3o=; b=tAPWo7+aK3JBxpF159+6RIQdakrKQMWshbYh2hvE97BPwlUPmalNc+W/QXuNpozkaG Em+mLvxvrVtEMQqMisdX97j0iGL5opJLbRGm+pOmRqlN+8hkN9BRXOvT7ZGgYbW4ERtj 5tGbgjvSvkgdwXNIuT0m6lSHKeCu5N7BmG4tAv0SSMdi7ftnyyBG0D3cQtusomcJL1ba w/KA3YJdKPdImSXUfKIsEgwejdKMAqcS53KS216E5oPB0ShsSFay9/V6AsxuKUrtTJ6J b+cQ3WX5+CZMuytFyXgfZD1VWmI18+k/y/Uc3z67opYiTepnQ1TbsbkX/yTvmsxggUAn Rsvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769539991; x=1770144791; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=0U/KC4mRCm94WnZf9o8vD7nPLPznEjZNoKjE7aKYY3o=; b=dKYe6UU+nYj1VUXuPWnADPrwww5J2LB4NluTGqg4U88LxilRTHoAA1O2nxfOHov0Yq z+j51RnMhi9l3dYyMlw13IiIbDWFJWdKVYlO/xuqeUAfJKSwuUjMUoOhSSb3IROUQ9oK BLP6GVzrsIDU2m4rCOM1chc5HYbxnVL4EcPQAg1qaaXZnqOIJ+fc2tCaADEBzrJM6JFh oGGD1VCvnkDo38Wfy6rv9IOH2bc/rG0itHi2EDd45cwrV+bXD/3IZK9CvcqZ13MuTH0o ffnN6bg6l8w++BBwj3hPR6YKR+PudS6rH8ewzCrwkM8lqJ9SCs+57bh+3Om8Zy2G+ciw Tt6Q== X-Gm-Message-State: AOJu0YxBDRiHBOASJZ7EvzubYacoYV1lDdQewmk6D8MMjeDLvEF6R02i ixrzkSSKjHJ8DXz3HXpsujUYq8rFDLm1kVwm0Dh7q4OB4x4o5O//+9QSfIuJGw+scMx4CQv/Kb7 PzLhExxoHo72AR48dJfZ6CuoIG8d3y72HjT4IDMb0ZPTce3CHduxkYAsq0o4VwWVGQRHSivXk4X n7FiZcRCDgmBGTsBc4RootK5tDPzDoHxiLgtlefA== X-Gm-Gg: AZuq6aIFb0+c+qRaq3mgoTvz5FpbwSN4yStY5x34sx2s3pTRHSwHOhsqwyMos01YRS1 IesIe2lwmuQ+Ovz3Gj5YCnC4Opo7RWf6QOslBMUxle4yToXWpAuw/PhsmJOXz/ZeoH8+T+Injx9 WequoJiX0YqRgXGWaKJi6sve6Vw5nazLDdqfKwxglxyAtAs/2IhUkF3TbPbzPxUor3QoWZ8hJOZ dnhhU150BbpmDo0Fmlg4NNfMuc1Ed8Jv5MmVEXC39fazTyH+i7MtUt6BUazgYmZvHReKwFpt9Qz nJu3IWP7oSUDhyDi2oRSqz0PK3DTAaR9bLg7Nhwx5jZg7yYIwMqiQFvsrySBA2dmqHKiRzPm8dr Z X-Received: by 2002:a05:620a:390f:b0:8c6:d949:1d8a with SMTP id af79cd13be357-8c70b84a786mr338900585a.6.1769539990597; Tue, 27 Jan 2026 10:53:10 -0800 (PST) X-Received: by 2002:a05:620a:390f:b0:8c6:d949:1d8a with SMTP id af79cd13be357-8c70b84a786mr338896985a.6.1769539990111; Tue, 27 Jan 2026 10:53:10 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Lukas Straub , Prasad Pandit , Fabiano Rosas , Juraj Marcin Subject: [PATCH v2 12/24] migration/colo: Send device states without copying buffer Date: Tue, 27 Jan 2026 13:52:42 -0500 Message-ID: <20260127185254.3954634-13-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260127185254.3954634-1-peterx@redhat.com> References: <20260127185254.3954634-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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development 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: 1769540067963154100 Content-Type: text/plain; charset="utf-8" We can safely use the async version of put buffer here because the qemufile will be flushed right away. Suggested-by: Fabiano Rosas Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas Tested-by: Lukas Straub --- migration/colo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/migration/colo.c b/migration/colo.c index 1b94e0f0ee..0b1a58cd8f 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -486,7 +486,8 @@ static int colo_do_checkpoint_transaction(MigrationStat= e *s, goto out; } =20 - qemu_put_buffer(s->to_dst_file, bioc->data, bioc->usage); + /* We can use async put because flush happens right away */ + qemu_put_buffer_async(s->to_dst_file, bioc->data, bioc->usage, false); ret =3D qemu_fflush(s->to_dst_file); if (ret < 0) { goto out; --=20 2.50.1 From nobody Sun Feb 8 20:28:47 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=1769540099; cv=none; d=zohomail.com; s=zohoarc; b=f/AUqolESvJFgov0pb/mdYiL5OxXJyf+zYo/S9yKRTzcoudt1t2ejTiv40TXBHZSgwRgbQ9h3JGcu7ZT9JB4zac+1J/sG+pgbAEPX7pKi/lct0ZuU+TaCC2hfsoGzypocnA8Ql72Da1B5V0wFXVrdpv83InVGjo+gU4ld8Cedf4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769540099; 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=R76zFHA7mBI1q9eoSi77GT88w0pRMf4EdgqOQ6+Tjq0=; b=QNtq/mT5N1vIF9XhdKCDrQPRMa369gv7Hdks1PkJPHVc65WUyyEUQfflFu0WSf2sS9gSHMpVHXh4Fv2yJDKEtwdRdh7+VWN31E5KH1DJx83wpWlX4bxwa0/DjwVp8u7DIogPjgIUJtIIFNOwAWBYK+tGkvN0QFfoUFVoXkyAwAQ= 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 1769540099466928.6753060539663; Tue, 27 Jan 2026 10:54:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkoCm-0005JV-T0; Tue, 27 Jan 2026 13:54:24 -0500 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 1vkoBl-0003DO-Ts for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:26 -0500 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 1vkoBk-0000lD-F1 for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:21 -0500 Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-371-Hg6ujGI0PQecGQG_gwah8A-1; Tue, 27 Jan 2026 13:53:13 -0500 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-88a2f8e7d8dso202978546d6.1 for ; Tue, 27 Jan 2026 10:53:12 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-894d3740e54sm2338466d6.35.2026.01.27.10.53.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 10:53:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769539998; 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=R76zFHA7mBI1q9eoSi77GT88w0pRMf4EdgqOQ6+Tjq0=; b=ZqiDWYqO16Zx8bj3mt3KgUcaIkvsyR7zZ6KA7vwPdSjbb750Cn7EpixXMwxbx6DWLhhypx bWoSRC5tqDE5KaAcEaV1oQMoN+WSpZqRcV9xHtdMxUu596vxfUFiIG04T1uKgy18ThJK8I a2Q6PPieqzjMAC9LIq+lv6yb3Rg5fwQ= X-MC-Unique: Hg6ujGI0PQecGQG_gwah8A-1 X-Mimecast-MFC-AGG-ID: Hg6ujGI0PQecGQG_gwah8A_1769539992 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769539992; x=1770144792; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=R76zFHA7mBI1q9eoSi77GT88w0pRMf4EdgqOQ6+Tjq0=; b=BLWYZhOPB7NmIopIkRJSqPk4PH/FZv9oHC3oUaO1hneM/jUGC+YdaNm3Bl4vtCsyEt pJddm5TqiSddpZ18s06ZeMGBjr9Jp1oOhpMK/FQtcGb/HZG9Qa0/CnfrN6cfTGSSWb0g 0QW0sLyuTHXmBJRpAEbnaWKKtLoTyycxbdHcVFYs53CslMLdtBI36eJb5YpwHujXdZD5 ei1anH1kth9xOThlYVcmXYFSOC7KLhpkFeavDuPZrkmzKzTtA39tvRaoW73IXtHYjQ8i L2jeVQAImWUtnzc0MzoXpcADOVXUw573EKArMTh6tB32vIKVDY+WlfOAVktoZJ20iJrm uivA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769539992; x=1770144792; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=R76zFHA7mBI1q9eoSi77GT88w0pRMf4EdgqOQ6+Tjq0=; b=eCqdoWxAcmcPj0n/ImWo5ybUDE6XKxmAZz+fHJzeUJoSS7SqC9s3o7fZfKoeTf1Vsg QyJ2M3O/SLqHJJ8WJk/Tikma5F2LUFcLqhBeK4gjHoB/OkaPexjE0LpmqOLzl5eJRRDD SsYIYziEDTMl2uLxO6tdC/iZFMKY5nOkaBae7QaKzoB9Vs4hVNYyq6UCSpjJVdyaFROz oVmgcPZXDcFhBuxLG2BefEFg8yxyzcsFkvUKraZ1otUICGZGojJAHKwPnxMUS3nsFs13 rELa91L38kGdyizZIB4+q3PBzuFNVn+2FRYn0fbgnAgoBb7NlGHgVihDq5xhZFHVgUJw ZrGQ== X-Gm-Message-State: AOJu0YzZigxEIytCHbEiB/q98mMTyr2p7dT384PouXC2vJRV8USCe8IX MU7NVZffLj2Vl/3B75icD8jOtcJbjbbFoTyTyAbIRX123F9smbEYyMviFhQRoopc6Xcmuquq4h/ YZn3CS2gzKMkvIHOg3rZFLbpjP7KDm1+8Nv2Gz0ZHM7aJhD1/GtLMiVIlImY7ZlK0ifOzHlYau8 4X3QDd2TCMdScqMn2EEekIdZ5/kAfAo6t/M2/Myw== X-Gm-Gg: AZuq6aLjcBJD0e2M+TT9KUnX6Fhoh7GdChehiTB2pDo684D2OwBiqKuMUQJzM2rKMsr QJaO8tOM9Nak0Mo81/tEZ/x7Gt4PiVrUwrJZeDfTyXbF4SqqMWJ31ogX4j1qyKbCgRj66Tlb1XW hQnzPsL8iHvrQa87zfJLRuDVEEATWnOAEEEPq462v4WNZ97ry46BYRiYH4JRA1f7bjVLHhAtIk1 DDerwudKNvOHHXXYu2gyogp70FqfkFkp98OPd4ld56P5UzahXHMb93Hwc641BesVELsJ7YeRThB 6qBxpsrtzj77jPv8fG6PLudz7gLOtVoAEgbzQMMe+5U0VLPzuGuiIWYpyy1exbjUiUJQNa6McEc n X-Received: by 2002:ad4:574f:0:b0:88a:2444:36e9 with SMTP id 6a1803df08f44-894cc9788bfmr37281626d6.67.1769539991937; Tue, 27 Jan 2026 10:53:11 -0800 (PST) X-Received: by 2002:ad4:574f:0:b0:88a:2444:36e9 with SMTP id 6a1803df08f44-894cc9788bfmr37281166d6.67.1769539991474; Tue, 27 Jan 2026 10:53:11 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Lukas Straub , Prasad Pandit , Fabiano Rosas , Juraj Marcin Subject: [PATCH v2 13/24] migration/postcopy: Send device states without copying buffer Date: Tue, 27 Jan 2026 13:52:43 -0500 Message-ID: <20260127185254.3954634-14-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260127185254.3954634-1-peterx@redhat.com> References: <20260127185254.3954634-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_H2=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development 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: 1769540100694158500 Content-Type: text/plain; charset="utf-8" Put buffer can be async as long as the flush happens before the buffer will be recycled / reused. Do it for postcopy package data. Quick measurement shows a small VM the time to push / flush the package shrinks from 91us to 38us. Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas Tested-by: Lukas Straub --- migration/savevm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/migration/savevm.c b/migration/savevm.c index 9d2109718a..d41e89228d 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1136,7 +1136,8 @@ int qemu_savevm_send_packaged(QEMUFile *f, const uint= 8_t *buf, size_t len) trace_qemu_savevm_send_packaged(); qemu_savevm_command_send(f, MIG_CMD_PACKAGED, 4, (uint8_t *)&tmp); =20 - qemu_put_buffer(f, buf, len); + /* We can use async put because the qemufile will be flushed right awa= y */ + qemu_put_buffer_async(f, buf, len, false); qemu_fflush(f); =20 return 0; --=20 2.50.1 From nobody Sun Feb 8 20:28:47 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=1769540072; cv=none; d=zohomail.com; s=zohoarc; b=aAQZjyTn/DDZzDijRI9ZB9YG27w0ZkyVq2iVCqA9r/DxskhmzQzYrzv/9JpM5IMFIB0PyHaRTtio4wqxwRcNT7bFHUqTBpyjTTwIgYUOK7gFD7YNFpNZHvAd7Xy91JhlGPt3FO5BwfUogbqeCdU1sNf0QwU5j6xbx+s7YwJd4LU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769540072; 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=MDMVKTHdAhPweTPnMeympx3V8z4uq5Hbee97R017RKk=; b=M3UbALJO4tiSrWsYPER7SBgrZoaeYKbC61n6eWIcOA52qiMBKc6IMDnp5pSje+gs7yJm4xrRTGgzTDcL4knqxx1+7NQ3tdBNHPQGUDjk/EafTSAKZUkZaXETwodpm3uMsTsbhmkM37xPAanhFvoy3T7Rv7c2oYAkX2Sb6SUK2cA= 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 1769540072266728.0812143218782; Tue, 27 Jan 2026 10:54:32 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkoCg-0004Yg-Pp; Tue, 27 Jan 2026 13:54:18 -0500 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 1vkoBk-0003Cp-JT for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:22 -0500 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 1vkoBf-0000kV-UX for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:17 -0500 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-517-0cgqNM4-NpikANkKELo-uQ-1; Tue, 27 Jan 2026 13:53:13 -0500 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-8c6a291e7faso738974685a.3 for ; Tue, 27 Jan 2026 10:53:13 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-894d3740e54sm2338466d6.35.2026.01.27.10.53.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 10:53:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769539995; 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=MDMVKTHdAhPweTPnMeympx3V8z4uq5Hbee97R017RKk=; b=VIVbZxfT4CrYC0FgGCdiwLmAloLlXoo0CFnCWlGG+i/FKdKyTRcBOUHAzu7HiVhAkwzEvv XUShAeA/MY9l2muokt3Vnl5RhsVsAV2jejL5H8NItgmSQwzjiYq/VMtn7uIB9Ig2TPnHhM 8Ud1gzB3jJ29QodRKioVsUmfI6TXeI0= X-MC-Unique: 0cgqNM4-NpikANkKELo-uQ-1 X-Mimecast-MFC-AGG-ID: 0cgqNM4-NpikANkKELo-uQ_1769539993 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769539993; x=1770144793; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MDMVKTHdAhPweTPnMeympx3V8z4uq5Hbee97R017RKk=; b=tuWfgt19ZCkR0REkzczcxYm/EdeJn5XCW0BfmabIwubEVu2rP7ZTPhEMM6QAANiRgU YSoJAT/ZdWuH9ToNFEh4UREBA0CzI/vlrincW+ydJeNNYDe+TPk8IbtwWsU+8yvAYiHS O4ErE+GPOtpFBo4FHc8y/bbW6uxf1ZpTU1RiVA8koU/JNxtzsfApL+/Za5q2vM6q2PVM n5hVehDhHWS6b1cShnOMG4c8nXBiwSapT0/nfBqJ7FQBbr6IlfEemmhgZyC0JazDL3/6 2p+WwUeD0K7F79RSP1WmDXrfuApsFtmtoD70DdmeDqGZAq9YgYdjJ38ELH8KQSKQa11s 3bGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769539993; x=1770144793; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=MDMVKTHdAhPweTPnMeympx3V8z4uq5Hbee97R017RKk=; b=A3tqzcIRCLtG7rbD1z33/d6UeRaDXtpE5WecpPj08+07jut77wvCc1pGsQhuo/80tC TeiNvO4KJFJqtBiAAth95Tp8DqNgzvHu89istV34Brubas9lf6c/1mJYRimaNYxphRfA ZWv6TBWekfjs5zLpdnRBAZzifL/ekE22z0bk/+CAgTYfRzPo46W5rxkOuwl5CUNg60sz OotRC+WVdhSww9s36/wLhnoTvYAVfKdyWbLA2Coz4cdmL572mJZUsmPFK+1PcbxRzh8j hlZed0ARjNzRw7yGMd4nDIduKCqcJhLo8St4nTY8LczMTYUdWAEHcxqTfBpzCqaH+z1L CD7A== X-Gm-Message-State: AOJu0Yw8RTC5t/HGvZimiduI+kCLxBUv/EMOk8S1nuwvh3r/UX7l0HB0 hW/X3jbAKhbkLwk2qZx5ejGwbsK0hZn2FNE+FGcQDkMHXD+gVhVOIxOjI5ARQp6M8GgNPWJsgic 4yGkRB5eybhsWKxT5HhU2zTMxGFXXDo1JhGtoFzkwYabYr85K3BFs/HeQR+bVS69DjDi0ExUSIO YzaTMe3yCHn/uOpWfbbG+QT2vRLW5lp74O8CqouQ== X-Gm-Gg: AZuq6aJUqFGyf31GLBIlYIJ/g1Jw8WVlk++DJmy17/iXwqCgjhpV+ZlcRp9sL1b3/01 QLzJ1uQ7WuLgkwNQmGgQ8uDcen5o+Anq4Bw0eaHWimM4IC3iKfwz5hClOXckmf3wnHbW1VdLOeI DrmlwvNlCyF+y8TXts7w2xrSfOE6Omki1GQ1DpobgeI86xsx7+Idw31wnbPthjHHuZjdnGuRKZv gT7QCMS23RFno1Eck49CLasbNSOKdVRTnBXUwa+O7r/+spycxv4IuPWjpZy/WQK4SDncRXjV0ed agTSgEQ0yOjlQnujAB0Idrd/RhGPraJA1Yu8FNXaq9AUzD2QV/tqz45N+R4qHvPjFWfW8KsFWBQ i X-Received: by 2002:a05:620a:4888:b0:8b2:6443:8401 with SMTP id af79cd13be357-8c70b9279f7mr329383785a.76.1769539992912; Tue, 27 Jan 2026 10:53:12 -0800 (PST) X-Received: by 2002:a05:620a:4888:b0:8b2:6443:8401 with SMTP id af79cd13be357-8c70b9279f7mr329379385a.76.1769539992382; Tue, 27 Jan 2026 10:53:12 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Lukas Straub , Prasad Pandit , Fabiano Rosas , Juraj Marcin Subject: [PATCH v2 14/24] migration: Introduce qemu_savevm_state_end() Date: Tue, 27 Jan 2026 13:52:44 -0500 Message-ID: <20260127185254.3954634-15-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260127185254.3954634-1-peterx@redhat.com> References: <20260127185254.3954634-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_H2=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development 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: 1769540073985154100 Content-Type: text/plain; charset="utf-8" Introduce a helper to end a migration stream. Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas Tested-by: Lukas Straub --- migration/savevm.h | 1 + migration/colo.c | 2 +- migration/savevm.c | 12 +++++++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/migration/savevm.h b/migration/savevm.h index ea01ca63ec..d0596d1d62 100644 --- a/migration/savevm.h +++ b/migration/savevm.h @@ -49,6 +49,7 @@ void qemu_savevm_state_pending_estimate(uint64_t *must_pr= ecopy, uint64_t *can_postcopy); int qemu_savevm_state_complete_precopy_iterable(QEMUFile *f, bool in_postc= opy); bool qemu_savevm_state_postcopy_prepare(QEMUFile *f, Error **errp); +void qemu_savevm_state_end(QEMUFile *f); void qemu_savevm_send_ping(QEMUFile *f, uint32_t value); void qemu_savevm_send_open_return_path(QEMUFile *f); int qemu_savevm_send_packaged(QEMUFile *f, const uint8_t *buf, size_t len); diff --git a/migration/colo.c b/migration/colo.c index 0b1a58cd8f..db804b25a9 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -470,7 +470,7 @@ static int colo_do_checkpoint_transaction(MigrationStat= e *s, * to be blocked here. */ qemu_savevm_state_complete_precopy_iterable(s->to_dst_file, false); - qemu_put_byte(s->to_dst_file, QEMU_VM_EOF); + qemu_savevm_state_end(s->to_dst_file); =20 /* * We need the size of the VMstate data in Secondary side, diff --git a/migration/savevm.c b/migration/savevm.c index d41e89228d..a787691352 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1065,6 +1065,12 @@ static int vmstate_save(QEMUFile *f, SaveStateEntry = *se, JSONWriter *vmdesc, } return 0; } + +void qemu_savevm_state_end(QEMUFile *f) +{ + qemu_put_byte(f, QEMU_VM_EOF); +} + /** * qemu_savevm_command_send: Send a 'QEMU_VM_COMMAND' type element with the * command and associated data. @@ -1555,7 +1561,7 @@ void qemu_savevm_state_complete_postcopy(QEMUFile *f) } } =20 - qemu_put_byte(f, QEMU_VM_EOF); + qemu_savevm_state_end(f); qemu_fflush(f); } =20 @@ -1699,7 +1705,7 @@ int qemu_savevm_state_complete_precopy_non_iterable(Q= EMUFile *f, =20 if (!in_postcopy) { /* Postcopy stream will still be going */ - qemu_put_byte(f, QEMU_VM_EOF); + qemu_savevm_state_end(f); =20 if (vmdesc) { json_writer_end_array(vmdesc); @@ -1879,7 +1885,7 @@ int qemu_save_device_state(QEMUFile *f) } } =20 - qemu_put_byte(f, QEMU_VM_EOF); + qemu_savevm_state_end(f); =20 return qemu_file_get_error(f); } --=20 2.50.1 From nobody Sun Feb 8 20:28:47 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=1769540067; cv=none; d=zohomail.com; s=zohoarc; b=OYid198eu+kuFJsT67tSsY5nnl3XNUGdhhqPXgbuI1txPDqfxUDbSelZAoJKedn8RQ8tCL5fYP8Sed581qFwkVhAcGXtgGSzR2NfLQjGcQhhbnT8Mxy35nN2HGJqPG2SidCsloqXMTCYD5LYrMOf56GloMjR3epLF341CXO10hQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769540067; 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=W1Qr5M0mON7SSJ+40/8rnC3mGubJewstthZcpwoPxcA=; b=VZoh0SWkNNgO0gKWNGqoLUPAau2uEat7eIBJ3tdtMOybJSUUn2zJi5jZl8gEFJEK8YWSqxlhQKNGbmRgmaKL0xGcWa+ZVPdrLAXzxbshe1fKkehj+yImSssx65Yq9qFIrZLBB8azzv1YAhjE2BqMELM/QEd93OY6rY17N7XQIMY= 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 17695400675461020.5163252519108; Tue, 27 Jan 2026 10:54:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkoCi-0004rr-IC; Tue, 27 Jan 2026 13:54:20 -0500 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 1vkoBm-0003DP-0u for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:26 -0500 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 1vkoBj-0000kp-Eq for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:21 -0500 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-153-Qw2sFSLJOoKGITrQFuwSmA-1; Tue, 27 Jan 2026 13:53:15 -0500 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-502a13e3e55so241636291cf.3 for ; Tue, 27 Jan 2026 10:53:15 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-894d3740e54sm2338466d6.35.2026.01.27.10.53.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 10:53:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769539996; 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=W1Qr5M0mON7SSJ+40/8rnC3mGubJewstthZcpwoPxcA=; b=iPjndw2qmOCaZdzjnfst08o1zL6umov65JsjKUfloa8GkHjj2299Ga/+8xANfhsyPnT1ko R8ZsFD7726TGTI5eGfFhnzidIZs9GolDKA9TCBW+oY1HmlZgIcLuIvv3mOsr604viBByQo nuGcppGGe/SU4if9X4YL23fewTLPQIc= X-MC-Unique: Qw2sFSLJOoKGITrQFuwSmA-1 X-Mimecast-MFC-AGG-ID: Qw2sFSLJOoKGITrQFuwSmA_1769539995 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769539994; x=1770144794; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=W1Qr5M0mON7SSJ+40/8rnC3mGubJewstthZcpwoPxcA=; b=S+dgGA4Z/0nqZM3eBEbVTdMZXnJ9IZjArSwgnvnbfL9iTsf+XlGMcUyxU5Yxf2A1IF b4cE2god2BdZ0Fb3LVoxqHDzXhdB6jtoUQqkr4Zp5Bo9gQA0ojX3gxko5DdedzWLNZjK RCilrVbwhHgqZ6digPtiiQ4gF7kuv/Vz+wqpHYWJLlO+tzoyf41olp4cEsFqFQlKDvsR NIQ1Gvt4YTZMGWWMBdRQi8sM9QlQB16v3AGBpRbbYh00+REoSpf2fFId8UMesom++bSF WqqT+XFEfeJMgpWAAoonRlHwfMjtK4z3hA6vi4wrFmPyiZrbS6swJ/kaq5eHJUhNqyUF 3DSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769539994; x=1770144794; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=W1Qr5M0mON7SSJ+40/8rnC3mGubJewstthZcpwoPxcA=; b=DMtU3F3pCyntcdwPLjC9UP8rYwV9VbA8/P3mVmaZ/IWcNlelsVK9Ez3eG4suSO+/1w VPov88GhdPDZhrzzKYDCOimamyERXkA8GL03rK71Y2wYzgpPz6QDHebAnVZ2nVi6+SSd RQxM9S7Z3TjuPISfhvHo7yqbbebY4rTH2cQPJfCvVCVQp0WouNZICNMQ1fZeCh8Tzw1K EVJAqZ9XT04xJoAb7IVDO2zC/itSkzn9d/+GiM4etbvGpqxaKdpxVSS5OuzZEhwdhZCP NBJbWtF0k+ErojM2X+6xT59UNxVpLKmwTbK5ql/QBefF2E08nCZr8rKSz8sgqDjOOCTt 7Rfg== X-Gm-Message-State: AOJu0YxrJaXmNJW5dG+EmUe/b9BX1KD+KdRo1ZkZtDKYFpyEdvxMNdbC PZ1N4PckZeHt2LzceLwLnhoTRmFcusaJMkCRReCpjht1+EF3SXwRGH8uJ6ZTWcj5QIB1gdLo4tf tDaflsRX/bnTczAnT4mD7Nbp3F0GXAxo+WeXWwXsV3YoX84Zsmdx4vUnrgtJEgBIH/3xaBemx8M GpXsWuRm4Q+vbmgRVSQqgraqq3iPcJENUFrobTFQ== X-Gm-Gg: AZuq6aLhKni/wzUFLJ9Posr3RfsFk5OA2+C6sjxZH326qHuPC+hU/sToxA61Sy3DuWW ApaGIxhZ8kWQgTvLD2VLQrroFn0/NSIgW5Ie8ikUvbADL1sJiic7NqAWgOJV5UqnDHmtLDmU9G4 5p2a1HdELgJ4B897LWt64CJkXFVqSASiMemH8CB5BbJ4J3NCU0yPawDCqJlYNUxp3u7d9cJHaG5 k2pCaRWZkVKC1v/N0CmwsMj5z9OCEpXKu7E7qWjtFbItE+yhVmEErCFloVbzu6rLcv7+4OHYZ1Q 4OgMDSpDKv9jkS5elEMDs9m+KfvgjbdRmNEAJAclq6f9Nk/N98lGeoSEt1KT+Q55bXxWZ0MyzvA 2 X-Received: by 2002:a05:622a:1b8c:b0:502:8fb9:530 with SMTP id d75a77b69052e-5032fe1a2f8mr33579961cf.79.1769539994320; Tue, 27 Jan 2026 10:53:14 -0800 (PST) X-Received: by 2002:a05:622a:1b8c:b0:502:8fb9:530 with SMTP id d75a77b69052e-5032fe1a2f8mr33579641cf.79.1769539993867; Tue, 27 Jan 2026 10:53:13 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Lukas Straub , Prasad Pandit , Fabiano Rosas , Juraj Marcin Subject: [PATCH v2 15/24] migration: Provide helper for save vm description Date: Tue, 27 Jan 2026 13:52:45 -0500 Message-ID: <20260127185254.3954634-16-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260127185254.3954634-1-peterx@redhat.com> References: <20260127185254.3954634-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_H2=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development 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: 1769540069908154100 Content-Type: text/plain; charset="utf-8" Provide two smaller helpers to dump the vm desc. Preparing to move it out and generalize device state dump. Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas Tested-by: Lukas Straub --- migration/savevm.h | 1 + migration/savevm.c | 35 +++++++++++++++++++++++------------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/migration/savevm.h b/migration/savevm.h index d0596d1d62..f957f851ef 100644 --- a/migration/savevm.h +++ b/migration/savevm.h @@ -50,6 +50,7 @@ void qemu_savevm_state_pending_estimate(uint64_t *must_pr= ecopy, int qemu_savevm_state_complete_precopy_iterable(QEMUFile *f, bool in_postc= opy); bool qemu_savevm_state_postcopy_prepare(QEMUFile *f, Error **errp); void qemu_savevm_state_end(QEMUFile *f); +void qemu_savevm_state_end_precopy(MigrationState *s, QEMUFile *f); void qemu_savevm_send_ping(QEMUFile *f, uint32_t value); void qemu_savevm_send_open_return_path(QEMUFile *f); int qemu_savevm_send_packaged(QEMUFile *f, const uint8_t *buf, size_t len); diff --git a/migration/savevm.c b/migration/savevm.c index a787691352..41560b97a4 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1669,13 +1669,34 @@ ret_fail_abort_threads: return -1; } =20 +static void qemu_savevm_state_vm_desc(MigrationState *s, QEMUFile *f) +{ + JSONWriter *vmdesc =3D s->vmdesc; + int vmdesc_len; + + if (vmdesc) { + json_writer_end_array(vmdesc); + json_writer_end_object(vmdesc); + vmdesc_len =3D strlen(json_writer_get(vmdesc)); + + qemu_put_byte(f, QEMU_VM_VMDESCRIPTION); + qemu_put_be32(f, vmdesc_len); + qemu_put_buffer(f, (uint8_t *)json_writer_get(vmdesc), vmdesc_len); + } +} + +void qemu_savevm_state_end_precopy(MigrationState *s, QEMUFile *f) +{ + qemu_savevm_state_end(f); + qemu_savevm_state_vm_desc(s, f); +} + int qemu_savevm_state_complete_precopy_non_iterable(QEMUFile *f, bool in_postcopy) { MigrationState *ms =3D migrate_get_current(); int64_t start_ts_each, end_ts_each; JSONWriter *vmdesc =3D ms->vmdesc; - int vmdesc_len; SaveStateEntry *se; Error *local_err =3D NULL; int ret; @@ -1705,17 +1726,7 @@ int qemu_savevm_state_complete_precopy_non_iterable(= QEMUFile *f, =20 if (!in_postcopy) { /* Postcopy stream will still be going */ - qemu_savevm_state_end(f); - - if (vmdesc) { - json_writer_end_array(vmdesc); - json_writer_end_object(vmdesc); - vmdesc_len =3D strlen(json_writer_get(vmdesc)); - - qemu_put_byte(f, QEMU_VM_VMDESCRIPTION); - qemu_put_be32(f, vmdesc_len); - qemu_put_buffer(f, (uint8_t *)json_writer_get(vmdesc), vmdesc_= len); - } + qemu_savevm_state_end_precopy(ms, f); } =20 trace_vmstate_downtime_checkpoint("src-non-iterable-saved"); --=20 2.50.1 From nobody Sun Feb 8 20:28:47 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=1769540210; cv=none; d=zohomail.com; s=zohoarc; b=fS8hR9qLIPrAZvkUavf9ufaBhgKXiDzCJ57/3FbJaC11DH4tY3XaTB7deyg8oklaUTIYoJpx8QDP6vAyLnNlfCojPhRNHyfTtmxJVCVHrdMiuyRq0bBypwvvXgUGTKAVJgCmNWh8bsNrvgNJpybk5d8dSaftBwZpNC31Aat4xaA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769540210; 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=11doODa03sbZjuwbDnglrajddNFqS0SpRI0bkxf3OKo=; b=ULYLHvfRlh8NqQVaRJwhE4CfxKIs9W7M4IbRV7Mt+icfVA5uaje+m3uYzdUgpyKqlq91FM7itherikCtSBMPsJkiRZPXzRkPR3UnH5hKgh1DXlZVIHSmOW3yz9ZmMLvIIWnUhh080FwAX17CNLX2gbsOLYwGmLJnHcEGBBsSp1A= 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 1769540210723858.3513158394849; Tue, 27 Jan 2026 10:56:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkoCr-00060u-Nv; Tue, 27 Jan 2026 13:54:29 -0500 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 1vkoBq-0003Fa-GB for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:30 -0500 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 1vkoBo-0000ol-Qd for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:26 -0500 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-210-ZE5LovwNOQ-WVg5ZcDWwnQ-1; Tue, 27 Jan 2026 13:53:16 -0500 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-8bb9f029f31so2158868385a.2 for ; Tue, 27 Jan 2026 10:53:16 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-894d3740e54sm2338466d6.35.2026.01.27.10.53.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 10:53:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769540004; 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=11doODa03sbZjuwbDnglrajddNFqS0SpRI0bkxf3OKo=; b=jMhrF7KyObhJWHAdG9eVaCYsIfBTvY48jUZ2p4P3jEvmOI4tNF3OLynp1/t4YD8hsfyKVQ uumaFltdEqQ6M0wR+ybo49fcaRc6javBMAqut4k3HS0nzEZ6Q6u9uNoVQ8ygsRhSW6i41T W/lZlEg+FQCLrO9ItMwNTgR9tt1C5E4= X-MC-Unique: ZE5LovwNOQ-WVg5ZcDWwnQ-1 X-Mimecast-MFC-AGG-ID: ZE5LovwNOQ-WVg5ZcDWwnQ_1769539996 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769539995; x=1770144795; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=11doODa03sbZjuwbDnglrajddNFqS0SpRI0bkxf3OKo=; b=KI0Kqy3+G5+zbQJ3e+4U2gGHlGs8Zei2BW7UBMRaLOpJWHWWF+M+hcHL/Q1We+bop7 /mz7m/GGz0N3nkxylTkUzVQ+SFIz5mzxaDbFSh3jShL/6Vsk2UBYvAatVoBibmq8fiwB bh8CZ0ImtjKFS6tI5kml0yFAZkkG9Ushz9HF9FXpK89zJMcvo+UA8S5AflSkUxQILj7T 3AG6zFhI+qHglSjikuMKC0N6cOTSMzHGyHJLb68obQxCTUI/rFc89JIWV2Ikoecs7Nh5 TBMmIwxbVvE3LpuW38AEDM11Emfb/5WrYPdRmRdYOhfZq0h0N2Bz5xov0tLALoYOr02Q wCTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769539995; x=1770144795; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=11doODa03sbZjuwbDnglrajddNFqS0SpRI0bkxf3OKo=; b=qR7ZvMFYt30PGeahS1SKIGdOgn4fSaE0hz/YxMbMUrYjPfheHYl7W/AmGpfxIDrX4g SST70hJlaFCcLHVGSyoEME2ugEnontPElvaUmlrgE3C6lCiQmW1AFjUi1meCEsVohlMN wskhwWhl0Gn5c0s+4ceML8qZyH1SyIFM1zYsvM1aLaNiY0bJ6qchPp4E86Eh7wSxq5M6 aiZiH2te9CV119VHHnIKOw7KUkJxSQB7CDGRymx5Mr8bcGYr0T2VKE6MZNAYC3fNG2l8 A/hsOIW9EcpZY3Blrc2swGj/DVMy+vl6LTckcVzI9DvaehJugEV9WD7q9HDMne6NcHHc Z+AA== X-Gm-Message-State: AOJu0Yy6hWasyFIyq5j8Yj/gHakrgY3buJfs2JfyB4XUYCWKlPVWFU22 n9DTZ3wuVRhhdxrlIglvxCnJ01McMEP62JZj2NiifdM5WgblVfeSLlFSB6Wu6xayiYhGoy0QVV2 4z/zsbnFqFoXsg5HNWfwLbw0tkrxmZt+yux/ErXrXmLdq3/uDxALEsAYWKwSMf3i/9jPVS5WUFf ZJh5tWkaJRi8hIEjpvz2efRsO137CJ7PmMMo6Dyg== X-Gm-Gg: AZuq6aKE8Jnjt00zD6PrND9bFmvP5xdpRBg23LarmZ32JJgWDcgdrUblvfQxxHZc8A2 T2kmF/zgKsfpjVflLiTa0aBzms9bLv4ZNq5T9djcK/z+4ODEhxtNkYvLMwAw0tO9gsrj58Q9gG+ sB4YW3+hNT1+6gzn2O3fgXP0ghxjC4TaC7RpuEAis+Lk8eeDkcd8+WSpEUQFICquO514RtjcF5/ e/2WJPz2V1oQ6GVFvMhQCYGV5JKwI3oO8kmRRUIzSI8oi4YkLy0LflJ1rczikpOKtADhlC3aRnI ZHfclK3QqVTgH6NkBA5SQU3ao5+PdW3eFw+6AB+EliAXWd1ZaTycIhcjkpeMgG4AcGa2QhRIEXc O X-Received: by 2002:a05:620a:4091:b0:8c2:9ff4:a8bd with SMTP id af79cd13be357-8c70b84a289mr319096285a.15.1769539995206; Tue, 27 Jan 2026 10:53:15 -0800 (PST) X-Received: by 2002:a05:620a:4091:b0:8c2:9ff4:a8bd with SMTP id af79cd13be357-8c70b84a289mr319093185a.15.1769539994780; Tue, 27 Jan 2026 10:53:14 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Lukas Straub , Prasad Pandit , Fabiano Rosas , Juraj Marcin Subject: [PATCH v2 16/24] migration: Split qemu_savevm_state_complete_precopy_non_iterable() Date: Tue, 27 Jan 2026 13:52:46 -0500 Message-ID: <20260127185254.3954634-17-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260127185254.3954634-1-peterx@redhat.com> References: <20260127185254.3954634-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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development 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: 1769540213300158500 Content-Type: text/plain; charset="utf-8" Split the function, making itself to be the helper to dump all non-iterable device states (early_vmsd excluded). Move the precopy end logic out to the two callers that need it. With it, we can remove the in_postcopy parameter. Meanwhile, renaming the function to be qemu_savevm_state_non_iterable(): we don't need the keyword "complete" because non-iterable doesn't iterate anyway, and we don't need precopy because we moved precopy specialties out. NOTE: this patch introduced one new migrate_get_current() user; will be removed in follow up patch. Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas Tested-by: Lukas Straub --- migration/savevm.h | 3 +-- migration/migration.c | 7 +++++-- migration/savevm.c | 12 ++++-------- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/migration/savevm.h b/migration/savevm.h index f957f851ef..57b96133d5 100644 --- a/migration/savevm.h +++ b/migration/savevm.h @@ -74,8 +74,7 @@ int qemu_loadvm_state_main(QEMUFile *f, MigrationIncoming= State *mis, Error **errp); int qemu_load_device_state(QEMUFile *f, Error **errp); int qemu_loadvm_approve_switchover(void); -int qemu_savevm_state_complete_precopy_non_iterable(QEMUFile *f, - bool in_postcopy); +int qemu_savevm_state_non_iterable(QEMUFile *f); =20 bool qemu_loadvm_load_state_buffer(const char *idstr, uint32_t instance_id, char *buf, size_t len, Error **errp); diff --git a/migration/migration.c b/migration/migration.c index e3f1cc7b2e..c6e54d2a3f 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2545,7 +2545,7 @@ static int postcopy_start(MigrationState *ms, Error *= *errp) */ qemu_savevm_send_postcopy_listen(fb); =20 - ret =3D qemu_savevm_state_complete_precopy_non_iterable(fb, true); + ret =3D qemu_savevm_state_non_iterable(fb); if (ret) { error_setg(errp, "Postcopy save non-iterable device states failed"= ); goto fail_closefb; @@ -3678,9 +3678,12 @@ static void *bg_migration_thread(void *opaque) goto fail; } =20 - if (qemu_savevm_state_complete_precopy_non_iterable(fb, false)) { + if (qemu_savevm_state_non_iterable(fb)) { goto fail; } + + qemu_savevm_state_end_precopy(s, fb); + /* * Since we are going to get non-iterable state data directly * from s->bioc->data, explicit flush is needed here. diff --git a/migration/savevm.c b/migration/savevm.c index 41560b97a4..e1918d4f38 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1691,8 +1691,7 @@ void qemu_savevm_state_end_precopy(MigrationState *s,= QEMUFile *f) qemu_savevm_state_vm_desc(s, f); } =20 -int qemu_savevm_state_complete_precopy_non_iterable(QEMUFile *f, - bool in_postcopy) +int qemu_savevm_state_non_iterable(QEMUFile *f) { MigrationState *ms =3D migrate_get_current(); int64_t start_ts_each, end_ts_each; @@ -1724,11 +1723,6 @@ int qemu_savevm_state_complete_precopy_non_iterable(= QEMUFile *f, end_ts_each - start_ts_each); } =20 - if (!in_postcopy) { - /* Postcopy stream will still be going */ - qemu_savevm_state_end_precopy(ms, f); - } - trace_vmstate_downtime_checkpoint("src-non-iterable-saved"); =20 return 0; @@ -1743,11 +1737,13 @@ int qemu_savevm_state_complete_precopy(QEMUFile *f) return ret; } =20 - ret =3D qemu_savevm_state_complete_precopy_non_iterable(f, false); + ret =3D qemu_savevm_state_non_iterable(f); if (ret) { return ret; } =20 + qemu_savevm_state_end_precopy(migrate_get_current(), f); + return qemu_fflush(f); } =20 --=20 2.50.1 From nobody Sun Feb 8 20:28:47 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=1769540173; cv=none; d=zohomail.com; s=zohoarc; b=htL9WY46KAL+BaLQ3ehHhUIB9RaGvEAQu9pjBkSzng+y1KVj3sO3P6D4KIYmIWKDAQUm9cWbyDYv0r4L4na01M9qGxTD0dY5yoscrKBIW1JNqxOY9z9FLbawncK7BFzblDsEQBfGVpf39e7oPIrlLnuWfqvlBs/gYHPU9HIVm04= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769540173; 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=dvoXimTzM4tcN8+c8sY9pRd+AZdXMUmsetzDVAYThuY=; b=dvuhnhY+jxXx43QLFzBXzOfODpXEiD9TB+KEG0nT/gEFEdTRFr22YSGDiBiOwfgusEP//x+TyGrNQadBphRCXvNH5G8pkpEW61UKrE6PTstUmlGJI4OA3NUReO49sRTeNTjqJPyOGP0bH6RAcHoFAtNdP6oDfxVdvO1tuW47yD0= 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 176954017316980.93968582031141; Tue, 27 Jan 2026 10:56:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkoCt-0006Jf-1T; Tue, 27 Jan 2026 13:54:31 -0500 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 1vkoBp-0003FU-W8 for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:30 -0500 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 1vkoBo-0000oN-9n for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:25 -0500 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-613--c_eT5TjMbay_vXuKv0XFg-1; Tue, 27 Jan 2026 13:53:16 -0500 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-89482366332so231962196d6.1 for ; Tue, 27 Jan 2026 10:53:16 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-894d3740e54sm2338466d6.35.2026.01.27.10.53.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 10:53:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769540003; 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=dvoXimTzM4tcN8+c8sY9pRd+AZdXMUmsetzDVAYThuY=; b=JHh3Y90fozuxaXfeU6012ZGI5t0wPl/H8aMCn378dzvge9QW7ZUhMHuy2CxOrD0HSscSmz BlwUHBZ+i5OUY6dm2jGSe6614RIqY2FZr9grmWqOZwAQ9m64VWQ7KD8XWBN5gv/3iHjRRJ +1wSnVWc7X2PXB5HYWWRC0JHx3y/ZCY= X-MC-Unique: -c_eT5TjMbay_vXuKv0XFg-1 X-Mimecast-MFC-AGG-ID: -c_eT5TjMbay_vXuKv0XFg_1769539996 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769539996; x=1770144796; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dvoXimTzM4tcN8+c8sY9pRd+AZdXMUmsetzDVAYThuY=; b=itZtSg+vMD2LPuxbPNLcDGn12TCxydyC4jB7f2WfFOR9LUm5qYYmF6jbcW2xDVtj2P Wr98q0SQ9M7dMTA0vmjeCP/V9rw5NknXgqjlfzQv+fT7FDhFsNqrIYxgieCdOT83DkDt Aq4bcuwZ2lNamaVFM95ndpi1DUGIvcfCEsxc2KzKJRS4wJ1Y7h3tl9VHXwtLtr31uxE0 fpYmqh1IGpbSZsGRFiMrN9y/xoJYLQjf2W0wCJItAirKUrxRSorXSxB9DcNWk6VsKe/w aLG5xVSBEyBt+P7rMAqLQjJ67/em924OxtNIaZSGZa+3eCk5f77te3gTLuQE7SXeNlFo Iwtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769539996; x=1770144796; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=dvoXimTzM4tcN8+c8sY9pRd+AZdXMUmsetzDVAYThuY=; b=KdDVN14N9qp5MtVqIN1MDQB2ZUbpC/sZYv6DgWSpavUmX9BAhf3L2lpwj2DWh/gDQs IS7FFR+ysdsFp5YCqnbSbszQFml2xS3A6SMyBN1gEshub5BS//h6yI2+zrXMkmB8MW3L hmbmZbf7hCaXHiLEJ++YXBdjlmmOx2COkmOcuELvoE1hjxm+K19xmeVRVaCnAOVADyal zyuW36PlRmY0F1Msi+B6FFEHbHFwMhlWwczkO86rGQyL16rHgH2qKqRFyfb7MfmenG/n KvxdSwfkIoBNTJQhBipkHxn+Glf1yW+FUonJxvxb0Lhvy3eh8ZXiwPPFE61yGcNps1eB BNHg== X-Gm-Message-State: AOJu0Yx5Ez/6wbraGfMuMjwuWT5qlO8ZYhLu3VVrAdUxhgn8QG6WqCkP NiMIe+JozuRyhYbvqqEsfxykTPuCcYDlPvcNKdNQOB1DmHSTZ04Dr5JEFzlcIcv4HGUdb6P/g3o gCYBJmB9cVl8eKDlc967Es1a447H2W4tD8Hl5ZjhwwqDCAtN86D1SySItK/WS6GIEPWx4k5CmvJ bNvPqjZdz6Lkj/0yc2YkcbI3N/AyCXzef8W/DzqQ== X-Gm-Gg: AZuq6aLaXY1ni6q0OKYr91P0EBo+nUzoh7eFCgQpMhcQ0O9l2sNOzd0LdClCm/7BNDS JmpV+y0Rrpcx8FDmEUtH2RUE3lEZ1PT6jnfHYQtRriEEDxMgxG+UMhuLNPsePrQD4s6mI0Ruq5l qHv1Cinek8JnL1IeI2WDR1XPdetWFJprjzZ2q/hlyw/ifXj863whkcmEliaGceXLH8Vk3WOAaOR 5OQ0/UDQteNRvIZfVkAZ0jhc1A9hgizC6x+cB6FmawZ3+o8OHGxbHUEIuuchJ+Vln7zdjOPL50c ZG8EjqujIPGq8RIRtUPTHZpyosNly75+tUCZmt5vTSlq9eQjAVm1bxm9TCt+B1wyGHPOIpNVhKS R X-Received: by 2002:a05:6214:76a:b0:87f:fbe1:2c2a with SMTP id 6a1803df08f44-894cc7ff3femr39621646d6.26.1769539996131; Tue, 27 Jan 2026 10:53:16 -0800 (PST) X-Received: by 2002:a05:6214:76a:b0:87f:fbe1:2c2a with SMTP id 6a1803df08f44-894cc7ff3femr39621326d6.26.1769539995647; Tue, 27 Jan 2026 10:53:15 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Lukas Straub , Prasad Pandit , Fabiano Rosas , Juraj Marcin Subject: [PATCH v2 17/24] migration: qemu_savevm_state_complete_precopy() take MigrationState* Date: Tue, 27 Jan 2026 13:52:47 -0500 Message-ID: <20260127185254.3954634-18-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260127185254.3954634-1-peterx@redhat.com> References: <20260127185254.3954634-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_H2=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development 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: 1769540175521154100 Content-Type: text/plain; charset="utf-8" Make it pass in MigrationState* instead of s->to_dst_file, so as to drop the internal migrate_get_current(). Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas Tested-by: Lukas Straub --- migration/savevm.h | 2 +- migration/migration.c | 2 +- migration/savevm.c | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/migration/savevm.h b/migration/savevm.h index 57b96133d5..bded5e2a6c 100644 --- a/migration/savevm.h +++ b/migration/savevm.h @@ -42,7 +42,7 @@ void qemu_savevm_state_header(QEMUFile *f); int qemu_savevm_state_iterate(QEMUFile *f, bool postcopy); void qemu_savevm_state_cleanup(void); void qemu_savevm_state_complete_postcopy(QEMUFile *f); -int qemu_savevm_state_complete_precopy(QEMUFile *f); +int qemu_savevm_state_complete_precopy(MigrationState *s); void qemu_savevm_state_pending_exact(uint64_t *must_precopy, uint64_t *can_postcopy); void qemu_savevm_state_pending_estimate(uint64_t *must_precopy, diff --git a/migration/migration.c b/migration/migration.c index c6e54d2a3f..b8c85496f8 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2752,7 +2752,7 @@ static int migration_completion_precopy(MigrationStat= e *s) goto out_unlock; } =20 - ret =3D qemu_savevm_state_complete_precopy(s->to_dst_file); + ret =3D qemu_savevm_state_complete_precopy(s); out_unlock: bql_unlock(); return ret; diff --git a/migration/savevm.c b/migration/savevm.c index e1918d4f38..830d8e5988 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1728,8 +1728,9 @@ int qemu_savevm_state_non_iterable(QEMUFile *f) return 0; } =20 -int qemu_savevm_state_complete_precopy(QEMUFile *f) +int qemu_savevm_state_complete_precopy(MigrationState *s) { + QEMUFile *f =3D s->to_dst_file; int ret; =20 ret =3D qemu_savevm_state_complete_precopy_iterable(f, false); @@ -1742,7 +1743,7 @@ int qemu_savevm_state_complete_precopy(QEMUFile *f) return ret; } =20 - qemu_savevm_state_end_precopy(migrate_get_current(), f); + qemu_savevm_state_end_precopy(s, f); =20 return qemu_fflush(f); } @@ -1841,7 +1842,7 @@ static int qemu_savevm_state(QEMUFile *f, Error **err= p) =20 ret =3D qemu_file_get_error(f); if (ret =3D=3D 0) { - qemu_savevm_state_complete_precopy(f); + qemu_savevm_state_complete_precopy(ms); ret =3D qemu_file_get_error(f); } if (ret !=3D 0) { --=20 2.50.1 From nobody Sun Feb 8 20:28:47 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=1769540066; cv=none; d=zohomail.com; s=zohoarc; b=BoH/9FAEB5EZnCREWkEeioEgNTXDtDCrUUiPls4lfP9sXZf/8IJUOIiiEt28NZWfazPr8RSufOZ2oOBPPx3X9o3k0MrylTQI+EnHfcT3wEE+t74Rvlv/7mnK4wqGmVkBbDdHCXRQEOQTQMzckEthmuH9ORlWyJygtv+P68N0ZP0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769540066; 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=2DzRQVM+Yn5+P9vBYO5JpvhQMbQW7zOc6oNfGNETZrg=; b=kyc6/pcJMJZkQwNjhQfkv7p4ropp0XZPZR0a9ecaDodFymfVk8+e4mhqoKNvce12U29pHKGeVldyOmp/ai+0srCt86sqBTfVelPDMIr3PG0hdts6wQMGC8clwlLzlGAIUeoZloVRxOqG0wmYg5aVKJL+howApF5HiZCxyOGW0No= 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 1769540066985664.101703958171; Tue, 27 Jan 2026 10:54:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkoCm-0005JF-Ui; Tue, 27 Jan 2026 13:54:24 -0500 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 1vkoBo-0003Dr-7b for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:29 -0500 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 1vkoBm-0000nv-B1 for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:23 -0500 Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-641-SllwvqYNO_eKKRmxziQzYg-1; Tue, 27 Jan 2026 13:53:18 -0500 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-894971e3b60so160435506d6.2 for ; Tue, 27 Jan 2026 10:53:18 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-894d3740e54sm2338466d6.35.2026.01.27.10.53.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 10:53:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769540001; 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=2DzRQVM+Yn5+P9vBYO5JpvhQMbQW7zOc6oNfGNETZrg=; b=WlhnwRmYLpUX5NZwCCCDKqy4NlLRv89sFG2kImZ6C9mxiq2mUCAALPKW2WPfQRGL7iO2X3 E7dpw6p1Chmy17r3zY80IDSt4cw8IzCTG59r5DtXkPgy5kbu63fmiOHsoPx7OMt0hPvWcd GEQ3Bh/q34raARXGZ4oqMfa1NINXQ0E= X-MC-Unique: SllwvqYNO_eKKRmxziQzYg-1 X-Mimecast-MFC-AGG-ID: SllwvqYNO_eKKRmxziQzYg_1769539997 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769539997; x=1770144797; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2DzRQVM+Yn5+P9vBYO5JpvhQMbQW7zOc6oNfGNETZrg=; b=RYi1J1J3GK83NmwwQ4AIo/r3UGjF3fcBBFmMt1JaceGfr/49Oi/HaDcgi7naY8Y+rK c6LbKW5HIBS232BexLg5R9jSCMe9BSUe+lmQ7rpuzfvOAxmLbefCxOrA3JxHRWKPiIvd sm7/jX6RYWnlkSwY24dj+1/vwa18YY3v63kVS46+jfG/WtrR5gYq2tFtRd26E2NAvkjg WC2VQOKrwu4G5+YGJRV/mC/EHtXXoO/okdLJmOP+56W36jVV8f5zCBPr4o1Cpj7XNeK/ t8/ApTsuJCcKE63mVF0zLhCLqk0lRAqLtsUFJSdHulWnh4WDL4QWAV7c0aT3nBqFWudf PKBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769539997; x=1770144797; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=2DzRQVM+Yn5+P9vBYO5JpvhQMbQW7zOc6oNfGNETZrg=; b=l+uwk5Lgz3XlITQyYhc/Nu5GMRYZ6nVCgqiVBW1w9ZYE8920PnQN63R3FavA7Kn/JV m/AIHtbAnvKW79JtaQRsQAReAWVHmOMtFKUvf2WUiBXOvZvUKgftWauqHI4UJQBVDiNt VA3GNg61h082qqhT1l3zN6/sNYqxtENjHjnzCaVk1gv5ot5sU4NJEZd5dhX6fII1HwNR soO8g5EqCagWpw+mlEqOvldcIPVwv3FifgcOoeQ0n/Q9DJ6ntkZCWbq+5keZJTY1SCKe /hwrZdTXP851QjCgTRjhmswXTxv80E+ICThwLCz3CwZMdTXOhlLETig1v/MuPSUYTIqY 8XBQ== X-Gm-Message-State: AOJu0Yzma0dmM4E9/WBQvc0JpCQaEaRUARSTUhhLeEeKmJw77nu0Wydi dDA/3LgQNo15Y+2SVfRkfOfZOhCXzIqCg7hqF1SwXN3iLCAYCmSYBfBUNkcPqwkRbC5sejS6ccM MEV4VtMtML4KEW7xK4cRBd0wT9B5LMGqFVz/B437aQd9tchqspwvhvwzQK4EizNT4TqqWFjJnS6 hPwy4yLvcaK89GdQsZ+Q5v2ydgJDf5Y0WUrc85bQ== X-Gm-Gg: AZuq6aItmEt2pzoCJ/yESLR3Ee9S/yItzUf4d66BIzl2p6eVXcAXXqeAbO9/agzV03u 0hgAfVgGH7AJTV96ZD/HGQmW01yRcG7Woy4nXXdU9tiGGBTKXsiOwzltrWX8ceJwF7GLGFS6VRd 4Uy6BxoCHPt0fngwd2DWGzsojI31CakOBf4epmNu31tw7Rs8a6igkGfN1s8+WMqtMB3A3FznxyL u/mKuX0PKNfl/v9Mmtwc0plukusB9u1tQ1v1jvsWV7C5U2voYojPqoj37IKt2Z4a6LB3X6b0D0T WKjZPwgLg5YZRzpiPBSRjaDCtN4o3jNQ/tksn2kzRDtnxb4i7am8uAN6sLBUujocgwuaySo49No 4 X-Received: by 2002:ad4:5de9:0:b0:888:4938:49e6 with SMTP id 6a1803df08f44-894cc9910c3mr38227676d6.70.1769539997064; Tue, 27 Jan 2026 10:53:17 -0800 (PST) X-Received: by 2002:ad4:5de9:0:b0:888:4938:49e6 with SMTP id 6a1803df08f44-894cc9910c3mr38227326d6.70.1769539996566; Tue, 27 Jan 2026 10:53:16 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Lukas Straub , Prasad Pandit , Fabiano Rosas , Juraj Marcin Subject: [PATCH v2 18/24] migration: Cleanup error propagates in qemu_savevm_state_setup() Date: Tue, 27 Jan 2026 13:52:48 -0500 Message-ID: <20260127185254.3954634-19-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260127185254.3954634-1-peterx@redhat.com> References: <20260127185254.3954634-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_H2=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development 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: 1769540067959154100 Content-Type: text/plain; charset="utf-8" We did two unnecessary error propagations in qemu_savevm_state_setup(), on either propagate it to MigrationState*, or set qemufile with error. Error propagation is not needed because: - Two live migration callers ([bg_]migration_thread) will propagate error if this function returned with an error. - Save snapshot (qemu_savevm_state) doesn't need to persist error; it got returned directly from save_snapshot(). QEMUFile set error is not needed because the callers always check for errors explicitly. Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas Tested-by: Lukas Straub --- migration/savevm.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index 830d8e5988..0683a103c8 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1385,8 +1385,6 @@ int qemu_savevm_state_setup(QEMUFile *f, Error **errp) if (se->vmsd && se->vmsd->early_setup) { ret =3D vmstate_save(f, se, vmdesc, errp); if (ret) { - migrate_error_propagate(ms, error_copy(*errp)); - qemu_file_set_error(f, ret); break; } continue; @@ -1405,7 +1403,6 @@ int qemu_savevm_state_setup(QEMUFile *f, Error **errp) ret =3D se->ops->save_setup(f, se->opaque, errp); save_section_footer(f, se); if (ret < 0) { - qemu_file_set_error(f, ret); break; } } --=20 2.50.1 From nobody Sun Feb 8 20:28:47 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=1769540073; cv=none; d=zohomail.com; s=zohoarc; b=WKZPE1R7hzj2q3o6pHuwEO9lEU5KqIjUcKx0NsV3ZrRerrc3HJ2Kqj63oLDz5FDYclw2nTt69V4/yKm0X50wu0G3u5DSVmdZoJOv3LYmdQI87WNys06PlJHND/UHCyUQgcdTljbPMGwOJ92t03Y7OI9hDGYM2nK09VBV2NQ0TwY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769540073; 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=ZNDhsqkpTzBpXh+tonhVJQSyR6a5H/fOQEVAtUlW7O0=; b=e8+r/PeozithcegY2w9IKPTQoYN04tLtca+ZFqZQI4bPEjlndUdnVoeR3RUAG8QVOVrJVD84XJkuSRWQHNMgzZ/SfYVvodvy3lEFE/qgZxGQgB/BM5/mtC2sACA7Hrbqt4ugrVByfP4Txo0IjABFIAmKfn5QllWf3HL2ovbLAdU= 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 1769540073600225.01241265105796; Tue, 27 Jan 2026 10:54:33 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkoCl-000592-FB; Tue, 27 Jan 2026 13:54:23 -0500 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 1vkoBo-0003Dw-Gn for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:29 -0500 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 1vkoBm-0000np-2p for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:23 -0500 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-389-NNCBNYbXOA2zGav5jpP-MQ-1; Tue, 27 Jan 2026 13:53:19 -0500 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-8947d47793fso313931366d6.2 for ; Tue, 27 Jan 2026 10:53:19 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-894d3740e54sm2338466d6.35.2026.01.27.10.53.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 10:53:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769540001; 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=ZNDhsqkpTzBpXh+tonhVJQSyR6a5H/fOQEVAtUlW7O0=; b=bA/PeF2gLh/c6O6OV+kgAb3OqlivVY1w5bC6u2Rz1WyG97E0QmxY98vS605Xq2rZAkIgBs bAXZ4WwdTySXBuVzdpN3jtqvdtMdb92/ysCpe2vqq0YZyK4VVgP59X8orYgJ9m5eJkwxGh cmR8WK0LtXxSmxp9CKmyGdg6g3uXiIA= X-MC-Unique: NNCBNYbXOA2zGav5jpP-MQ-1 X-Mimecast-MFC-AGG-ID: NNCBNYbXOA2zGav5jpP-MQ_1769539999 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769539999; x=1770144799; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZNDhsqkpTzBpXh+tonhVJQSyR6a5H/fOQEVAtUlW7O0=; b=TjimngkpjpxMZPcjOI69dNf+wiVi6h0tJuzQvFHrvtAQ9Nw+foMWjyC3hBj3Szfttx OtZQqsrAYcRpjMizJVNtujxhRZdKgJdd8kLv7XTO9WOpl5aiw9YsQf29xcr/iKbE+hwa 1Fs6I+wO86k5WBeRBoU7IiIRoAuChDEq/Au72hyYwJ0iO9iMvl6H0Y8a564viaPfNIq7 NVTijzpyzkYSEDcyTiQ8qH4ly4QR/aNxOYgd8L4AyNILzt4MeHuIllzoAf3gRhT6trQN +09CPqRhDFEVY9oJtfBcYfM9YfZG3fyV7NT3SIpdZ6GX+wH5Eu7gODco/dVeuiB4zdzn n6aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769539999; x=1770144799; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ZNDhsqkpTzBpXh+tonhVJQSyR6a5H/fOQEVAtUlW7O0=; b=rsrA4dWqOISDVn0NEN/sbifwTTd7UYJw/N4GBdiKa2Je3Pz+UIuEAxlWoVKo/vsBLl 2l3Y4NwqDHaWeDsk2BluHUcvnL+cjkQLzPdjZ7Bp6vtPxvs/f/G3W3qb7c4pxilPjNTq qlR9yTfmAdBo2JfAgRpCQjIFQ2c6EEY4H52B+8mh4Hs8n8JamnspptO0pN3fHWADDpiR j6tlu5iUyqFD1alsRcVW3UHDXI7jxZkw77YBioGg1e0nw1RqX/VAyEX+QgEj12EslOBv Z6WYST2/zqebcgWGaI7esNSXgZ1cM5FV+dLpT1Sp2d4oro6hyQ5eIdFJRFKy+8BPHGx9 6fjQ== X-Gm-Message-State: AOJu0YzXBB2JsSUMgXka/CuQZl2W55F/e5J73rZbJbZOi1K32iJjtjuD rJQQiY+U+U+QkHHy/1mRr/zrvWUaTurrNgUpgdOTwR8DqL9/l1qdYO8WA8RHv3NfnmM7+vqHBI5 XvkR0Xr7idVVgARIASW+UrkOtS0ZEuIUYGaWTm2gXnPK2VkWUvRYh4PZ92SNomYlTQYOudWnd+L luastDA1y+IsT/Dgnv3CqBIy7P167YnolPHg6x1w== X-Gm-Gg: AZuq6aJzPmz9n/M+d+hzZ+n8RMQyKROfRVCtCJSAZQWF1KIs5vL+EIr1TS02AbE3xJI oXdaWWjmUpbJzVHIIpuVe5S9OgQEXD7HIlMTB4LIYKd2hKsPSXC6BO/iNRN6h2tjsgNYfn6RqND +/PsPHiIPC/zW8fp25DWYIiAo/Da6Kz46r2e+/3B9AXEBeSFJiTPjlb5LD25yVnOHQlamv1jedd jLXWJWSB650Yy8bzD6MIqq3PCdCETwHurwoOcv9GonDNQamkhf2OlLuuTnFFBB9P37qozVt38xN tsMNuwkNKb7z9Xs1rovUwhsM2aXRhrkROlJFI04kewfSLMQiLM12sSl3bOTMbNjx9dTlOPvplbm + X-Received: by 2002:a05:620a:4405:b0:8c3:528b:1b10 with SMTP id af79cd13be357-8c70b932fcdmr364398385a.90.1769539998682; Tue, 27 Jan 2026 10:53:18 -0800 (PST) X-Received: by 2002:a05:620a:4405:b0:8c3:528b:1b10 with SMTP id af79cd13be357-8c70b932fcdmr364393585a.90.1769539998057; Tue, 27 Jan 2026 10:53:18 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Lukas Straub , Prasad Pandit , Fabiano Rosas , Juraj Marcin Subject: [PATCH v2 19/24] migration: Refactor qemu_savevm_state_setup() Date: Tue, 27 Jan 2026 13:52:49 -0500 Message-ID: <20260127185254.3954634-20-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260127185254.3954634-1-peterx@redhat.com> References: <20260127185254.3954634-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_H2=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development 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: 1769540074706158500 Content-Type: text/plain; charset="utf-8" Split it into two smaller chunks: - Dump of early_setup VMSDs - Dump of save_setup() sections They're mutual exclusive, hence we can run two loops and do them sequentially. This will cause migration thread to loop one more time, but it should be fine when migration just started and only do it once. It's needed because we will need to reuse the early_vmsd helper later to deduplicate code elsewhere. QEMU almost sticks with qemu_savevm_state_XXX() to represent the dump of vmstates's section XXX. With that in mind, this patch renamed the original qemu_savevm_state_setup() to qemu_savevm_state_do_setup() instead. So after this patch: - qemu_savevm_state_non_iterable_early() dumps early_vmsds only, - qemu_savevm_state_setup() dumps save_setup() sections only, - qemu_savevm_state_do_setup() does all things needed during setup phase (including migration SETUP notifies) Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas Tested-by: Lukas Straub --- migration/savevm.h | 6 +++-- migration/migration.c | 4 ++-- migration/savevm.c | 56 ++++++++++++++++++++++++++++++------------- 3 files changed, 46 insertions(+), 20 deletions(-) diff --git a/migration/savevm.h b/migration/savevm.h index bded5e2a6c..f2750eca09 100644 --- a/migration/savevm.h +++ b/migration/savevm.h @@ -34,7 +34,7 @@ bool qemu_savevm_state_blocked(Error **errp); void qemu_savevm_non_migratable_list(strList **reasons); int qemu_savevm_state_prepare(Error **errp); -int qemu_savevm_state_setup(QEMUFile *f, Error **errp); +int qemu_savevm_state_do_setup(QEMUFile *f, Error **errp); bool qemu_savevm_state_guest_unplug_pending(void); int qemu_savevm_state_resume_prepare(MigrationState *s); void qemu_savevm_send_header(QEMUFile *f); @@ -75,7 +75,9 @@ int qemu_loadvm_state_main(QEMUFile *f, MigrationIncoming= State *mis, int qemu_load_device_state(QEMUFile *f, Error **errp); int qemu_loadvm_approve_switchover(void); int qemu_savevm_state_non_iterable(QEMUFile *f); - +int qemu_savevm_state_non_iterable_early(QEMUFile *f, + JSONWriter *vmdesc, + Error **errp); bool qemu_loadvm_load_state_buffer(const char *idstr, uint32_t instance_id, char *buf, size_t len, Error **errp); =20 diff --git a/migration/migration.c b/migration/migration.c index b8c85496f8..2cbeebc9ba 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3528,7 +3528,7 @@ static void *migration_thread(void *opaque) } =20 bql_lock(); - ret =3D qemu_savevm_state_setup(s->to_dst_file, &local_err); + ret =3D qemu_savevm_state_do_setup(s->to_dst_file, &local_err); bql_unlock(); =20 qemu_savevm_wait_unplug(s, MIGRATION_STATUS_SETUP, @@ -3651,7 +3651,7 @@ static void *bg_migration_thread(void *opaque) =20 bql_lock(); qemu_savevm_state_header(s->to_dst_file); - ret =3D qemu_savevm_state_setup(s->to_dst_file, &local_err); + ret =3D qemu_savevm_state_do_setup(s->to_dst_file, &local_err); bql_unlock(); =20 qemu_savevm_wait_unplug(s, MIGRATION_STATUS_SETUP, diff --git a/migration/savevm.c b/migration/savevm.c index 0683a103c8..b04a21ffc9 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1367,29 +1367,33 @@ int qemu_savevm_state_prepare(Error **errp) return 0; } =20 -int qemu_savevm_state_setup(QEMUFile *f, Error **errp) +int qemu_savevm_state_non_iterable_early(QEMUFile *f, + JSONWriter *vmdesc, + Error **errp) { - ERRP_GUARD(); - MigrationState *ms =3D migrate_get_current(); - JSONWriter *vmdesc =3D ms->vmdesc; SaveStateEntry *se; - int ret =3D 0; - - if (vmdesc) { - json_writer_int64(vmdesc, "page_size", qemu_target_page_size()); - json_writer_start_array(vmdesc, "devices"); - } + int ret; =20 - trace_savevm_state_setup(); QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { if (se->vmsd && se->vmsd->early_setup) { ret =3D vmstate_save(f, se, vmdesc, errp); if (ret) { - break; + return ret; } - continue; } + } + + return 0; +} + +static int qemu_savevm_state_setup(QEMUFile *f, Error **errp) +{ + SaveStateEntry *se; + int ret; + + trace_savevm_state_setup(); =20 + QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { if (!se->ops || !se->ops->save_setup) { continue; } @@ -1399,14 +1403,34 @@ int qemu_savevm_state_setup(QEMUFile *f, Error **er= rp) } } save_section_header(f, se, QEMU_VM_SECTION_START); - ret =3D se->ops->save_setup(f, se->opaque, errp); save_section_footer(f, se); if (ret < 0) { - break; + return ret; } } =20 + return 0; +} + +int qemu_savevm_state_do_setup(QEMUFile *f, Error **errp) +{ + ERRP_GUARD(); + MigrationState *ms =3D migrate_get_current(); + JSONWriter *vmdesc =3D ms->vmdesc; + int ret; + + if (vmdesc) { + json_writer_int64(vmdesc, "page_size", qemu_target_page_size()); + json_writer_start_array(vmdesc, "devices"); + } + + ret =3D qemu_savevm_state_non_iterable_early(f, vmdesc, errp); + if (ret) { + return ret; + } + + ret =3D qemu_savevm_state_setup(f, errp); if (ret) { return ret; } @@ -1826,7 +1850,7 @@ static int qemu_savevm_state(QEMUFile *f, Error **err= p) ms->to_dst_file =3D f; =20 qemu_savevm_state_header(f); - ret =3D qemu_savevm_state_setup(f, errp); + ret =3D qemu_savevm_state_do_setup(f, errp); if (ret) { goto cleanup; } --=20 2.50.1 From nobody Sun Feb 8 20:28:47 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=1769540071; cv=none; d=zohomail.com; s=zohoarc; b=nXqKkq2PE0NXjFBmd2p/pekC8YvzZnHo++eQo0kK7EdrP6Kf93ZJLK5ovPxFKtblhJj/IKj2FY/7k7YXFmXb/CZGnylAudnM5sk4i+RO5d9//SVsK63NhwMvjVOV+yL40Xv5dIj2zfnYT2MMf2Jm5/Qh8DjWiuDzQL1etnUS5uU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769540071; 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=r5tMYOv+4JK4eT6CrqSaDeE9RQFeH3UxvgkGd+VWeXg=; b=Ii9adOC1CdbwnSm5WPmwpkOAO1NmJPe5ZAhE3RAfVjfIY7/TgDQXg86xaxXvIK9EtiqZeYBEnzfYWefNywa2t8//zrPoDHy1dycU4q0jOuNIy3XjZctKgJyeehdjCRD71txw8dibZ+TJ1+gvxvhtwRPS5CT+rlIwWBTZmecYIeg= 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 1769540071280482.8967444718031; Tue, 27 Jan 2026 10:54:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkoCo-0005Wd-Fy; Tue, 27 Jan 2026 13:54:26 -0500 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 1vkoBp-0003FH-58 for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:30 -0500 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 1vkoBn-0000oE-0E for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:24 -0500 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-136-pBBIY3ggM9a8cCzUs_v68A-1; Tue, 27 Jan 2026 13:53:21 -0500 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-8c6a87029b6so1939555485a.1 for ; Tue, 27 Jan 2026 10:53:21 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-894d3740e54sm2338466d6.35.2026.01.27.10.53.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 10:53:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769540002; 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=r5tMYOv+4JK4eT6CrqSaDeE9RQFeH3UxvgkGd+VWeXg=; b=fSSbL6+EF6zB3sbHQHJHMHFCpOZBzjX7ED0e6hY3EtSJzSaFCgZnHNS6+O6VAkNU8Qt3Mh theS/6Im8UQ3uCiMReV09G1s5axrUMVfbIkCHQWOrFhOTMG5n68oEfI2i8sQBELAd3NW9K kk6XffSVbfqSRcrQmB+c6w75Ex46qjk= X-MC-Unique: pBBIY3ggM9a8cCzUs_v68A-1 X-Mimecast-MFC-AGG-ID: pBBIY3ggM9a8cCzUs_v68A_1769540001 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769540000; x=1770144800; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=r5tMYOv+4JK4eT6CrqSaDeE9RQFeH3UxvgkGd+VWeXg=; b=pcrfCYDPGy0PBhMxV0apXwxg9/qX5LDzZdkLnEnGVVdwTm5ZjyOpvBPwXxo4DEeQN6 8JAo2IgrDr/XqN8kqQ5YmKo7DGEjUge1/bQ8A4NpIb/RANWpYuvu0C8S+IUMLLge63Ck +4si5FTuqgjm8AIKke3WM7aefHVjDGp+n8pQjwPPsNvIgltcCJG+aJUr0Q7vaRhy08OV V18WBP5Ozed9V+e2ZbOMDffkAXjwoy0B3YqOl3Ypika98HSxvwbbKdR8gl1jza5KVuhQ I1N/fTXLMHgOLKBNmZORAew/IA77e44P4EwPJ0nrRWWXZeWZkLPZAHum6PnzhQvC9tFF I5EA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769540000; x=1770144800; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=r5tMYOv+4JK4eT6CrqSaDeE9RQFeH3UxvgkGd+VWeXg=; b=lLT6nBVDZGfBkUn5giYvE5+TyDS6Y8qC1pylTDjALnCBmCplx2z5TwxvFI5HG4veXW eiTEwEmr1VO5dYFmVNKfhwKBq0eb1y9pHh0wElcllqwfcKTUBb6Sk+nfhsgQGE/h6fUD lMMLSS/Cm17XIPnaI3+h52iUgY8tL2U5VKtfo5h/FvQj+2n5nVKdI6hwdaHXb1yyxgH1 3Novs2+WV+GCNKzrcXBbHAKwG5TPrd9VZ2/JNpc2fZi5tPzwktmcfFQ4eEEupnGCh1R/ ZVf6JUMozWX+XOzy9TEtJP/N498hVAvIuu+pb4Hucy2/y74YuC/SwEv3eSlG0a8SsMI5 UpxQ== X-Gm-Message-State: AOJu0Ywb6jlTgQ1apLsbGz3ghxgw3LbXYafoAPx1Zpd4/jFYtc/e3xxE Ft7C85nNnKoJ4DASo04piVTAmkKnrE20NpA6HQ786RHVW7/bVQYqtD8cNsOkin67lzh4IbJvwd3 SeCKvyXL4+v64H8CYEYB7a50zygQf/NSf5DgbNfwjEquu5NNqrFsfoPmYSAyZmmhRH+p1/KFqv3 yUgVVBhz05QOn6pdApXwSEUdxUgHmB3QMZzhZdFw== X-Gm-Gg: AZuq6aL7HErZUNJLmMgDSA3beAovqUf8dFRbVBQ1aqMFQ8BaGM3mWfWipGFf75GRf67 8QtmOiYoWgjiVMn5oplNdtjptULb3YcQR1qih9Vu5DFUZoppFmJfwmJ4IuS/OoPlnawI1TrJLSY PUTvbabsitN6/3aHCAR5U34OEkISup35bfAn58A12bDw1wAENbfBxdf1Fj8eOdbcaAJZDEd5MGL SBqxmo83V2WzgfxZKlt3WTdhs4RYu2JZzwS8Y3Y+NH6tkXVDzwmFPNQrWcpBeXOyYps8aqLsIrc xFpTdbBG9qzx3/GMjxGqsYCBp5xjeCFj18Km4rP6n6TqJ8IkXi9oCorqjtB4caCIoRxtv6atY0o i X-Received: by 2002:a05:620a:2886:b0:8c6:e8f6:2c7 with SMTP id af79cd13be357-8c70b8858b5mr354679385a.38.1769540000404; Tue, 27 Jan 2026 10:53:20 -0800 (PST) X-Received: by 2002:a05:620a:2886:b0:8c6:e8f6:2c7 with SMTP id af79cd13be357-8c70b8858b5mr354675285a.38.1769539999897; Tue, 27 Jan 2026 10:53:19 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Lukas Straub , Prasad Pandit , Fabiano Rosas , Juraj Marcin Subject: [PATCH v2 20/24] migration: Introduce qemu_savevm_state_active() Date: Tue, 27 Jan 2026 13:52:50 -0500 Message-ID: <20260127185254.3954634-21-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260127185254.3954634-1-peterx@redhat.com> References: <20260127185254.3954634-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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development 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: 1769540072554158500 Content-Type: text/plain; charset="utf-8" Introduce this helper to detect if a SaveStateEntry is active. Note that this helper can actually also be used in loadvm paths, but let's stick with this name for now because we still use SaveStateEntry for the shared structure that both savevm/loadvm uses, where this name still suites. Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas Tested-by: Lukas Straub --- migration/savevm.c | 63 ++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 36 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index b04a21ffc9..c16951b532 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1071,6 +1071,16 @@ void qemu_savevm_state_end(QEMUFile *f) qemu_put_byte(f, QEMU_VM_EOF); } =20 +static inline bool qemu_savevm_state_active(SaveStateEntry *se) +{ + /* When no is_active() hook, always treat it as ACTIVE */ + if (!se->ops->is_active) { + return true; + } + + return se->ops->is_active(se->opaque); +} + /** * qemu_savevm_command_send: Send a 'QEMU_VM_COMMAND' type element with the * command and associated data. @@ -1352,12 +1362,9 @@ int qemu_savevm_state_prepare(Error **errp) if (!se->ops || !se->ops->save_prepare) { continue; } - if (se->ops->is_active) { - if (!se->ops->is_active(se->opaque)) { - continue; - } + if (!qemu_savevm_state_active(se)) { + continue; } - ret =3D se->ops->save_prepare(se->opaque, errp); if (ret < 0) { return ret; @@ -1397,10 +1404,8 @@ static int qemu_savevm_state_setup(QEMUFile *f, Erro= r **errp) if (!se->ops || !se->ops->save_setup) { continue; } - if (se->ops->is_active) { - if (!se->ops->is_active(se->opaque)) { - continue; - } + if (!qemu_savevm_state_active(se)) { + continue; } save_section_header(f, se, QEMU_VM_SECTION_START); ret =3D se->ops->save_setup(f, se->opaque, errp); @@ -1450,10 +1455,8 @@ int qemu_savevm_state_resume_prepare(MigrationState = *s) if (!se->ops || !se->ops->resume_prepare) { continue; } - if (se->ops->is_active) { - if (!se->ops->is_active(se->opaque)) { - continue; - } + if (!qemu_savevm_state_active(se)) { + continue; } ret =3D se->ops->resume_prepare(s, se->opaque); if (ret < 0) { @@ -1481,8 +1484,7 @@ int qemu_savevm_state_iterate(QEMUFile *f, bool postc= opy) if (!se->ops || !se->ops->save_live_iterate) { continue; } - if (se->ops->is_active && - !se->ops->is_active(se->opaque)) { + if (!qemu_savevm_state_active(se)) { continue; } if (se->ops->is_active_iterate && @@ -1543,10 +1545,8 @@ static int qemu_savevm_complete(SaveStateEntry *se, = QEMUFile *f) { int ret; =20 - if (se->ops->is_active) { - if (!se->ops->is_active(se->opaque)) { - return 0; - } + if (!qemu_savevm_state_active(se)) { + return 0; } =20 trace_savevm_section_start(se->idstr, se->section_id); @@ -1596,10 +1596,8 @@ bool qemu_savevm_state_postcopy_prepare(QEMUFile *f,= Error **errp) continue; } =20 - if (se->ops->is_active) { - if (!se->ops->is_active(se->opaque)) { - continue; - } + if (!qemu_savevm_state_active(se)) { + continue; } =20 trace_savevm_section_start(se->idstr, se->section_id); @@ -1785,10 +1783,8 @@ void qemu_savevm_state_pending_estimate(uint64_t *mu= st_precopy, if (!se->ops || !se->ops->state_pending_estimate) { continue; } - if (se->ops->is_active) { - if (!se->ops->is_active(se->opaque)) { - continue; - } + if (!qemu_savevm_state_active(se)) { + continue; } se->ops->state_pending_estimate(se->opaque, must_precopy, can_post= copy); } @@ -1806,10 +1802,8 @@ void qemu_savevm_state_pending_exact(uint64_t *must_= precopy, if (!se->ops || !se->ops->state_pending_exact) { continue; } - if (se->ops->is_active) { - if (!se->ops->is_active(se->opaque)) { - continue; - } + if (!qemu_savevm_state_active(se)) { + continue; } se->ops->state_pending_exact(se->opaque, must_precopy, can_postcop= y); } @@ -2829,12 +2823,9 @@ static int qemu_loadvm_state_setup(QEMUFile *f, Erro= r **errp) if (!se->ops || !se->ops->load_setup) { continue; } - if (se->ops->is_active) { - if (!se->ops->is_active(se->opaque)) { - continue; - } + if (!qemu_savevm_state_active(se)) { + continue; } - ret =3D se->ops->load_setup(f, se->opaque, errp); if (ret < 0) { error_prepend(errp, "Load state of device %s failed: ", --=20 2.50.1 From nobody Sun Feb 8 20:28:47 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=1769540082; cv=none; d=zohomail.com; s=zohoarc; b=GwBN31enyFt0DuVpeA1dEDvt6UeJ+GDkdDJWCFP0ayEHDMP8vNMxfl7jQw5gh2u9kE/Yrp2nC/xUuT+Bpnpj8xvLPvalX6rrmvligoC5SiSzmFZtzY9hd+WCua/GS8D+zIz+8Zrqq+xd8eQWvtZ4r2/kGUIOnOjCpRgdl2QA6+s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769540082; 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=EYZ2iNE8RQmcMqy3VCVQZ24wJOchHkbRFDeNGZism28=; b=i/zhA3cxs521fdcoFH29+c7AJnE/500i56Cfu1aZHzFGcbPYFlwMJA32Y4nRIfrp3BQe899+0zzP0lZaeC/b97LoG0S5XL0uSYFpZDfWCNQsUfTc+3rDx4HId9EPX4uR41ZgJZ7hQnJvuIzq/Ux0VvqcuZ87OhHsEJHDaLdk4dg= 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 1769540082552960.8173715667374; Tue, 27 Jan 2026 10:54:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkoCq-0005sP-NC; Tue, 27 Jan 2026 13:54:28 -0500 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 1vkoBq-0003FZ-Ev for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:30 -0500 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 1vkoBo-0000og-Hl for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:26 -0500 Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-653-lV97wPN2PpOVHn7f8nQyeg-1; Tue, 27 Jan 2026 13:53:22 -0500 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8c5296c7e57so790626185a.1 for ; Tue, 27 Jan 2026 10:53:22 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-894d3740e54sm2338466d6.35.2026.01.27.10.53.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 10:53:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769540003; 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=EYZ2iNE8RQmcMqy3VCVQZ24wJOchHkbRFDeNGZism28=; b=f3Fb0EgM/JKjd/zv82W2acHs+5JSudvcRrbrUnCiF3kExvqiu4ZOzm4HGlCyZg2Xg6PsFT TS17HqdM3xdWhDwmCHHyY2er7+oez7NELH/3N853ogQZ4oha9N5TIj9pJKNTTEzH9X0gxp 6xqqNfgOou94IEcWNUc4GnEERhGrhwc= X-MC-Unique: lV97wPN2PpOVHn7f8nQyeg-1 X-Mimecast-MFC-AGG-ID: lV97wPN2PpOVHn7f8nQyeg_1769540002 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769540002; x=1770144802; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EYZ2iNE8RQmcMqy3VCVQZ24wJOchHkbRFDeNGZism28=; b=AIYbTMtMMXi7USbDON71/0A+srNAbmusPX3ShVeLYd5tCEYWbxqaoNIfRBm2UgDoTK EOsi/icOjyVNJvvo2XP4W0TDKsYJiJsRz/1asngoojT9COT1aFbs6rPqpCZ0avspQvUZ iac0yxoDwBG4oN34lSgcHwQm48gNO3hQNXBQtGsJF3VpXlSryMzr2Yl+dXLNBtKrPa+M 8hNxE0OtnKV5mmOdvVz5uK9axh+2SKRkgxwy/ZguwZKbKfV3QQxZTShKU7o7PJRZLoMT CyJcBJYskziHiGkkoufkaj08lTif00ydua1o1wWzzvArO2zOy2eDsxGfyO15RRNZQ7po /6Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769540002; x=1770144802; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=EYZ2iNE8RQmcMqy3VCVQZ24wJOchHkbRFDeNGZism28=; b=hkHAyOJDDF5BsBmIC4rlSw5dNbNKKxb37EoClxNRKseFfjTUKvPFqht8we4e95lgSn R8jMbhVzxnURu15YeYpbHY/P3KwlNdmwgNGkw8q/8LjXV0PrxDVgqQGoE/ImZw5T4iqT SuCg9MIuCdE3dIRR7NRaUHepyTMvO8TC+p/k+3nnsXskHtmdIphJzW/xZb1VY8nouwNR wQ3H1Sbonaggzv4eD6Q1XZTMekqK6d+j7DDFarcEK8RM9Cno6IOSMDSFj6UlyEuvWDod mK+6aZZg1AubzQhGwgyxzwUnYGTU7Adx9MD+ReruwsZ/VKJp8DCSXleOYlQHhRTAodkK HF2w== X-Gm-Message-State: AOJu0Yz2rS3EGsfkQFhlUWiN3Dx1/+K2kDFoixIMp7pdRBEVZ+5bz3Le WTsq2Jj3usW0vpSUjT3gg2++hIxojBkeYTW7AOs3++G7tk8Livz+7gh2swHc2Aws6IvJbH35tsK /PHBxaVAZ1moTV5u8pmCG4MPfOeXZ/E3xjYXrJUks4WgfqS47IgDqUyt5yU4painbWMVcvBbrLk o7xH4kDm0j0mnEMtycXLxQNlw5X8NIz/UHrhqZGQ== X-Gm-Gg: AZuq6aJhJbcLsch+Ki2Vh4Mldy6F5/CbilX1tLbWKdEQ8aE+WsC/2xrXpKKd2Ls8c75 88ZAwjq9YffXQ18YMXGQZjaMJ+rt3kz8w6eq+taJT/5w+l6LciCQUyWakCENNo5YEHneZaevSjt xTmhM36b/2az94wPO+rpBQ2MLhNOi/oxs0SeXLEBnzQO1P2f3rTT0L/VpcqGtVVGNLapgzcKAVU lzSTlFl+HWhFnSQ2PtQLVfSXNo0iJN4Ql8hZWuEGmQa1cat1Igia54LX7b6S3DF3IdrNrJ38d4Q L5O44QKYVkUNn6P2YL/Li25+r++4WoIAO8+GQGnETAL+fL/H15/ufci+5HVyqFd3P35AC2HMwxE d X-Received: by 2002:a05:620a:3728:b0:8b2:e058:de83 with SMTP id af79cd13be357-8c70b85b1abmr303110985a.15.1769540001835; Tue, 27 Jan 2026 10:53:21 -0800 (PST) X-Received: by 2002:a05:620a:3728:b0:8b2:e058:de83 with SMTP id af79cd13be357-8c70b85b1abmr303107485a.15.1769540001315; Tue, 27 Jan 2026 10:53:21 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Lukas Straub , Prasad Pandit , Fabiano Rosas , Juraj Marcin Subject: [PATCH v2 21/24] migration/bg-snapshot: Cleanup error paths Date: Tue, 27 Jan 2026 13:52:51 -0500 Message-ID: <20260127185254.3954634-22-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260127185254.3954634-1-peterx@redhat.com> References: <20260127185254.3954634-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_H2=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development 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: 1769540084155154100 Content-Type: text/plain; charset="utf-8" Cleanup bg_migration_thread() function on error handling. First of all, early_fail is almost only used to say if BQL is taken. Since we already have separate jumping labels, we don't really need it, hence removed. Also, since local_err is around, making sure every failure path will set a proper error string for the failure, then propagate to MigrationState.error. Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas Tested-by: Lukas Straub --- migration/migration.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 2cbeebc9ba..ddf6faab46 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3616,7 +3616,6 @@ static void *bg_migration_thread(void *opaque) int64_t setup_start; MigThrError thr_error; QEMUFile *fb; - bool early_fail =3D true; Error *local_err =3D NULL; int ret; =20 @@ -3662,10 +3661,7 @@ static void *bg_migration_thread(void *opaque) * devices to unplug. This to preserve migration state transitions. */ if (ret) { - migrate_error_propagate(s, local_err); - migrate_set_state(&s->state, MIGRATION_STATUS_ACTIVE, - MIGRATION_STATUS_FAILED); - goto fail_setup; + goto fail; } =20 s->setup_time =3D qemu_clock_get_ms(QEMU_CLOCK_HOST) - setup_start; @@ -3675,11 +3671,13 @@ static void *bg_migration_thread(void *opaque) bql_lock(); =20 if (migration_stop_vm(s, RUN_STATE_PAUSED)) { - goto fail; + error_setg(&local_err, "Failed to stop the VM"); + goto fail_with_bql; } =20 if (qemu_savevm_state_non_iterable(fb)) { - goto fail; + error_setg(&local_err, "Failed to save non-iterable devices"); + goto fail_with_bql; } =20 qemu_savevm_state_end_precopy(s, fb); @@ -3692,9 +3690,9 @@ static void *bg_migration_thread(void *opaque) =20 /* Now initialize UFFD context and start tracking RAM writes */ if (ram_write_tracking_start()) { - goto fail; + error_setg(&local_err, "Failed to start write tracking"); + goto fail_with_bql; } - early_fail =3D false; =20 /* * Start VM from BH handler to avoid write-fault lock here. @@ -3726,21 +3724,22 @@ static void *bg_migration_thread(void *opaque) } =20 trace_migration_thread_after_loop(); + goto done; + +fail_with_bql: + bql_unlock(); =20 fail: - if (early_fail) { - migrate_set_state(&s->state, MIGRATION_STATUS_ACTIVE, - MIGRATION_STATUS_FAILED); - bql_unlock(); - } + /* local_err is guaranteed to be set when reaching here */ + migrate_error_propagate(s, local_err); + migrate_set_state(&s->state, MIGRATION_STATUS_ACTIVE, + MIGRATION_STATUS_FAILED); =20 -fail_setup: +done: bg_migration_iteration_finish(s); - qemu_fclose(fb); object_unref(OBJECT(s)); rcu_unregister_thread(); - return NULL; } =20 --=20 2.50.1 From nobody Sun Feb 8 20:28:47 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=1769540100; cv=none; d=zohomail.com; s=zohoarc; b=SgeacMYfhnGLfzsAhwk4dwpZHSDnrcVyLYkSekNt6iUIaKSgywcjAkothBah4PdddVdBIxy9rTIb1jIWs9X7JjdH4aCSCaXKmmnJjlxjUf6JOddu0QDxwzflzQ8rGBzu47Nee5uDV51vB6ZDHQIzFWwuaz6x6J9sbWAUSuDCSmQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769540100; 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=UzVgFcW6WMbor1W3nR8DZ97qds5M3uYkKxz4VH+bjnA=; b=c5m/A01+QEQoi6RA/EpBSkzsKV+s/hD3ncqIqINn4C5ogK/bv5RAx53SNY5RgFUT+O2UbWstIxptEs31RqjI/waiKtxrTH3gd6nMNEN2pWGKUoNUTD3yfTQsyR8QfbMUFeo/yb7V2plv9b5f4ENEx90CjkH+bEQr6LMhjfMJVws= 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 1769540100736715.4764214849794; Tue, 27 Jan 2026 10:55:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkoCm-0005Lk-Uy; Tue, 27 Jan 2026 13:54:25 -0500 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 1vkoBs-0003Fu-BI for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:30 -0500 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 1vkoBq-0000qW-2a for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:27 -0500 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-687-rfSg46xFNNWq5jeSNw6p1w-1; Tue, 27 Jan 2026 13:53:23 -0500 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-894a861fd7cso112498216d6.3 for ; Tue, 27 Jan 2026 10:53:23 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-894d3740e54sm2338466d6.35.2026.01.27.10.53.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 10:53:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769540005; 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=UzVgFcW6WMbor1W3nR8DZ97qds5M3uYkKxz4VH+bjnA=; b=G4swFaLFcoqoP51PmNoexpm6T6xsJXNITz50DOvlGoBGi18ppa8u9a7Fo9VfNdXUcYD+0I CKm7L/zySIB29Bn9d9VlYj+bI8ZnxClmMWCzFwy6xchhnSrMJueVt+zSENQ8DDN1iQ7cZg GhaZMxPdc3TT2l/Q1zStrPE0aT8deNY= X-MC-Unique: rfSg46xFNNWq5jeSNw6p1w-1 X-Mimecast-MFC-AGG-ID: rfSg46xFNNWq5jeSNw6p1w_1769540003 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769540003; x=1770144803; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UzVgFcW6WMbor1W3nR8DZ97qds5M3uYkKxz4VH+bjnA=; b=RzWIkCHgLWU6qU1J/3ho6yDePNHSIUqyWV8w1bHdWrepHoieqifqZbR6/JINr8m0zY kq6bNY8v3UHSDnJnqk87l4CE/Twe41sy/Lbyq/B03wPTM8KTihZ3ZuZgs7eXcXEH8eLO XM7BCGvCZ6LXKn3xCa5SViZYKaAV4bKBNQAqeIkK725q5v48AfNmEtjdmtxH7ILH82g3 3+CxpYkrIHnPU5roXVKh7Yv+XgVA18dkUictwTDzPOVxc66IJVWTmWKcn9jlRbvo+oZm 2NpJQhbKHDcYep5+GnSadcEScYCH78HioZ5xsQuamZv4FLqMus7YspIBaSJRD/vf9XGb 2bkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769540003; x=1770144803; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=UzVgFcW6WMbor1W3nR8DZ97qds5M3uYkKxz4VH+bjnA=; b=JUGLwsO6hCTvOeVj4y70+KVkIoWpt11HRY9Ubxu/w4CMu6YDq2c4KQPrXJPVqiIb3t 3TjLTQu671zPOoq/QmSmKrBenlsKB0ICseXXoAHXqr6zgpateT+Qxb+RnE2lY51a53JE iWy4SsDVq/ah8q4bx5k05eKFxx7DWVEX7KwpIfpmNAOhbvmvIuq2L505oVw2ifBJN8kP GquLEyNEqyzyRCvyaAoM9P+crDAj+QIsdrZZ82vj0iy4g8vHOyzr2kt6QwDkvt/VBLrO MstBEaswHH+YVvLCtxEyp9h0DSZLCmV0zYKk2DaslUxSFaD+rJ3SU7LHbi13ovShbuGW z2WA== X-Gm-Message-State: AOJu0Yz1s9VO7cnJnCljzTW0OauttQBS/B13Nmtlw9L3eT5YiAQUk38p J969SxhmHmHvwENjG23EHxQJbD6ayOx+khMiJRD59BcPDZWKaFPzrW1//yMh95Cq4sLKgpfQ8DW mJjtmUrdoqxbXl7u7ru0HFhwzONAp/viozkuC7B1RssLQmveZxG5dr5EdTBlTPb5vhbSXcm0Te3 mE1aYf2PDyG5xDdVHJ8dyrmkJ2EaxSQetC2WV5Og== X-Gm-Gg: AZuq6aIzXMKcmgY44G7FBWP2XfGA4nxBi9FhWT2mpKy5vGHsZ13fwS9zE56MdEVADq9 Z3+nLIQx7BHcOudnmI1uGLOFBbWW56SgUiwF7lqz8kIr3YTILzxf28zWLmCLllNkfYultJgrZrQ ftRqWuP6+6ivpBqwefVkQ0WSJoKYTBUXjSHXNpN7GlJZvyswWIAMGb/CpLjcp5DqXOR4AKx83Kz C0jCs9CslZYus+/2AjzsVaMiRd+hHBky4yxzh+sx8/0m1Xswwe4C16DBBW/PuDwNLUONhDudjUQ Tddn9ea4L46ZCzHALvrsrrtL0G7D7RjNH2aelvjxmlFdNsxVqEsUNt9hOIUS9vrau0A4KdM2nyS N X-Received: by 2002:a05:6214:234c:b0:894:6f32:8f04 with SMTP id 6a1803df08f44-894cc8bf0aemr36055006d6.42.1769540002706; Tue, 27 Jan 2026 10:53:22 -0800 (PST) X-Received: by 2002:a05:6214:234c:b0:894:6f32:8f04 with SMTP id 6a1803df08f44-894cc8bf0aemr36054716d6.42.1769540002172; Tue, 27 Jan 2026 10:53:22 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Lukas Straub , Prasad Pandit , Fabiano Rosas , Juraj Marcin Subject: [PATCH v2 22/24] migration: Make qemu_savevm_state_non_iterable() take errp Date: Tue, 27 Jan 2026 13:52:52 -0500 Message-ID: <20260127185254.3954634-23-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260127185254.3954634-1-peterx@redhat.com> References: <20260127185254.3954634-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_H2=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development 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: 1769540102765158500 Content-Type: text/plain; charset="utf-8" Let the function report errors to upper layers. Out of three current users, two of them already process the errors, except one outlier, qemu_savevm_state_complete_precopy(), where we do it manually for now with a comment for TODO. Signed-off-by: Peter Xu Tested-by: Lukas Straub --- migration/savevm.h | 2 +- migration/migration.c | 8 ++++---- migration/savevm.c | 13 +++++++------ 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/migration/savevm.h b/migration/savevm.h index f2750eca09..6a589b2990 100644 --- a/migration/savevm.h +++ b/migration/savevm.h @@ -74,7 +74,7 @@ int qemu_loadvm_state_main(QEMUFile *f, MigrationIncoming= State *mis, Error **errp); int qemu_load_device_state(QEMUFile *f, Error **errp); int qemu_loadvm_approve_switchover(void); -int qemu_savevm_state_non_iterable(QEMUFile *f); +int qemu_savevm_state_non_iterable(QEMUFile *f, Error **errp); int qemu_savevm_state_non_iterable_early(QEMUFile *f, JSONWriter *vmdesc, Error **errp); diff --git a/migration/migration.c b/migration/migration.c index ddf6faab46..22cfa5f19f 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2545,9 +2545,9 @@ static int postcopy_start(MigrationState *ms, Error *= *errp) */ qemu_savevm_send_postcopy_listen(fb); =20 - ret =3D qemu_savevm_state_non_iterable(fb); + ret =3D qemu_savevm_state_non_iterable(fb, errp); if (ret) { - error_setg(errp, "Postcopy save non-iterable device states failed"= ); + error_prepend(errp, "Postcopy save non-iterable states failed: "); goto fail_closefb; } =20 @@ -3675,8 +3675,8 @@ static void *bg_migration_thread(void *opaque) goto fail_with_bql; } =20 - if (qemu_savevm_state_non_iterable(fb)) { - error_setg(&local_err, "Failed to save non-iterable devices"); + if (qemu_savevm_state_non_iterable(fb, &local_err)) { + error_prepend(&local_err, "Failed to save non-iterable devices"); goto fail_with_bql; } =20 diff --git a/migration/savevm.c b/migration/savevm.c index c16951b532..130b9764a7 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1710,13 +1710,12 @@ void qemu_savevm_state_end_precopy(MigrationState *= s, QEMUFile *f) qemu_savevm_state_vm_desc(s, f); } =20 -int qemu_savevm_state_non_iterable(QEMUFile *f) +int qemu_savevm_state_non_iterable(QEMUFile *f, Error **errp) { MigrationState *ms =3D migrate_get_current(); int64_t start_ts_each, end_ts_each; JSONWriter *vmdesc =3D ms->vmdesc; SaveStateEntry *se; - Error *local_err =3D NULL; int ret; =20 /* Making sure cpu states are synchronized before saving non-iterable = */ @@ -1730,10 +1729,8 @@ int qemu_savevm_state_non_iterable(QEMUFile *f) =20 start_ts_each =3D qemu_clock_get_us(QEMU_CLOCK_REALTIME); =20 - ret =3D vmstate_save(f, se, vmdesc, &local_err); + ret =3D vmstate_save(f, se, vmdesc, errp); if (ret) { - migrate_error_propagate(ms, error_copy(local_err)); - error_report_err(local_err); return ret; } =20 @@ -1750,6 +1747,7 @@ int qemu_savevm_state_non_iterable(QEMUFile *f) int qemu_savevm_state_complete_precopy(MigrationState *s) { QEMUFile *f =3D s->to_dst_file; + Error *local_err =3D NULL; int ret; =20 ret =3D qemu_savevm_state_complete_precopy_iterable(f, false); @@ -1757,8 +1755,11 @@ int qemu_savevm_state_complete_precopy(MigrationStat= e *s) return ret; } =20 - ret =3D qemu_savevm_state_non_iterable(f); + /* TODO: pass error upper */ + ret =3D qemu_savevm_state_non_iterable(f, &local_err); if (ret) { + migrate_error_propagate(s, error_copy(local_err)); + error_report_err(local_err); return ret; } =20 --=20 2.50.1 From nobody Sun Feb 8 20:28:47 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=1769540185; cv=none; d=zohomail.com; s=zohoarc; b=aSFol+c71vj0jxsXrJWkeeFTWBaW2dJFWGCPCZHandWwUfxtgP15/JgD5SrBR8O6i/PX1fEkKZge1lvY2RN+hL7gZJT1IHgctnzSkVodNUh5jsIRlqRNW4TIXqj1ldkQ8Qibcw78BhtRMAKCfvsgDVQhRstpIrwsPj/tjqYoXG0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769540185; 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=zPqi75yaxnWxisnkh/f1rPum4gZEHJRQ3EW89l53vrI=; b=nC0NLq2g/rXNQZPDVrOZA2CEvGj349pRMWQWhWXty4BscNKcv3Eyv5cLOwXSou81DgF2Id7va3kOeet1DIqqsbQKZ8d3xr23DYHO+BoWk1OTj/1tAjYyGIwF0fOtF1r9zrTo2WxaD+6sVUDQejpbqlJwPfSEsLymFpNDggJBPXk= 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 1769540185818353.5382404513467; Tue, 27 Jan 2026 10:56:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkoCt-0006Pr-Ti; Tue, 27 Jan 2026 13:54:31 -0500 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 1vkoBv-0003I2-RH for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:33 -0500 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 1vkoBr-0000rT-TC for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:30 -0500 Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-3-_DaSYltNP4Oep3hwGE9d7g-1; Tue, 27 Jan 2026 13:53:25 -0500 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-8946e21ad8cso71849386d6.2 for ; Tue, 27 Jan 2026 10:53:25 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-894d3740e54sm2338466d6.35.2026.01.27.10.53.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 10:53:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769540006; 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=zPqi75yaxnWxisnkh/f1rPum4gZEHJRQ3EW89l53vrI=; b=ArALm6NnNJOoP8NOlvJkIHVDAtPm4k4XqnUoTmxUmnXqmXul4cCPDhcTLXfnOmLYPwNaW4 1BL4c4JluQAGmunqtg70Ru8tYpJlq3tNskgKpWwmFsxCYPGckU11gH7DN7/j24vFZz323c 9JapekD706XNsS+UT//bi50Q272GPFI= X-MC-Unique: _DaSYltNP4Oep3hwGE9d7g-1 X-Mimecast-MFC-AGG-ID: _DaSYltNP4Oep3hwGE9d7g_1769540005 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769540004; x=1770144804; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zPqi75yaxnWxisnkh/f1rPum4gZEHJRQ3EW89l53vrI=; b=bpXVJfHezlhNlhGZmTknAHj6cXPg7dFwW3ZV984z4utcf8POFEYjFP9lmYfzVE0vJ6 aoL0BeqXxHJBShPfvhThfFoIvvDI+EypuxqIcBPl2gveP9GZDJrMz/BM1YtjLZ1kdWcA hlX/nAKEXN8As/Mt2LyyLSL1kRbBOSo9mxQiVY28lXQ00XYzSp1JLosrHkN1UL9ut4Pf ExYxZvOkLUJs4jEVQEsUGgsDxdQNcLEQcm3uVdDTwixhAU5i3K79I1tOZ4MJaYZ4IjKa hf9o0169MJt3KPklS5zWW+uFmFmudbzQxqzh0TzyBE+9i3hwQoWLXAatpxHBcgxcJXQ5 v4qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769540004; x=1770144804; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=zPqi75yaxnWxisnkh/f1rPum4gZEHJRQ3EW89l53vrI=; b=vk2s7u2G+s0HhJdBjTW4RBVxa+G5oKac0fYVoE/zRMjQyHrP7n+QGOO6b+Q4+DOftN gHT3YWttr+O6WtwdncUn26f47nEPVtCNwBwWYBeCxUEQx3ZTnZGKZmCrGWnEbAW8mbxB NL3gIK3oyFVu42HlQxmb0OP4fED5+VDJFVJencwkie393qfi5tKojTo7ngfAoCLakY+0 xgINPoIjK7QkgvtM502Xy+uCC6d3zLLBWE6vXhWaZTvmAM22GnOYTPxDZn4KW5A5xdDG HKArRvtb/RCbPrIOvBIsyb2g0ihmpsiR8o9VhRB7Q6ksBHpDJi9+hd0xuGx+jZLMeWV8 WHnA== X-Gm-Message-State: AOJu0YwMXSowaG9fBt+K3tO95Rq+iFbhg14ndxGd2wlK4kuv5x+qUTVB wTha1a9jVIr+5S3fxIZB8HPpUGRYtr7kB968av14ma714W7hx6Eb7cbbewmhkeOby4hKLolsPVd iMs+VZVnMNZlRV4Ul2g9Btik7EXUclVPVlWl9tNHsT3EyiBGaReXyPFwjOZIesWfnmk1qte61V0 PgzNdi2yEx2go+dpMNBHH/y3xdfXGD1mEnC9UfLg== X-Gm-Gg: AZuq6aLlNoiYJBhR4pVVgrRbRE9EHGaUXBDzvQOTFqW8PYBLBNLoX2H6huxXupzY+yl AR4QaOnbqwJR+9f8IqlwmPS7Frc+yJxjcI6hNUfCXQRb246r1DcanlTPL66NrslwHanltkpd0pq 5jeJLb9T3FVzR1z6OOG2fpzoe3LGYHTDA9wW8em0poof4gzoU3d5pogZhI5VX8OTzRUUGV5F9+g Q9oRLnZHtZb9ZuC2get5fUemPyAR0Y+QRliJu2D/rpxWO6MmU2lDeYcqzgQ03gRhI3n/LyFR3H7 DKQaoOwsT/60sYgaAcO9vG9lcIQkWrh0d6URz9I5A8vlFXxCcN/8yrCRhgJqnIqmCYBKbxEcHLe A X-Received: by 2002:ad4:5aa3:0:b0:890:56e:d3ce with SMTP id 6a1803df08f44-894cc81e442mr39933466d6.23.1769540004402; Tue, 27 Jan 2026 10:53:24 -0800 (PST) X-Received: by 2002:ad4:5aa3:0:b0:890:56e:d3ce with SMTP id 6a1803df08f44-894cc81e442mr39932966d6.23.1769540003786; Tue, 27 Jan 2026 10:53:23 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Lukas Straub , Prasad Pandit , Fabiano Rosas , Juraj Marcin , David Woodhouse , Paul Durrant Subject: [PATCH v2 23/24] migration: Simplify qemu_save_device_state() Date: Tue, 27 Jan 2026 13:52:53 -0500 Message-ID: <20260127185254.3954634-24-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260127185254.3954634-1-peterx@redhat.com> References: <20260127185254.3954634-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_H2=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development 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: 1769540187673154101 Content-Type: text/plain; charset="utf-8" This function is used by both COLO and Xen. Simplify it with two changes: - Remove checks on qemu_savevm_se_iterable(): this is not needed as vmstate_save() also checks for "save_state() || vmsd" instead. Here, save_setup() (or say, iterable states) should be mutual exclusive to "save_state() || vmsd" [*]. - Remove migrate_error_propagate(): both of the users are not using live migration framework, but raw vmstate operations. Error propagation is not needed for query-migrate persistence. [*] One tricky user is VFIO, who provided _both_ save_state() and save_setup(). However VFIO mustn't have been used in these paths or it means both COLO and Xen have ignored VFIO data instead (that is, qemu_savevm_se_iterable() will return true for VFIO). Hence, this change is safe. Cc: David Woodhouse Cc: Paul Durrant Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas Tested-by: Lukas Straub --- migration/savevm.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index 130b9764a7..b29272db3b 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1897,13 +1897,8 @@ int qemu_save_device_state(QEMUFile *f) QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { int ret; =20 - if (qemu_savevm_se_iterable(se)) { - continue; - } ret =3D vmstate_save(f, se, NULL, &local_err); if (ret) { - migrate_error_propagate(migrate_get_current(), - error_copy(local_err)); error_report_err(local_err); return ret; } --=20 2.50.1 From nobody Sun Feb 8 20:28:47 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=1769540090; cv=none; d=zohomail.com; s=zohoarc; b=E4rcrtNCYFOdKEC9wXWWynJOE/8ESRGO8kJiwYo0HcroktviOkKYBlzrCYdhO8oued6jZoGNin5Yfuuic/dUK0MoDwqYPUahPWJMyOPLWL8JkdKG/5JcdF4VR30V0ZVnXSOl1oPySVtnGAGWkLUvYrm0aGzRbr6wID382bCZ2qc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769540090; 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=oe0nLXfQkKzOiz276L4Cm+lS/ot9mCv+OCQ973ZS3S8=; b=go4pRYZTlYgzi/ZcrVKx/jTi3Lp18DL+vLaiJ9jLWjnoiPakQ+y65huS/gg0XIEqgwTtlx59I3tlhTvo9Fw95VW3hEDyy5qM9Re6EOcpiBIuYGgX04Vy/bpsAWCbp5GCwacBrXd59lRzC6Qz7f5zNkq9om+Icq7wQsV6iMZv/yA= 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 1769540090193534.6710954314025; Tue, 27 Jan 2026 10:54:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkoCv-0006Uu-50; Tue, 27 Jan 2026 13:54:33 -0500 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 1vkoBx-0003Jh-Lb for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:34 -0500 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 1vkoBv-0000tP-IN for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:53:33 -0500 Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-195-R9tUT50ePhG5prOyqDqVdg-1; Tue, 27 Jan 2026 13:53:26 -0500 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-88a39993e5fso188568876d6.3 for ; Tue, 27 Jan 2026 10:53:26 -0800 (PST) Received: from x1.com ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-894d3740e54sm2338466d6.35.2026.01.27.10.53.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 10:53:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769540009; 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=oe0nLXfQkKzOiz276L4Cm+lS/ot9mCv+OCQ973ZS3S8=; b=H7/fG7v09phRCry3NOfj+H8ognqbweID+DMrs6M08u7JSH3sQGNTzxl0tmYqgFZWr9wWnZ lvAJmVchx60nWFXY6CbNZNVNlTaipSdmBratTM921xhsjBXyyuKcCRq+K9/37iPSwdVPHZ ojsevQgd0D8QnNyC96GfcHv/NZg6Wac= X-MC-Unique: R9tUT50ePhG5prOyqDqVdg-1 X-Mimecast-MFC-AGG-ID: R9tUT50ePhG5prOyqDqVdg_1769540006 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769540006; x=1770144806; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oe0nLXfQkKzOiz276L4Cm+lS/ot9mCv+OCQ973ZS3S8=; b=qkF8M/r7j7iimdo70UBQzjkTAGTgQxf9k3m8HagArpA15YpJLqG06Q490Da51Ad7E6 iY7hSjYzGpS5WuWCh/64ZDyazWAVdW3355/ioGWrq8vjQ0TKDo1Cc59EqWMhkRoyQpbO ff1JHupF6lRrJ5D9jluDfuoW3tbZBNS2HtpsjQgSIFqnFuuqlpTuAbX8oVGHHfv4PDm6 6k16MoDkpdafSVu6Wo1gc36UNguoTK56L3fbcdxI7fx4+FEpGHP5EvnG5ki7c8Q4fMl3 BzTiFYhb2r7rWdXjS/YedWIcP9J72hQmEOptwLXY7uwMhC+guc2cJ3nE2ZJoaxmtVH5n Mtdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769540006; x=1770144806; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=oe0nLXfQkKzOiz276L4Cm+lS/ot9mCv+OCQ973ZS3S8=; b=VcZYvaltpdMbLZDQPwehHqmG3VLMngxj6PyJeCifN98XZjwPO0YmMGnDeF23PkJh0d PUBzoQw+haty0p2zl5vm5oy1ccGD6mXzMnrdHbGKpe2P5VQl2LWlRbb8NtuQB9MrtNQx Ljrt7AQsPmfDwrx+k1K7mOWSoDPozJINffyiT1cPopkurqyVnM5jJ/pAsYH95IbJ69a6 eMwhaXRkui6X6TWgBjLLvl/RHXCGlYlAY+k8fUXg0fEXRjlu2GtUr5DwwClMududKRvJ /Y7I5klXepmlvV2Sh7qnDTXl9nnXmZ1hncF1/epVvphNP0E0hOiwrwmYR49vwwLuabDG DBMA== X-Gm-Message-State: AOJu0YzYbDxNRWUFhacCVv2Rl5qkwnOxldOsGugV+98tuLuqoASua5AO TGSYXTuwe3HMzQwZxu+6cv/bbS5CJfVRpE0iZJInKPSv4XdCvlR7oaDJzOqxdZW6eSKU5gjzzW8 1kmUBgBBRkjBILbR6TxPZS3Pcl1jNSfcNPGLiCJt4qe4K9l4CX16Kjz0psXBheTqVBe4+P4k2XW QgB6gVcemW0l/CC121dLyYDr8MMwEme1P7VFnUpA== X-Gm-Gg: AZuq6aLdM/IS8prIRWsyZ7R6IkIXJFGLgUJiD1ewrlPKSjpLz3ppI2Tg2qYhsb+WXEB pQ0TRuBrVkog+BTTj8oKUDnHLjChtPYpfWaIOqpoHUJc16Cq6tMcnt1rV1hlroKHdpZzSiRCfav +xiG5etigrsYH0kmGnOY4LBgBl3dn8EUjQbmh5a7pNWCbX4TnwUsd635T4rjKj+q+iwGfkLUVFP kughz+zth/BwO6x+oj2yu4A9P3nx2wzkQFI0Mgzt87J/6PiYCvykJkEejtwm2pjI3dcKbfl1t1K O2CbLb0eHvR3eeqzd742gPelkCuTFhF6PE3pqtxxQpaIEoTv4HPhnlnQ6PUII7EY3FVp1K0R/lB H X-Received: by 2002:ad4:5764:0:b0:888:8096:a09c with SMTP id 6a1803df08f44-894cc990b51mr43687276d6.62.1769540006006; Tue, 27 Jan 2026 10:53:26 -0800 (PST) X-Received: by 2002:ad4:5764:0:b0:888:8096:a09c with SMTP id 6a1803df08f44-894cc990b51mr43686916d6.62.1769540005427; Tue, 27 Jan 2026 10:53:25 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, Lukas Straub , Prasad Pandit , Fabiano Rosas , Juraj Marcin , David Woodhouse , Paul Durrant Subject: [PATCH v2 24/24] migration/colo/xen: Use generic helpers in qemu_save_device_state() Date: Tue, 27 Jan 2026 13:52:54 -0500 Message-ID: <20260127185254.3954634-25-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260127185254.3954634-1-peterx@redhat.com> References: <20260127185254.3954634-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_H2=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development 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: 1769540092353154100 Content-Type: text/plain; charset="utf-8" Use qemu_savevm_state_non_iterable*() helpers for saving device states, rather than walking the vmstate handlers on its own. Non-iterables can be either early_setup devices, or otherwise. Note that QEMU only has one early_setup device currently, which is virtio-mem, and I highly doubt if it is used in either COLO or Xen users.. However this step is still better needed to provide full coverage of all non-iterable vmstates. When at it, allow it to report errors. Cc: David Woodhouse Cc: Paul Durrant Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas Tested-by: Lukas Straub --- migration/savevm.h | 3 +-- migration/colo.c | 2 +- migration/savevm.c | 30 +++++++++++++++--------------- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/migration/savevm.h b/migration/savevm.h index 6a589b2990..2ba0881f3b 100644 --- a/migration/savevm.h +++ b/migration/savevm.h @@ -66,8 +66,7 @@ void qemu_savevm_send_postcopy_ram_discard(QEMUFile *f, c= onst char *name, uint64_t *start_list, uint64_t *length_list); void qemu_savevm_send_colo_enable(QEMUFile *f); -int qemu_save_device_state(QEMUFile *f); - +int qemu_save_device_state(QEMUFile *f, Error **errp); int qemu_loadvm_state(QEMUFile *f, Error **errp); void qemu_loadvm_state_cleanup(MigrationIncomingState *mis); int qemu_loadvm_state_main(QEMUFile *f, MigrationIncomingState *mis, diff --git a/migration/colo.c b/migration/colo.c index db804b25a9..f7a5bd3619 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -454,7 +454,7 @@ static int colo_do_checkpoint_transaction(MigrationStat= e *s, } =20 /* Note: device state is saved into buffer */ - ret =3D qemu_save_device_state(fb); + ret =3D qemu_save_device_state(fb, &local_err); =20 bql_unlock(); if (ret < 0) { diff --git a/migration/savevm.c b/migration/savevm.c index b29272db3b..3a16c467b2 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1887,26 +1887,24 @@ static bool qemu_savevm_se_iterable(SaveStateEntry = *se) return se->ops && se->ops->save_setup; } =20 -int qemu_save_device_state(QEMUFile *f) +int qemu_save_device_state(QEMUFile *f, Error **errp) { - Error *local_err =3D NULL; - SaveStateEntry *se; - - cpu_synchronize_all_states(); + int ret; =20 - QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { - int ret; + /* Both COLO and Xen never use vmdesc, hence NULL. */ + ret =3D qemu_savevm_state_non_iterable_early(f, NULL, errp); + if (ret) { + return ret; + } =20 - ret =3D vmstate_save(f, se, NULL, &local_err); - if (ret) { - error_report_err(local_err); - return ret; - } + ret =3D qemu_savevm_state_non_iterable(f, errp); + if (ret) { + return ret; } =20 qemu_savevm_state_end(f); =20 - return qemu_file_get_error(f); + return 0; } =20 static SaveStateEntry *find_se(const char *idstr, uint32_t instance_id) @@ -3346,9 +3344,11 @@ void qmp_xen_save_devices_state(const char *filename= , bool has_live, bool live, f =3D qemu_file_new_output(QIO_CHANNEL(ioc)); object_unref(OBJECT(ioc)); qemu_savevm_send_header(f); - ret =3D qemu_save_device_state(f); + ret =3D qemu_save_device_state(f, errp); if (ret < 0 || qemu_fclose(f) < 0) { - error_setg(errp, "saving Xen device state failed"); + if (*errp =3D=3D NULL) { + error_setg(errp, "saving Xen device state failed"); + } } else { /* libxl calls the QMP command "stop" before calling * "xen-save-devices-state" and in case of migration failure, libxl --=20 2.50.1