public inbox for qemu-devel@nongnu.org
 help / color / mirror / Atom feed
From: Zhao Liu <zhao1.liu@intel.com>
To: Fiona Ebner <f.ebner@proxmox.com>
Cc: qemu-devel@nongnu.org, qemu-stable@nongnu.org, mst@redhat.com,
	marcel.apfelbaum@gmail.com, pbonzini@redhat.com,
	richard.henderson@linaro.org, eduardo@habkost.net,
	peterx@redhat.com, farosas@suse.de, wangxinxin.wang@huawei.com
Subject: Re: [PATCH v2] target/i386: add compat for migrating error code
Date: Wed, 11 Mar 2026 16:08:40 +0800	[thread overview]
Message-ID: <abEjCF+DZiRTy6CN@intel.com> (raw)
In-Reply-To: <20260310154348.495332-1-f.ebner@proxmox.com>

On Tue, Mar 10, 2026 at 04:43:23PM +0100, Fiona Ebner wrote:
> Date: Tue, 10 Mar 2026 16:43:23 +0100
> From: Fiona Ebner <f.ebner@proxmox.com>
> Subject: [PATCH v2] target/i386: add compat for migrating error code
> X-Mailer: git-send-email 2.47.3
> 
> If cpu->env.has_error_code is true, backwards migration of a VM from
> a QEMU binary with commit 27535e9cca to a QEMU binary without commit
> 27535e9cca will fail:
> 
> > kvm: error while loading state for instance 0x0 of device 'cpu'
> 
> In practice, wrongly setting the error code to 0 on the target is
> often unproblematic, so additionally checking error_code != 0 in
> cpu_errcode_needed() is not enough to mitigate the issue. Instead, add
> proper machine version compat handling.
> 
> Cc: qemu-stable@nongnu.org
> Fixes: 27535e9cca ("target/i386: Add support for save/load of exception error code")
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
> 
> Changes in v2:
> * Add proper machine version compat rather than just checking if
>   error_code != 0.
> 
>  hw/i386/pc.c          | 1 +
>  target/i386/cpu.c     | 1 +
>  target/i386/cpu.h     | 1 +
>  target/i386/machine.c | 2 +-
>  4 files changed, 4 insertions(+), 1 deletion(-)

...

> diff --git a/target/i386/cpu.h b/target/i386/cpu.h
> index 5a62aa6157..ecae8593c8 100644
> --- a/target/i386/cpu.h
> +++ b/target/i386/cpu.h
> @@ -2361,6 +2361,7 @@ struct ArchCPU {
>      bool expose_tcg;
>      bool migratable;
>      bool migrate_smi_count;

only a nit, it's better to have a comment like:

    /*
     * Compatibility bits for old machine types.
     * If true, allow to migrate error code.
     */

> +    bool migrate_error_code;
>      uint32_t apic_id;

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>



  reply	other threads:[~2026-03-11  7:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-10 15:43 [PATCH v2] target/i386: add compat for migrating error code Fiona Ebner
2026-03-11  8:08 ` Zhao Liu [this message]
2026-03-11 16:14 ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=abEjCF+DZiRTy6CN@intel.com \
    --to=zhao1.liu@intel.com \
    --cc=eduardo@habkost.net \
    --cc=f.ebner@proxmox.com \
    --cc=farosas@suse.de \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=wangxinxin.wang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox