public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Alexandru Elisei <alexandru.elisei@arm.com>
Cc: Andrew Jones <drjones@redhat.com>,
	Ying Fang <fangying1@huawei.com>,
	kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu,
	james.morse@arm.com, julien.thierry.kdev@gmail.com,
	suzuki.poulose@arm.com, zhang.zhanghailiang@huawei.com,
	alex.chen@huawei.com
Subject: Re: [PATCH 2/2] kvm/arm: Add mp_affinity for arm vcpu
Date: Thu, 17 Sep 2020 11:01:39 +0100	[thread overview]
Message-ID: <b88c7988a00c25a9ae0fdd373ba45227@kernel.org> (raw)
In-Reply-To: <12a47a99-9857-b86d-6c45-39fdee08613e@arm.com>

On 2020-09-17 10:47, Alexandru Elisei wrote:
> Hi,
> 
> On 9/17/20 9:42 AM, Marc Zyngier wrote:
>> On 2020-09-17 09:04, Andrew Jones wrote:
>>> On Thu, Sep 17, 2020 at 08:47:42AM +0100, Marc Zyngier wrote:
>>>> On 2020-09-17 03:30, Ying Fang wrote:
>>>> > Allow userspace to set MPIDR using vcpu ioctl KVM_ARM_SET_MP_AFFINITY,
>>>> > so that we can support cpu topology for arm.
>>>> 
>>>> MPIDR has *nothing* to do with CPU topology in the ARM architecture.
>>>> I encourage you to have a look at the ARM ARM and find out how often
>>>> the word "topology" is used in conjunction with the MPIDR_EL1 
>>>> register.
>>>> 
>>> 
>>> Hi Marc,
>>> 
>>> I mostly agree. However, the CPU topology descriptions use MPIDR to
>>> identify PEs. If userspace wants to build topology descriptions then
>>> it either needs to
>>> 
>>> 1) build them after instantiating all KVM VCPUs in order to query KVM
>>>    for each MPIDR, or
>>> 2) have a way to ask KVM for an MPIDR of given VCPU ID in advance
>>>    (maybe just a scratch VCPU), or
>>> 3) have control over the MPIDRs so it can choose them when it likes,
>>>    use them for topology descriptions, and then instantiate KVM VCPUs
>>>    with them.
>>> 
>>> I think (3) is the most robust approach, and it has the least 
>>> overhead.
>> 
>> I don't disagree with the goal, and not even with the choice of
>> implementation (though I have huge reservations about its quality).
>> 
>> But the key word here is *userspace*. Only userspace has a notion of
>> how MPIDR values map to the assumed topology. That's not something
>> that KVM does nor should interpret (aside from the GIC-induced Aff0
>> brain-damage). So talking of "topology" in a KVM kernel patch sends
>> the wrong message, and that's all this remark was about.
> 
> There's also a patch queued for next which removes using MPIDR as a 
> source of
> information about CPU topology [1]: "arm64: topology: Stop using MPIDR 
> for
> topology information".
> 
> I'm not really sure how useful KVM fiddling with the guest MPIDR will 
> be going
> forward, at least for a Linux guest.

I think these are two orthogonal things. There is value in setting MPIDR
to something different as a way to replicate an existing system, for
example. But deriving *any* sort of topology information from MPIDR 
isn't
reliable at all, and is better expressed by firmware tables (and even
that isn't great).

As far as I am concerned, this patch fits in the "cosmetic" department.
It's a "nice to have", but doesn't really solve much. Firmware tables
and userspace placement of the vcpus are key.

Thanks,

         M.
-- 
Jazz is not dead. It just smells funny...

  reply	other threads:[~2020-09-17 10:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-17  2:30 [PATCH 0/2] KVM: arm64: Add support for setting MPIDR Ying Fang
2020-09-17  2:30 ` [PATCH 1/2] KVM: arm64: add KVM_CAP_ARM_MP_AFFINITY extension Ying Fang
2020-09-17  7:23   ` Andrew Jones
2020-09-17  2:30 ` [PATCH 2/2] kvm/arm: Add mp_affinity for arm vcpu Ying Fang
2020-09-17  7:36   ` Andrew Jones
2020-09-17  7:47   ` Marc Zyngier
2020-09-17  8:04     ` Andrew Jones
2020-09-17  8:42       ` Marc Zyngier
2020-09-17  9:47         ` Alexandru Elisei
2020-09-17 10:01           ` Marc Zyngier [this message]
2020-09-17 10:53             ` Andrew Jones
2020-09-17 11:51     ` Ying Fang

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=b88c7988a00c25a9ae0fdd373ba45227@kernel.org \
    --to=maz@kernel.org \
    --cc=alex.chen@huawei.com \
    --cc=alexandru.elisei@arm.com \
    --cc=drjones@redhat.com \
    --cc=fangying1@huawei.com \
    --cc=james.morse@arm.com \
    --cc=julien.thierry.kdev@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=suzuki.poulose@arm.com \
    --cc=zhang.zhanghailiang@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