[PATCH v7 0/6] ARM virt: Support CPU cluster topology

Yanan Wang via posted 6 patches 2 years, 3 months ago
Test checkpatch failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220107083232.16256-1-wangyanan55@huawei.com
Maintainers: Ani Sinha <ani@anisinha.ca>, Peter Maydell <peter.maydell@linaro.org>, Igor Mammedov <imammedo@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>
hw/acpi/aml-build.c       |  68 ++++++++++++++++++++++++++++----------
hw/arm/virt.c             |  16 +++++----
qemu-options.hx           |  10 ++++++
tests/data/acpi/virt/PPTT | Bin 76 -> 96 bytes
4 files changed, 69 insertions(+), 25 deletions(-)
[PATCH v7 0/6] ARM virt: Support CPU cluster topology
Posted by Yanan Wang via 2 years, 3 months ago
This v7 series enables the support for CPU cluster topology on
ARM virt machines. The generic infrastructure for CPU cluster
parameter has been in upstream.

Background and descriptions:
The new Cluster-Aware Scheduling support has landed in Linux 5.16,
which has been proved to benefit the scheduling performance (e.g.
load balance and wake_affine strategy) for both x86_64 and AArch64.
We can see the PR [1] or the actual patch series [2] for reference.

So since Linux 5.16 we have four-level arch-neutral CPU topology
definition like below and a new scheduler level for clusters.
struct cpu_topology {
    int thread_id;
    int core_id;
    int cluster_id;
    int package_id;
    int llc_id;
    cpumask_t thread_sibling;
    cpumask_t core_sibling;
    cpumask_t cluster_sibling;
    cpumask_t llc_sibling;
}

A cluster generally means a group of CPU cores which share L2 cache
or other mid-level resources, and it is the shared resources that
is used to improve scheduler's behavior. From the point of view of
the size range, it's between CPU die and CPU core. For example, on
some ARM64 Kunpeng servers, we have 6 clusters in each NUMA node,
and 4 CPU cores in each cluster. The 4 CPU cores share a separate
L2 cache and a L3 cache tag, which brings cache affinity advantage.

[1] https://lore.kernel.org/lkml/163572864855.3357115.17938524897008353101.tglx@xen13/
[2] https://lkml.org/lkml/2021/9/24/178

In virtualization, on the Hosts which have physical clusters, if we
can design a vCPU topology with cluster level for guest kernel and
have a dedicated vCPU pinning. A Cluster-Aware Guest kernel can also
make use of the cache affinity of CPU clusters to gain similar
scheduling performance. This series only enables clusters support
in the vCPU topology on ARM virt machines. We can also enable it
for other machine types in the future if needed.

The patches in this series do:
- Enable CPU cluster support on ARM virt machines, so that users
  can specify a 4-level CPU hierarchy sockets/clusters/cores/threads.
  And the 4-level topology will be described to guest kernel through
  ACPI PPTT and DT cpu-map.

Changelog:
v6->v7:
- dropped the introduced ARM specific build_pptt() and extend the generic one
- added A-bs/R-bs from Andrew and Ani, thanks.
- v6: https://patchew.org/QEMU/20220103084636.2496-1-wangyanan55@huawei.com/

v5->v6:
- dropped the generic part which is in upstream now
- rebased on latest master
- v5: https://patchew.org/QEMU/20211228092221.21068-1-wangyanan55@huawei.com/

Yanan Wang (6):
  hw/arm/virt: Support CPU cluster on ARM virt machine
  hw/arm/virt: Support cluster level in DT cpu-map
  hw/acpi/aml-build: Improve scalability of PPTT generation
  tests/acpi/bios-tables-test: Allow changes to virt/PPTT file
  hw/acpi/aml-build: Support cluster level in PPTT generation
  tests/acpi/bios-table-test: Update expected virt/PPTT file

 hw/acpi/aml-build.c       |  68 ++++++++++++++++++++++++++++----------
 hw/arm/virt.c             |  16 +++++----
 qemu-options.hx           |  10 ++++++
 tests/data/acpi/virt/PPTT | Bin 76 -> 96 bytes
 4 files changed, 69 insertions(+), 25 deletions(-)

-- 
2.27.0


Re: [PATCH v7 0/6] ARM virt: Support CPU cluster topology
Posted by Peter Maydell 2 years, 3 months ago
On Fri, 7 Jan 2022 at 08:32, Yanan Wang <wangyanan55@huawei.com> wrote:
>
> This v7 series enables the support for CPU cluster topology on
> ARM virt machines. The generic infrastructure for CPU cluster
> parameter has been in upstream.

> The patches in this series do:
> - Enable CPU cluster support on ARM virt machines, so that users
>   can specify a 4-level CPU hierarchy sockets/clusters/cores/threads.
>   And the 4-level topology will be described to guest kernel through
>   ACPI PPTT and DT cpu-map.
>
> Changelog:
> v6->v7:
> - dropped the introduced ARM specific build_pptt() and extend the generic one
> - added A-bs/R-bs from Andrew and Ani, thanks.
> - v6: https://patchew.org/QEMU/20220103084636.2496-1-wangyanan55@huawei.com/

Applied to target-arm.next, thanks.

(People who've been reviewing this series -- let me know if you
wanted more time for it.)

-- PMM