From nobody Mon Nov 23 04:30:08 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794881061621150.02439324241482; Mon, 16 Nov 2026 18:04:21 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xT8Y1-0007DS-1A; Mon, 16 Nov 2026 21:03:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xT8Xu-0007Ce-Rv for qemu-devel@nongnu.org; Mon, 16 Nov 2026 21:03:42 -0500 Received: from mail.loongson.cn ([114.242.206.163]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xT8Xs-0002Vs-02 for qemu-devel@nongnu.org; Mon, 16 Nov 2026 21:03:42 -0500 Received: from loongson.cn (unknown [10.40.46.54]) by gateway (Coremail) with SMTP id _____8DxOvD3tftqN1IgAA--.28063S3; Tue, 17 Nov 2026 10:03:35 +0800 (CST) Received: from fedora.loongson.cn (unknown [127.0.0.1]) by front1 (Coremail) with SMTP id qMiowJBxJs3rtftqAxo1AA--.64899S3; Tue, 17 Nov 2026 10:03:32 +0800 (CST) From: Bibo Mao To: Song Gao <17746591750@163.com>, Peter Maydell Cc: Xianglai Li , qemu-devel@nongnu.org Subject: [PATCH v2 1/2] Revert "target/loongarch: Remove TLB entry in vmstate" Date: Tue, 17 Nov 2026 10:04:57 +0800 Message-ID: <20261117020458.2203333-2-maobibo@loongson.cn> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20261117020458.2203333-1-maobibo@loongson.cn> References: <20261117020458.2203333-1-maobibo@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: qMiowJBxJs3rtftqAxo1AA--.64899S3 X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBj93XoWxAr1DuF1xuFW7Xr4kGw4xKrX_yoW5Wry8pF n8Ca45KF18KrZ7W3yfJ345uFs8Wr18G342qFsrGw1rKayfGw1rXrs7t39FqFWfAa45Xr1I vF1Fq34DWF4UZ3gCm3ZEXasCq-sJn29KB7ZKAUJUUUU5529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUkjb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Jr0_Gr1l84ACjcxK6I8E87Iv67AKxVW8JVWxJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_ Gr0_Gr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx1l5I 8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r126r1DMcIj6I8E87Iv67AK xVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2Ij64 vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8G jcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2I x0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK 8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I 0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07j83kZUUUUU= 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=lists1p.gnu.org; Received-SPF: pass client-ip=114.242.206.163; envelope-from=maobibo@loongson.cn; helo=mail.loongson.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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-ZM-MESSAGEID: 1794881062862158500 Content-Type: text/plain; charset="utf-8" This reverts commit 9e771d547b72d1eecd962725fad7508af3b97183. The reverted change drops the vmstate_tlb fields on the assumption that LoongArch guests can rebuild TLB entries from scratch. That assumption is functionally valid, but the change was not gated behind a new machine type, so it altered the migration stream layout of the already-released virt-11.1 machine. As a result, migration from QEMU 11.1 to current master fails. With the revert applied, migration succeeds with: (receiver, current master) qemu-system-loongarch64 -M virt-11.1 -m 256M -display none \ -incoming "exec:cat /tmp/loongarch-virt-11.1.mig" -monitor stdio using the stream produced by QEMU 11.1 (sender): qemu-system-loongarch64 -M virt-11.1 -m 256M -display none -monitor stdio (qemu) migrate "exec:cat > /tmp/loongarch-virt-11.1.mig" Revert restores the virt-11.1 migration layout. If the TLB-dropping optimisation is still desirable, it should be re-introduced behind a new machine type (e.g. virt-11.2) so that existing guests remain migratable. Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4879 Signed-off-by: Bibo Mao Tested-by: Karl Mehltretter --- target/loongarch/machine.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/target/loongarch/machine.c b/target/loongarch/machine.c index 4acab2a4a3..957dc2ed71 100644 --- a/target/loongarch/machine.c +++ b/target/loongarch/machine.c @@ -175,6 +175,38 @@ static const VMStateDescription vmstate_pmu =3D { }, }; =20 +#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY) +static bool tlb_needed(void *opaque) +{ + return tcg_enabled(); +} + +/* TLB state */ +static const VMStateDescription vmstate_tlb_entry =3D { + .name =3D "cpu/tlb_entry", + .version_id =3D 0, + .minimum_version_id =3D 0, + .fields =3D (const VMStateField[]) { + VMSTATE_UINT64(tlb_misc, LoongArchTLB), + VMSTATE_UINT64(tlb_entry0, LoongArchTLB), + VMSTATE_UINT64(tlb_entry1, LoongArchTLB), + VMSTATE_END_OF_LIST() + } +}; + +static const VMStateDescription vmstate_tlb =3D { + .name =3D "cpu/tlb", + .version_id =3D 0, + .minimum_version_id =3D 0, + .needed =3D tlb_needed, + .fields =3D (const VMStateField[]) { + VMSTATE_STRUCT_ARRAY(env.tlb, LoongArchCPU, LOONGARCH_TLB_MAX, + 0, vmstate_tlb_entry, LoongArchTLB), + VMSTATE_END_OF_LIST() + } +}; +#endif + /* LoongArch CPU state */ const VMStateDescription vmstate_loongarch_cpu =3D { .name =3D "cpu", @@ -251,6 +283,9 @@ const VMStateDescription vmstate_loongarch_cpu =3D { &vmstate_fpu, &vmstate_lsx, &vmstate_lasx, +#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY) + &vmstate_tlb, +#endif &vmstate_lbt, &vmstate_msgint, &vmstate_pmu, --=20 2.54.0 From nobody Mon Nov 23 04:30:08 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794881057006435.5007012958047; Mon, 16 Nov 2026 18:04:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xT8Y1-0007DW-Hh; Mon, 16 Nov 2026 21:03:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xT8Xy-0007Cw-B7 for qemu-devel@nongnu.org; Mon, 16 Nov 2026 21:03:46 -0500 Received: from mail.loongson.cn ([114.242.206.163]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xT8Xs-0002Vr-6r for qemu-devel@nongnu.org; Mon, 16 Nov 2026 21:03:43 -0500 Received: from loongson.cn (unknown [10.40.46.54]) by gateway (Coremail) with SMTP id _____8CxvtD3tftqOlIgAA--.340S3; Tue, 17 Nov 2026 10:03:35 +0800 (CST) Received: from fedora.loongson.cn (unknown [127.0.0.1]) by front1 (Coremail) with SMTP id qMiowJBxJs3rtftqAxo1AA--.64899S4; Tue, 17 Nov 2026 10:03:35 +0800 (CST) From: Bibo Mao To: Song Gao <17746591750@163.com>, Peter Maydell Cc: Xianglai Li , qemu-devel@nongnu.org Subject: [PATCH v2 2/2] target/loongarch: Discard vmstate_tlb field Date: Tue, 17 Nov 2026 10:04:58 +0800 Message-ID: <20261117020458.2203333-3-maobibo@loongson.cn> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20261117020458.2203333-1-maobibo@loongson.cn> References: <20261117020458.2203333-1-maobibo@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: qMiowJBxJs3rtftqAxo1AA--.64899S4 X-CM-SenderInfo: xp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cSsGvfC2KfnxnUUI43ZEXa7IU8rwIDUUUUU== 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=lists1p.gnu.org; Received-SPF: pass client-ip=114.242.206.163; envelope-from=maobibo@loongson.cn; helo=mail.loongson.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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-ZM-MESSAGEID: 1794881058685158500 Content-Type: text/plain; charset="utf-8" TLB in destination can reconstruct from scratch, it is not necessary to migrate the TLB entries. Here set return value as false in function tlb_needed(), so that vmstate_tlb field is discard during migration. Signed-off-by: Bibo Mao Tested-by: Karl Mehltretter --- target/loongarch/machine.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/target/loongarch/machine.c b/target/loongarch/machine.c index 957dc2ed71..a91700cbff 100644 --- a/target/loongarch/machine.c +++ b/target/loongarch/machine.c @@ -178,7 +178,11 @@ static const VMStateDescription vmstate_pmu =3D { #if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY) static bool tlb_needed(void *opaque) { - return tcg_enabled(); + /* + * Not needed, will remove field of vmstate_tlb when virt-11.1 is + * deprecated. + */ + return false; } =20 /* TLB state */ --=20 2.54.0