qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Ying Fang <fangying1@huawei.com>
To: Andrew Jones <drjones@redhat.com>
Cc: "peter.maydell@linaro.org" <peter.maydell@linaro.org>,
	Zhanghailiang <zhang.zhanghailiang@huawei.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"Chenzhendong \(alex\)" <alex.chen@huawei.com>,
	"shannon.zhaosl@gmail.com" <shannon.zhaosl@gmail.com>,
	"qemu-arm@nongnu.org" <qemu-arm@nongnu.org>,
	"alistair.francis@wdc.com" <alistair.francis@wdc.com>,
	"Zengtao \(B\)" <prime.zeng@hisilicon.com>,
	"imammedo@redhat.com" <imammedo@redhat.com>,
	"valentin.schneider@arm.com" <valentin.schneider@arm.com>
Subject: Re: [RFC PATCH 00/12] hw/arm/virt: Introduce cpu and cache topology support
Date: Tue, 20 Oct 2020 10:52:11 +0800	[thread overview]
Message-ID: <36d177cb-1328-7911-2cb1-7026fc14b1ea@huawei.com> (raw)
In-Reply-To: <20201016100701.7oojzwpgh6ka4fq6@kamzik.brq.redhat.com>



On 10/16/2020 6:07 PM, Andrew Jones wrote:
> On Fri, Oct 16, 2020 at 05:40:02PM +0800, Ying Fang wrote:
>>
>>
>> On 10/15/2020 3:59 PM, Andrew Jones wrote:
>>> On Thu, Oct 15, 2020 at 10:07:16AM +0800, Ying Fang wrote:
>>>>
>>>>
>>>> On 10/14/2020 2:08 AM, Andrew Jones wrote:
>>>>> On Tue, Oct 13, 2020 at 12:11:20PM +0000, Zengtao (B) wrote:
>>>>>> Cc valentin
>>>>>>
>>>>>>> -----Original Message-----
>>>>>>> From: Qemu-devel
>>>>>>> [mailto:qemu-devel-bounces+prime.zeng=hisilicon.com@nongnu.org]
>>>>>>> On Behalf Of Ying Fang
>>>>>>> Sent: Thursday, September 17, 2020 11:20 AM
>>>>>>> To: qemu-devel@nongnu.org
>>>>>>> Cc: peter.maydell@linaro.org; drjones@redhat.com; Zhanghailiang;
>>>>>>> Chenzhendong (alex); shannon.zhaosl@gmail.com;
>>>>>>> qemu-arm@nongnu.org; alistair.francis@wdc.com; fangying;
>>>>>>> imammedo@redhat.com
>>>>>>> Subject: [RFC PATCH 00/12] hw/arm/virt: Introduce cpu and cache
>>>>>>> topology support
>>>>>>>
>>>>>>> An accurate cpu topology may help improve the cpu scheduler's
>>>>>>> decision
>>>>>>> making when dealing with multi-core system. So cpu topology
>>>>>>> description
>>>>>>> is helpful to provide guest with the right view. Cpu cache information
>>>>>>> may
>>>>>>> also have slight impact on the sched domain, and even userspace
>>>>>>> software
>>>>>>> may check the cpu cache information to do some optimizations. Thus
>>>>>>> this patch
>>>>>>> series is posted to provide cpu and cache topology support for arm.
>>>>>>>
>>>>>>> To make the cpu topology consistent with MPIDR, an vcpu ioctl
>>>>>>
>>>>>> For aarch64, the cpu topology don't depends on the MPDIR.
>>>>>> See https://patchwork.kernel.org/patch/11744387/
>>>>>>
>>>>>
>>>>> The topology should not be inferred from the MPIDR Aff fields,
>>>>
>>>> MPIDR is abused by ARM OEM manufactures. It is only used as a
>>>> identifer for a specific cpu, not representation of the topology.
>>>
>>> Right, which is why I stated topology should not be inferred from
>>> it.
>>>
>>>>
>>>>> but MPIDR is the CPU identifier. When describing a topology
>>>>> with ACPI or DT the CPU elements in the topology description
>>>>> must map to actual CPUs. MPIDR is that mapping link. KVM
>>>>> currently determines what the MPIDR of a VCPU is. If KVM
>>>>
>>>> KVM currently assigns MPIDR with vcpu->vcpu_id which mapped
>>>> into affinity levels. See reset_mpidr in sys_regs.c
>>>
>>> I know, but how KVM assigns MPIDRs today is not really important
>>> to KVM userspace. KVM userspace shouldn't depend on a KVM
>>> algorithm, as it could change.
>>>
>>>>
>>>>> userspace is going to determine the VCPU topology, then it
>>>>> also needs control over the MPIDR values, otherwise it
>>>>> becomes quite messy trying to get the mapping right.
>>>> If we are going to control MPIDR, shall we assign MPIDR with
>>>> vcpu_id or map topology hierarchy into affinity levels or any
>>>> other link schema ?
>>>>
>>>
>>> We can assign them to whatever we want, as long as they're
>>> unique and as long as Aff0 is assigned per the GIC requirements,
>>> e.g. GICv3 requires that Aff0 be from 0 to 0xf. Also, when
>>> pinning VCPUs to PCPUs we should ensure that MPIDRs with matching
>>> Aff3,Aff2,Aff1 fields should actually be peers with respect to
>>> the GIC.
>>
>> Still not clear why vCPU's MPIDR need to match pPCPU's GIC affinity.
>> Maybe I should read spec for GICv3.
> 
> Look at how IPIs are efficiently sent to "peers", where the definition
> of a peer is that only Aff0 differs in its MPIDR. But, gicv3's
> optimizations can only handle 16 peers. If we want pinned VCPUs to
> have the same performance as PCPUS, then we should maintain this
> Aff0 limit.

Yes I see. I think *virt_cpu_mp_affinity* in qemu has limit
on the clustersz. It groups every 16 vCPUs into a cluster
and then mapped into the first two affinity levels.

Thanks.
Ying.

> 
> Thanks,
> drew
> 
>>
>>>
>>> We shouldn't try to encode topology in the MPIDR in any way,
>>> so we might as well simply increment a counter to assign them,
>>> which could possibly be the same as the VCPU ID.
>>
>> Hmm, then we can leave it as it is.
>>
>>>
>>> Thanks,
>>> drew
>>>
>>> .
>>>
>>
> 
> .
> 


  reply	other threads:[~2020-10-20  2:53 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-17  3:20 [RFC PATCH 00/12] hw/arm/virt: Introduce cpu and cache topology support Ying Fang
2020-09-17  3:20 ` [RFC PATCH 01/12] linux headers: Update linux header with KVM_ARM_SET_MP_AFFINITY Ying Fang
2020-09-17  3:20 ` [RFC PATCH 02/12] target/arm/kvm64: make MPIDR consistent with CPU Topology Ying Fang
2020-09-17  7:53   ` Andrew Jones
2020-09-17 10:59     ` Andrew Jones
2020-09-17 13:19       ` Ying Fang
2020-09-17 14:05         ` Andrew Jones
2020-09-17 12:17     ` Ying Fang
2020-09-17  3:20 ` [RFC PATCH 03/12] target/arm/kvm32: " Ying Fang
2020-09-17  8:07   ` Andrew Jones
2020-09-17 13:26     ` Ying Fang
2020-09-17  3:20 ` [RFC PATCH 04/12] device_tree: add qemu_fdt_add_path Ying Fang
2020-09-17  8:12   ` Andrew Jones
2020-09-17 13:55     ` Ying Fang
2020-09-18  0:25     ` Salil Mehta
2020-09-18  6:06       ` Andrew Jones
2020-09-18 16:58         ` Salil Mehta
2020-09-17  3:20 ` [RFC PATCH 05/12] hw/arm/virt: DT: add cpu-map Ying Fang
2020-09-17  8:14   ` Andrew Jones
2020-09-17  3:20 ` [RFC PATCH 06/12] hw/arm/virt-acpi-build: distinguish possible and present cpus Ying Fang
2020-09-17  8:20   ` Andrew Jones
2020-09-17 13:58     ` Ying Fang
2020-09-17  3:20 ` [RFC PATCH 07/12] hw/acpi/aml-build: add processor hierarchy node structure Ying Fang
2020-09-17  8:27   ` Andrew Jones
2020-09-17 14:03     ` Ying Fang
2020-09-17  3:20 ` [RFC PATCH 08/12] hw/arm/virt-acpi-build: add PPTT table Ying Fang
2020-09-17  8:28   ` Andrew Jones
2020-09-17  3:20 ` [RFC PATCH 09/12] target/arm/cpu: Add CPU cache description for arm Ying Fang
2020-09-17  8:39   ` Andrew Jones
2020-09-17 14:11     ` Ying Fang
2020-09-17  3:20 ` [RFC PATCH 10/12] hw/arm/virt: add fdt cache information Ying Fang
2020-09-17  3:20 ` [RFC PATCH 11/12] hw/acpi/aml-build: build ACPI CPU cache topology information Ying Fang
2020-09-17  3:20 ` [RFC PATCH 12/12] hw/arm/virt-acpi-build: Enable CPU cache topology Ying Fang
2020-10-13 12:11 ` [RFC PATCH 00/12] hw/arm/virt: Introduce cpu and cache topology support Zengtao (B)
2020-10-13 18:08   ` Andrew Jones
2020-10-15  2:07     ` Ying Fang
2020-10-15  7:59       ` Andrew Jones
2020-10-16  9:40         ` Ying Fang
2020-10-16 10:07           ` Andrew Jones
2020-10-20  2:52             ` Ying Fang [this message]
2020-10-20  8:20               ` Andrew Jones

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=36d177cb-1328-7911-2cb1-7026fc14b1ea@huawei.com \
    --to=fangying1@huawei.com \
    --cc=alex.chen@huawei.com \
    --cc=alistair.francis@wdc.com \
    --cc=drjones@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=prime.zeng@hisilicon.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=shannon.zhaosl@gmail.com \
    --cc=valentin.schneider@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;
as well as URLs for NNTP newsgroup(s).