1 Star 0 Fork 109

panchenbo / qemu

forked from src-openEuler / qemu 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
hw-core-machine-Fix-the-missing-consideration-of-clu.patch 3.04 KB
一键复制 编辑 原始数据 按行查看 历史
huiyingC 提交于 2023-03-28 20:53 . QEMU update to viersion 6.2.0-67(master)
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
1
https://gitee.com/panchenbo/qemu.git
git@gitee.com:panchenbo/qemu.git
panchenbo
qemu
qemu
master

搜索帮助