Re: [PATCH v2 2/2] KVM: arm64: Skip unreset vCPUs in MPIDR lookup table

From: Marc Zyngier

Date: Thu Jun 18 2026 - 08:32:29 EST


On Thu, 18 Jun 2026 12:38:54 +0100,
fuqiang wang <fuqiang.wng@xxxxxxxxx> wrote:
>
> However, could we detect collisions within the init function and, upon
> detection, notify userspace without taking any corrective or fallback
> action? This would serve as a stronger reminder to userspace of its
> non-compliant behavior.
>
> e.g.
>
> diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
> index 3732ee9eb0d4..7563feab1a11 100644
> --- a/arch/arm64/kvm/arm.c
> +++ b/arch/arm64/kvm/arm.c
> @@ -893,6 +893,17 @@ static void kvm_init_mpidr_data(struct kvm *kvm)
> data->cmpidr_to_idx[index] = c;
> }
>
> + kvm_for_each_vcpu(c, vcpu, kvm) {
> + u64 aff = kvm_vcpu_get_mpidr_aff(vcpu);
> + u16 index = kvm_mpidr_index(data, aff);
> +
> + if (data->cmpidr_to_idx[index] != c) {
> + pr_warn("Multiple vCPUs share the same MPIDR value, "
> + "it may cause the guest to hang or run slower\n");
> + break;
> + }
> + }
> +

That's not reporting anything to userspace. That's just screaming in
the kernel log, and a random user does not have access to that.

If you wanted the user to take notice, you'd need to fail the entry
into the guest.

M.

--
Without deviation from the norm, progress is not possible.