On Fri, 23 Oct 2026 at 02:49, Bibo Mao <[email protected]> wrote:
>
> The content of TLB entry may change if LVZ is added, TLB table can
> re-establish from empty state after VM migration. There will be
> compatible issue if TLB entry is removed in vmstate, however it is
> only affect TCG mode.
>
> Signed-off-by: Bibo Mao <[email protected]>
> Reviewed-by:  Xianglai Li <[email protected]>
> ---
>  target/loongarch/machine.c | 35 -----------------------------------
>  1 file changed, 35 deletions(-)

Hi; as pointed out in https://gitlab.com/qemu-project/qemu/-/work_items/4879
this change breaks migration of a loongarch "virt-11.1" machine from
QEMU 11.1 to current head-of-git. Since loongarch supports versioned
machine types that means you must preserve migration compatibility
across QEMU versions.

In this case if the destination QEMU can reconstruct its TLB
state without the incoming information, that means you need
to accept and ignore these vmstate sections in the incoming
migration data.

> diff --git a/target/loongarch/machine.c b/target/loongarch/machine.c
> index 931a5ca5ba..952c5497af 100644
> --- a/target/loongarch/machine.c
> +++ b/target/loongarch/machine.c
> @@ -175,38 +175,6 @@ static const VMStateDescription vmstate_pmu = {
>      },
>  };
>
> -#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 = {
> -    .name = "cpu/tlb_entry",
> -    .version_id = 0,
> -    .minimum_version_id = 0,
> -    .fields = (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 = {
> -    .name = "cpu/tlb",
> -    .version_id = 0,
> -    .minimum_version_id = 0,
> -    .needed = tlb_needed,
> -    .fields = (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 = {
>      .name = "cpu",
> @@ -283,9 +251,6 @@ const VMStateDescription vmstate_loongarch_cpu = {
>          &vmstate_fpu,
>          &vmstate_lsx,
>          &vmstate_lasx,
> -#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY)
> -        &vmstate_tlb,
> -#endif
>          &vmstate_lbt,
>          &vmstate_msgint,
>          &vmstate_pmu,

thanks
-- PMM

Reply via email to