Hi, This is v4 of the series [1] that I posted to introduce support for generating cpu topology descriptions to guest. Comments are welcome!
Description: Once the view of an accurate virtual cpu topology is provided to guest, with a well-designed vCPU pinning to the pCPU we may get a huge benefit, e.g., the scheduling performance improvement. See Dario Faggioli's research and the related performance tests in [2] for reference. So here we go, this patch series introduces cpu topology support for ARM platform. In this series, instead of quietly enforcing the support for the latest machine type, a new parameter "expose=on|off" in -smp command line is introduced to leave QEMU users a choice to decide whether to enable the feature or not. This will allow the feature to work on different machine types and also ideally compat with already in-use -smp command lines. Also we make much stricter requirement for the topology configuration with "expose=on". Furthermore, both cpu-map in DT and ACPI PPTT table are introduced to present cpu topology to the guest. And an ARM-specific -smp parsing function virt_smp_parse is introduced, which shares the same logic with smp_parse() when "expose=off" and follow the stricter parsing rule when "expose=on". [1] https://patchwork.kernel.org/project/qemu-devel/cover/20210516102900.28036-1-wangyana...@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 an ACPI guest with virt-6.1 on an ARM server. 1) Enable the support: With cmdline: -smp 96,sockets=2,cores=48,threads=1,expose=on or cmdline: -smp 96,maxcpus=96,sockets=2,cores=48,threads=1,expose=on we get: 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 Model: 0 Stepping: 0x1 BogoMIPS: 200.00 NUMA node0 CPU(s): 0-95 2) Disable the support: With cmdline: -smp 96 or cmdline: -smp 96,expose=off we get: 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 Model: 0 Stepping: 0x1 BogoMIPS: 200.00 NUMA node0 CPU(s): 0-95 --- Changelogs: v3->v4: - add new -smp parameter "expose=on|off" for users to enable/disable the feature - add stricter -smp cmdline parsing rules on "expose=on" case - move build_pptt to generic aml-build.c - add default cluster node in the cpu-map - rebase on top of latest upstream master - v3: https://patchwork.kernel.org/project/qemu-devel/cover/20210516102900.28036-1-wangyana...@huawei.com/ 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-wangyana...@huawei.com/ v1->v2: - Address Andrew Jones's comments - Address Michael S. Tsirkin's comments - v1: https://patchwork.kernel.org/project/qemu-devel/cover/20210225085627.2263-1-fangyi...@huawei.com/ --- Andrew Jones (2): hw/arm/virt: Add cpu-map to device tree hw/acpi/aml-build: Generate PPTT table Yanan Wang (5): vl: Add expose=on|off option support in -smp command line hw/arm/virt: Add separate -smp parsing function for ARM machines machine: disallow -smp expose=on for non-ARM machines device_tree: Add qemu_fdt_add_path hw/acpi/aml-build: Add Processor hierarchy node structure hw/acpi/aml-build.c | 75 +++++++++++++++ hw/arm/virt-acpi-build.c | 8 +- hw/arm/virt.c | 171 +++++++++++++++++++++++++++++++++-- hw/core/machine.c | 7 ++ hw/i386/pc.c | 7 ++ include/hw/acpi/aml-build.h | 7 ++ include/hw/boards.h | 1 + include/sysemu/device_tree.h | 1 + qemu-options.hx | 24 +++-- softmmu/device_tree.c | 44 ++++++++- softmmu/vl.c | 3 + 11 files changed, 326 insertions(+), 22 deletions(-) -- 2.23.0