-bugfix: fix qmp command migrate-set-parameters -some bugfixs about ARM hot-plugged CPUs -hw/core/machine:Fix the missing consideration of cluster-id -test/tcg:Fix target-specific Makefile variable path for user-mode -tests:add (riscv virt) machine mapping to testenv -Make a litte improvement in curl and hw/riscv -qemu support for loongarch -hw/pvrdma: Protect against buggy or malious guest driver -hw/audio/intel-hda:fix stream reset -dsoundaudio:fix crackling audio recordings -add notify-vm-exit support for i386 -blok-backend: prevent dangling BDS pointers across aio_poll() -net:Fix uninitialized data usage -net/eth:Don't consider ESP to be an IPv6 option header -hw/net/vmxnet3:Log guest-triggerable errors using LOG_GUEST_ERROR Signed-off-by: FeiXu <xufei30@huawei.com>
86 lines
3.0 KiB
Diff
86 lines
3.0 KiB
Diff
From bbf1fc67fb642833a23793081e812c36691c4df6 Mon Sep 17 00:00:00 2001
|
|
From: Yanan Wang <wangyanan55@huawei.com>
|
|
Date: Mon, 6 Mar 2023 20:50:33 +0800
|
|
Subject: [PATCH] hw/core/machine:Fix the missing consideration of cluster-id
|
|
|
|
Commit 5454c00908236 introduced the cluster-id for CPU
|
|
topology parameter "cluster", but has not fully considered
|
|
all the areas where we need to check cluster-id, e.g, when
|
|
assigning CPUs to numa nodes.
|
|
|
|
If we have multiple clusters and multiple numa nodes for
|
|
a guest like below:
|
|
-smp cpus=8,maxcpus=8,sockets=1,dies=1,clusters=2,cores=4,threads=1
|
|
-numa node nodeid=0,cpus=0-3
|
|
-numa node nodeid=1,cpus=4-7
|
|
QEMU will wrongly assign all the CPUs to numa0, because there
|
|
is no check about cluster_id of each CPU in function
|
|
machine_set_cpu_numa_node. Fix it.
|
|
|
|
Also, fix some other areas which missed to verified cluster-id.
|
|
|
|
Fixes: 5454c00908236 ("arm/virt: Add CPU topology support")
|
|
Signed-off-by: Yanan Wang <wangyanan55@huawei.com>
|
|
---
|
|
hw/core/machine-hmp-cmds.c | 3 +++
|
|
hw/core/machine.c | 15 +++++++++++++++
|
|
2 files changed, 18 insertions(+)
|
|
|
|
diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c
|
|
index 4e2f319aeb..c4f63b1d63 100644
|
|
--- a/hw/core/machine-hmp-cmds.c
|
|
+++ b/hw/core/machine-hmp-cmds.c
|
|
@@ -77,6 +77,9 @@ void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict)
|
|
if (c->has_die_id) {
|
|
monitor_printf(mon, " die-id: \"%" PRIu64 "\"\n", c->die_id);
|
|
}
|
|
+ if (c->has_cluster_id) {
|
|
+ monitor_printf(mon, " cluster-id: \"%" PRIu64 "\"\n", c->cluster_id);
|
|
+ }
|
|
if (c->has_core_id) {
|
|
monitor_printf(mon, " core-id: \"%" PRIu64 "\"\n", c->core_id);
|
|
}
|
|
diff --git a/hw/core/machine.c b/hw/core/machine.c
|
|
index 45fb0fd2eb..cb539104a1 100644
|
|
--- a/hw/core/machine.c
|
|
+++ b/hw/core/machine.c
|
|
@@ -686,6 +686,11 @@ void machine_set_cpu_numa_node(MachineState *machine,
|
|
return;
|
|
}
|
|
|
|
+ if (props->has_cluster_id && !slot->props.has_cluster_id) {
|
|
+ error_setg(errp, "cluster-id is not supported");
|
|
+ return;
|
|
+ }
|
|
+
|
|
/* skip slots with explicit mismatch */
|
|
if (props->has_thread_id && props->thread_id != slot->props.thread_id) {
|
|
continue;
|
|
@@ -695,6 +700,10 @@ void machine_set_cpu_numa_node(MachineState *machine,
|
|
continue;
|
|
}
|
|
|
|
+ if (props->has_cluster_id && props->cluster_id != slot->props.cluster_id) {
|
|
+ continue;
|
|
+ }
|
|
+
|
|
if (props->has_die_id && props->die_id != slot->props.die_id) {
|
|
continue;
|
|
}
|
|
@@ -989,6 +998,12 @@ static char *cpu_slot_to_string(const CPUArchId *cpu)
|
|
}
|
|
g_string_append_printf(s, "die-id: %"PRId64, cpu->props.die_id);
|
|
}
|
|
+ if (cpu->props.has_cluster_id) {
|
|
+ if (s->len) {
|
|
+ g_string_append_printf(s, ", ");
|
|
+ }
|
|
+ g_string_append_printf(s, "cluster-id: %"PRId64, cpu->props.cluster_id);
|
|
+ }
|
|
if (cpu->props.has_core_id) {
|
|
if (s->len) {
|
|
g_string_append_printf(s, ", ");
|
|
--
|
|
2.27.0
|
|
|