From: Cornelia Huck <cohuck@redhat.com>
To: Eric Auger <eric.auger@redhat.com>,
eric.auger.pro@gmail.com, eric.auger@redhat.com,
qemu-devel@nongnu.org, qemu-arm@nongnu.org,
peter.maydell@linaro.org, maz@kernel.org, oliver.upton@linux.dev,
sebott@redhat.com, gshan@redhat.com, ddutile@redhat.com,
peterx@redhat.com, philmd@linaro.org, pbonzini@redhat.com
Subject: Re: [PATCH v3 04/11] target/arm/machine: Allow extra regs in the incoming stream
Date: Tue, 25 Nov 2025 18:07:18 +0100 [thread overview]
Message-ID: <87jyzeoxbt.fsf@redhat.com> (raw)
In-Reply-To: <20251125100859.506228-5-eric.auger@redhat.com>
On Tue, Nov 25 2025, Eric Auger <eric.auger@redhat.com> wrote:
> Newer kernels may revoke exposure of KVM regs to userspace. This can
> happen when one notices that some registers were unconditionnally
> exposed whether they shall be conditionnally exposed for example.
>
> An example of such situation is: TCR2_EL1, PIRE0_EL1, PIR_EL1.
> Associated kernel commits were:
> 0fcb4eea5345 KVM: arm64: Hide TCR2_EL1 from userspace when disabled for guests
> a68cddbe47ef KVM: arm64: Hide S1PIE registers from userspace when disabled for guests
>
> Those commits were actual fixes but the cons is that is breaks forward
> migration on some HW. Indeed when migrating from an old kernel that
> does not feature those commits to a more recent one, destination
> qemu detects there are more KVM regs in the input migration stream than
> exposed by the destination host and the migration fails with:
> "failed to load cpu:cpreg_vmstate_array_len"
>
> This patchs adds the capability to define an array of register indexes
> that may exist in the migration incoming stream but may be not
> exposed by KVM on the destination.
>
> We provision for extra space in cpreg_vmstate_* arrays during the preload
> phase to allow the state to be saved without overflow, in case the
> registers only are in the inbound data.
>
> On postload we make sure to ignore them when analyzing potential
> mismatch between registers. The actual cpreg array is never altered
> meaning those registers are never accessed nor saved.
>
> The array will be populated with a dedicated array property.
>
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>
> ---
>
> v2 -> v3:
> - add a missing_as_expected trace point
>
> v1 -> v2:
> - get rid of the enforced/fake terminology
> - remove the useless array of fake regs. Only the number of missing
> regs is needed
>
> RFC -> v1:
> - improve comment in target/arm/cpu.h (Connie)
> ---
> target/arm/cpu.h | 22 ++++++++++++++++++++++
> target/arm/machine.c | 30 +++++++++++++++++++++---------
> target/arm/trace-events | 1 +
> 3 files changed, 44 insertions(+), 9 deletions(-)
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
next prev parent reply other threads:[~2025-11-25 17:08 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-25 10:07 [PATCH v3 00/11] Mitigation of "failed to load cpu:cpreg_vmstate_array_len" migration failures Eric Auger
2025-11-25 10:07 ` [PATCH v3 01/11] hw/arm/virt: Rename arm_virtio_compat into arm_virt_compat_defaults Eric Auger
2025-11-25 16:42 ` Cornelia Huck
2025-11-26 15:30 ` Sebastian Ott
2025-11-26 16:29 ` Sebastian Ott
2025-11-25 10:07 ` [PATCH v3 02/11] target/arm/machine: Improve traces on register mismatch during migration Eric Auger
2025-11-25 10:07 ` [PATCH v3 03/11] target/arm/cpu: Allow registers to be hidden Eric Auger
2025-11-25 17:04 ` Cornelia Huck
2025-12-22 13:17 ` Eric Auger
2025-12-22 13:21 ` Eric Auger
2025-11-26 16:28 ` Sebastian Ott
2025-11-25 10:07 ` [PATCH v3 04/11] target/arm/machine: Allow extra regs in the incoming stream Eric Auger
2025-11-25 17:07 ` Cornelia Huck [this message]
2025-11-25 10:07 ` [PATCH v3 05/11] target/arm/helper: Skip hidden registers Eric Auger
2025-11-25 10:07 ` [PATCH v3 06/11] kvm-all: Add the capability to blacklist some KVM regs Eric Auger
2025-11-25 17:09 ` Cornelia Huck
2025-11-26 16:42 ` Sebastian Ott
2025-11-25 10:07 ` [PATCH v3 07/11] target/arm/cpu: Implement hide_reg callback() Eric Auger
2025-11-25 17:10 ` Cornelia Huck
2025-11-26 16:55 ` Sebastian Ott
2025-11-25 10:07 ` [PATCH v3 08/11] target/arm/cpu: Expose x-mig-hidden-regs and x-mig-safe-missing-regs properties Eric Auger
2025-11-25 17:17 ` Cornelia Huck
2025-11-25 10:07 ` [PATCH v3 09/11] hw/arm/virt: Declare AArch32 DBGDTRTX as safe to ignore in incoming stream Eric Auger
2025-11-25 17:20 ` Cornelia Huck
2025-11-25 10:07 ` [PATCH v3 10/11] Revert "target/arm: Reinstate bogus AArch32 DBGDTRTX register for migration compat" Eric Auger
2025-11-25 10:08 ` [PATCH v3 11/11] hw/arm/virt: [DO NOT UPSTREAM] Enforce compatibility with older kernels Eric Auger
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=87jyzeoxbt.fsf@redhat.com \
--to=cohuck@redhat.com \
--cc=ddutile@redhat.com \
--cc=eric.auger.pro@gmail.com \
--cc=eric.auger@redhat.com \
--cc=gshan@redhat.com \
--cc=maz@kernel.org \
--cc=oliver.upton@linux.dev \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=sebott@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.