mbox series

[RFC,v3,0/9] hw/arm/virt: Introduce cpu topology support

Message ID 20210516102900.28036-1-wangyanan55@huawei.com (mailing list archive)
Headers show
Series hw/arm/virt: Introduce cpu topology support | expand

Message

Yanan Wang May 16, 2021, 10:28 a.m. UTC
Hi,

This is v3 of the series [1] that I posted to introduce support of
generating cpu topology descriptions to guest.

Description:
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. Dario Faggioli's talk
in [2] also shows the virtual topology could have impact on scheduling
performace. Thus this patch series introduces cpu topology support for
ARM platform.

In this series, both cpu-map in DT and ACPI PPTT table are introduced
to present cpu topology to the guest. And a new helper virt_smp_parse
not like the default one is introduced, which has more strict parsing
rules for the -smp command line.

[1] https://patchwork.kernel.org/project/qemu-devel/cover/20210413080745.33004-1-wangyanan55@huawei.com/
[2] https://kvmforum2020.sched.com/event/eE1y/virtual-topology-for-virtual-machines-friend-or-foe-dario-faggioli-suse

Test results about exposure of topology:
After applying this patch series, launch a guest with virt-6.1.

Cmdline: -smp 96, sockets=2, cores=48, threads=1
Output:
linux-atxcNc:~ # lscpu
Architecture:        aarch64
Byte Order:          Little Endian
CPU(s):              96
On-line CPU(s) list: 0-95
Thread(s) per core:  1
Core(s) per socket:  48
Socket(s):           2
NUMA node(s):        1
Vendor ID:           0x48

Cmdline: -smp 96
linux-atxcNc:~ # lscpu
Architecture:        aarch64
Byte Order:          Little Endian
CPU(s):              96
On-line CPU(s) list: 0-95
Thread(s) per core:  1
Core(s) per socket:  96
Socket(s):           1
NUMA node(s):        1
Vendor ID:           0x48

THINGS TO DO SOON:
1) Run some benchmark to test the scheduling improvement of guest kernel
   introduced by virtual cpu topology.
2) Add some QEMU tests about ARM vcpu topology, ACPI PPTT table, and DT
   cpu nodes. Will post in a separate patchset later.

---

Changelogs:
v2->v3:
- address comments from David, Philippe, and Andrew. Thanks!
- split some change into separate commits for ease of review
- adjust parsing rules of virt_smp_parse to be more strict
  (after discussion with Andrew)
- adjust author credit for the patches
- v2: https://patchwork.kernel.org/project/qemu-devel/cover/20210413080745.33004-1-wangyanan55@huawei.com/

v1->v2:
- Address Andrew Jones's comments
- Address Michael S. Tsirkin's comments
- https://patchwork.kernel.org/project/qemu-devel/cover/20210225085627.2263-1-fangying1@huawei.com/

---

Andrew Jones (3):
  device_tree: Add qemu_fdt_add_path
  hw/arm/virt: Add cpu-map to device tree
  hw/arm/virt-acpi-build: Generate PPTT table

Yanan Wang (6):
  hw/arm/virt: Disable cpu topology support on older machine types
  hw/arm/virt: Initialize the present cpu members
  hw/arm/virt-acpi-build: Use possible cpus in generation of DSDT
  hw/arm/virt-acpi-build: Use possible cpus in generation of MADT
  hw/acpi/aml-build: Add Processor hierarchy node structure
  hw/arm/virt: Add separate -smp parsing function for ARM machines

 hw/acpi/aml-build.c          |  26 ++++++
 hw/arm/virt-acpi-build.c     |  99 ++++++++++++++++++++---
 hw/arm/virt.c                | 148 ++++++++++++++++++++++++++++++++++-
 include/hw/acpi/aml-build.h  |   4 +
 include/hw/arm/virt.h        |   2 +
 include/sysemu/device_tree.h |   1 +
 qemu-options.hx              |   4 +
 softmmu/device_tree.c        |  44 ++++++++++-
 8 files changed, 316 insertions(+), 12 deletions(-)