Linux KVM/arm64 development list
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: fuqiang wang <fuqiang.wng@gmail.com>
Cc: Oliver Upton <oupton@kernel.org>,
	Zenghui Yu <yuzenghui@huawei.com>,
	linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev,
	dongxu zhang <xu910121@sina.com>,
	wangfuqiang49 <wangfuqiang49@jd.com>,
	"diaojiaqing.1" <diaojiaqing.1@jd.com>
Subject: Re: [PATCH v2 2/2] KVM: arm64: Skip unreset vCPUs in MPIDR lookup table
Date: Thu, 18 Jun 2026 13:32:17 +0100	[thread overview]
Message-ID: <86eci4rpv2.wl-maz@kernel.org> (raw)
In-Reply-To: <ef4bd4eb-f67a-4a44-a548-08240c2eba30@gmail.com>

On Thu, 18 Jun 2026 12:38:54 +0100,
fuqiang wang <fuqiang.wng@gmail.com> 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.

      reply	other threads:[~2026-06-18 12:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-11 14:40 [PATCH v2 0/2] KVM: arm64: Fix MPIDR lookup for unreset vCPUs fuqiang wang
2026-06-11 14:40 ` [PATCH v2 1/2] arm64: Add MPIDR_EL1 RES1 definitions fuqiang wang
2026-06-11 14:40 ` [PATCH v2 2/2] KVM: arm64: Skip unreset vCPUs in MPIDR lookup table fuqiang wang
2026-06-14  9:26   ` Marc Zyngier
2026-06-15  4:20     ` Oliver Upton
2026-06-15 10:08       ` Marc Zyngier
2026-06-18 11:38         ` fuqiang wang
2026-06-18 12:32           ` Marc Zyngier [this message]

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=86eci4rpv2.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=diaojiaqing.1@jd.com \
    --cc=fuqiang.wng@gmail.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oupton@kernel.org \
    --cc=wangfuqiang49@jd.com \
    --cc=xu910121@sina.com \
    --cc=yuzenghui@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