1 Star 0 Fork 131

JianChunfu/src-qemu

forked from src-openEuler/qemu 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Fix-smp.cores-value-and-Fix-divide-0-error.patch 1.36 KB
一键复制 编辑 原始数据 按行查看 历史
Jiabo Feng 提交于 2023-06-29 11:10 +08:00 . QEMU update to version 6.2.0-75(master)
From 08d0374d80ef321a421d4d9716c05006b469c78f Mon Sep 17 00:00:00 2001
From: lixianglai <lixianglai@loongson.cn>
Date: Wed, 24 May 2023 23:06:51 -0400
Subject: [PATCH] Fix smp.cores value and Fix divide 0 error
The smp.cores should use the default value passed from
qemu start command, and the argument is cores_per_socket.
The variable nb_numa_nodes may be 0, and a division by 0
error will occur later, and special treatment is done for
nb_numa_nodes here.
Signed-off-by: lixianglai <lixianglai@loongson.cn>
---
hw/loongarch/larch_3a.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/hw/loongarch/larch_3a.c b/hw/loongarch/larch_3a.c
index fe786008ac..cef1a6f3d2 100644
--- a/hw/loongarch/larch_3a.c
+++ b/hw/loongarch/larch_3a.c
@@ -1221,7 +1221,6 @@ static void loongarch_build_smbios(LoongarchMachineState *lsms)
uint8_t *smbios_tables, *smbios_anchor;
size_t smbios_tables_len, smbios_anchor_len;
const char *product = "QEMU Virtual Machine";
- ms->smp.cores = 4;
if (!lsms->fw_cfg) {
return;
@@ -2005,6 +2004,10 @@ static int64_t ls3a_get_default_cpu_node_id(const MachineState *ms, int idx)
{
int nb_numa_nodes = ms->numa_state->num_nodes;
int smp_cores = ms->smp.cores;
+
+ if (nb_numa_nodes == 0) {
+ nb_numa_nodes = 1;
+ }
return idx / smp_cores % nb_numa_nodes;
}
--
2.41.0.windows.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jianchunfu/src-qemu.git
git@gitee.com:jianchunfu/src-qemu.git
jianchunfu
src-qemu
src-qemu
master

搜索帮助