qemu-e2k/hw/core
Yanan Wang 864c3b5c32 hw/core/machine: Introduce CPU cluster topology support
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) on both x86_64 and AArch64.

So now in 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.

In virtualization, on the Hosts which have pClusters (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 patch adds infrastructure for CPU cluster level topology
configuration and parsing, so that the user can specify cluster
parameter if their machines support it.

Signed-off-by: Yanan Wang <wangyanan55@huawei.com>
Message-Id: <20211228092221.21068-3-wangyanan55@huawei.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
[PMD: Added '(since 7.0)' to @clusters in qapi/machine.json]
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2021-12-31 13:42:39 +01:00
..
Kconfig hw/core: Only build guest-loader if libfdt is available 2021-03-17 07:17:46 +00:00
bus.c qbus: Rename qbus_create() to qbus_new() 2021-09-30 13:44:08 +01:00
clock-vmstate.c clock: Provide builtin multiplier/divider 2021-09-01 11:08:19 +01:00
clock.c clock: Provide builtin multiplier/divider 2021-09-01 11:08:19 +01:00
cpu-common.c Revert "cpu: Move cpu_common_props to hw/core/cpu.c" 2021-10-15 16:39:15 -07:00
cpu-sysemu.c cpu: Move CPUClass::get_paging_enabled to SysemuCPUOps 2021-05-26 15:33:59 -07:00
fw-path-provider.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
generic-loader.c dma: Let dma_memory_read/write() take MemTxAttrs argument 2021-12-30 17:16:32 +01:00
gpio.c hw/qdev: Rename qdev_connect_gpio_out*() 'input_pin' parameter 2021-12-31 13:21:36 +01:00
guest-loader.c hw: Do not include hw/sysbus.h if it is not necessary 2021-05-02 17:24:50 +02:00
guest-loader.h hw/core: implement a guest-loader to support static hypervisor guests 2021-03-10 15:34:11 +00:00
hotplug-stubs.c hw/core: Restrict hotplug to system emulation 2021-11-01 19:44:11 +01:00
hotplug.c call HotplugHandler->plug() as the last step in device realization 2018-10-19 13:44:12 +02:00
irq.c Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
loader-fit.c hw/mips/boston: Fix Lesser GPL version number 2020-11-03 16:51:13 +01:00
loader.c qapi: introduce x-query-roms QMP command 2021-11-02 15:55:13 +00:00
machine-hmp-cmds.c qapi: introduce x-query-numa QMP command 2021-11-02 15:55:14 +00:00
machine-qmp-cmds.c qapi: introduce x-query-numa QMP command 2021-11-02 15:55:14 +00:00
machine-smp.c hw/core/machine: Introduce CPU cluster topology support 2021-12-31 13:42:39 +01:00
machine.c hw/core/machine: Introduce CPU cluster topology support 2021-12-31 13:42:39 +01:00
meson.build hw/core/machine: Split out the smp parsing code 2021-11-01 19:44:11 +01:00
nmi.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
null-machine.c Do not include sysemu/sysemu.h if it's not really necessary 2021-05-02 17:24:50 +02:00
numa.c numa: Enable numa for SGX EPC sections 2021-12-10 09:47:18 +01:00
or-irq.c hw/core/or-irq: Fix incorrect assert forbidding num-lines == MAX_OR_LINES 2020-01-30 16:02:01 +00:00
platform-bus.c nomaintainer: Fix Lesser GPL version number 2020-11-15 17:04:40 +01:00
ptimer.c ptimer: Add new ptimer_set_period_from_clock() function 2021-01-29 15:54:42 +00:00
qdev-clock.c clock: Add ClockEvent parameter to callbacks 2021-03-08 17:20:01 +00:00
qdev-fw.c Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
qdev-hotplug.c hw/core: Extract hotplug-related functions to qdev-hotplug.c 2021-11-01 19:44:11 +01:00
qdev-prop-internal.h qdev: Make qdev_propinfo_get_uint16() static 2020-12-15 10:02:07 -05:00
qdev-properties-system.c net: Introduce NetClientInfo.check_peer_type() 2021-10-15 16:05:24 +02:00
qdev-properties.c qdev-properties: PropertyInfo: add realized_set_allowed field 2021-09-01 12:57:31 +02:00
qdev.c hw/core: Extract hotplug-related functions to qdev-hotplug.c 2021-11-01 19:44:11 +01:00
register.c hw/core/register: Add more 64-bit utilities 2021-09-01 11:59:12 +10:00
reset.c qemu/queue.h: leave head structs anonymous unless necessary 2019-01-11 15:46:55 +01:00
resettable.c hw/core: deprecate old reset functions and introduce new ones 2020-01-30 16:02:04 +00:00
split-irq.c qdev: set properties with device_class_set_props() 2020-01-24 20:59:15 +01:00
stream.c hw/core/stream: Rename StreamSlave as StreamSink 2020-12-10 12:15:04 -05:00
sysbus.c qbus: Rename qbus_create_inplace() to qbus_init() 2021-09-30 13:42:10 +01:00
trace-events clock: Provide builtin multiplier/divider 2021-09-01 11:08:19 +01:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
uboot_image.h Support u-boot noload images for arm as used by, NetBSD/evbarm GENERIC kernel. 2019-01-07 15:46:20 +00:00
vm-change-state-handler.c sysemu: Split sysemu/runstate.h off sysemu/sysemu.h 2019-08-16 13:37:36 +02:00
vmstate-if.c vmstate: add qom interface to get id 2020-01-06 18:41:32 +04:00