From nobody Wed Apr 8 01:20:02 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=bytedance.com ARC-Seal: i=1; a=rsa-sha256; t=1773206268; cv=none; d=zohomail.com; s=zohoarc; b=H9sO2AkcgnV3Ek/rQPyXwEiQorE2nQHqXfV8xOWubSi5mBRn+hWMNEoMPOU73676HwstdxW621xMFc8attnzfnlMiqujF9mPwsxS/ZFrqnlABUH6asmYK6KH9/bimNqVGhTHR8nO2gjhRtTOhrjNFIPRDUX6320ZOLnUvUCLV9c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773206268; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Gy4SfHfJxOuY+25XeZZKLoUaXoKj3Tsevtcwd81Vgxw=; b=cc4xszCCFxKT9VwbpuPDYgzZ3x5FyNLNXvaR5ygIUVgikK/qs39WgEuqXYQYzoFSVc+vjfmyaeEqkeNC62lZvKFq15V7P5mOlpBkrewBX71wWlzn43+NosdSVNZZG6zfY06wkwf0icm0RucOSnZwnAbCvznfhb9xNtZ2461CPHA= 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 1773206268289606.869145424428; Tue, 10 Mar 2026 22:17:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w0Bwq-0007sz-Fo; Wed, 11 Mar 2026 01:17:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w0Bwo-0007sg-IZ for qemu-devel@nongnu.org; Wed, 11 Mar 2026 01:17:30 -0400 Received: from va-2-111.ptr.blmpb.com ([209.127.231.111]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1w0Bwj-0003LX-Oh for qemu-devel@nongnu.org; Wed, 11 Mar 2026 01:17:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=2212171451; d=bytedance.com; t=1773206232; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=Gy4SfHfJxOuY+25XeZZKLoUaXoKj3Tsevtcwd81Vgxw=; b=ErTl02moxsMS3yLcqFCiavN7vqYbeXhcxdev7R21eXnQjiWZKaXxNPCT1kTTZYjBN2zLgV DuU9083yfSZ9lO5zorVKBDdETAnENh37CM33v9IP49rcqHscpPIlpu2FW9+8BR9XcFQ3l4 kXXyln+ghPJtKy1UdXyl7DLyXPBdSzFp9atb/Jigvdvd3p7vPH7VozENj5PFrzjq38LLfK tD2v3SWdGEhzUbkvBSgobvtwhAJKMwDckZn66jpdq0cHAGSredIxBCgFBrhW6/sX1GRSbo Vp9bz29CmTXxx7EyPctTxEVnRVSUkQ884u6YBp9YDljQXKrQh0jxxuriGzsvNw== Mime-Version: 1.0 X-Lms-Return-Path: From: "Yanfei Xu" X-Mailer: git-send-email 2.20.1 Subject: [PATCH] migration: check is_active for old-style vmstate Date: Wed, 11 Mar 2026 13:16:58 +0800 To: Cc: , , , , Message-Id: <20260311051658.1074299-1-yanfei.xu@bytedance.com> X-Original-From: Yanfei Xu 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=209.127.231.111; envelope-from=yanfei.xu@bytedance.com; helo=va-2-111.ptr.blmpb.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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 @bytedance.com) X-ZM-MESSAGEID: 1773206270275158500 Content-Type: text/plain; charset="utf-8" old-style vmstate doesn't use vmsd and instead rely on SaveStateEntry ops. Check is_active for old-style vmstate to determine whether they should be skipped during migration. Signed-off-by: Yanfei Xu --- migration/savevm.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/migration/savevm.c b/migration/savevm.c index 197c89e0e6..7eee83ffca 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1030,15 +1030,27 @@ static int vmstate_save(QEMUFile *f, SaveStateEntry= *se, JSONWriter *vmdesc, Error **errp) { int ret; + const bool has_old_style =3D se->ops && se->ops->save_state; =20 - if ((!se->ops || !se->ops->save_state) && !se->vmsd) { + if (!has_old_style && !se->vmsd) { return 0; + } else if (has_old_style && se->vmsd) { + error_report("%s: '%s' (section_id=3D%u): unexpected: both vmsd (%= s) and" + " old-style save_state are set", __func__, se->idstr, + se->section_id, se->vmsd->name); + return -EINVAL; } + if (se->vmsd && !vmstate_section_needed(se->vmsd, se->opaque)) { trace_savevm_section_skip(se->idstr, se->section_id); return 0; } =20 + if (has_old_style && se->ops->is_active && !se->ops->is_active(se->opa= que)) { + trace_savevm_section_skip(se->idstr, se->section_id); + return 0; + } + trace_savevm_section_start(se->idstr, se->section_id); save_section_header(f, se, QEMU_VM_SECTION_FULL); if (vmdesc) { --=20 2.20.1