1 Star 0 Fork 32

hongrongxuan/rasdaemon

forked from src-openEuler/rasdaemon 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-Check-CPUs-online-not-configured.patch 1.32 KB
一键复制 编辑 原始数据 按行查看 历史
Lv Ying 提交于 2023-12-31 22:55 . backport bugfix patches from community
From 5cf2386450f8a4837bcc68673f616732c38d13e0 Mon Sep 17 00:00:00 2001
From: Zeph / Liz Loss-Cutler-Hull <warp-spam_git@aehallh.com>
Date: Sun, 9 Jul 2023 04:57:19 -0700
Subject: [PATCH 2/2] Check CPUs online, not configured.
When the number of CPUs detected is greater than the number of CPUs in
the system, rasdaemon will crash when it receives some events.
Looking deeper, we also fail to use the poll method for similar reasons
in this case.
All of this can be prevented by checking to see how many CPUs are
currently online (sysconf(_SC_NPROCESSORS_ONLN)) instead of how many
CPUs the current kernel was configured to support
(sysconf(_SC_NPROCESSORS_CONF)).
For the kernel side of the discussion, see https://lore.kernel.org/lkml/CAM6Wdxft33zLeeXHhmNX5jyJtfGTLiwkQSApc=10fqf+rQh9DA@mail.gmail.com/T/
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
ras-events.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ras-events.c b/ras-events.c
index fc54325..4cf0ad1 100644
--- a/ras-events.c
+++ b/ras-events.c
@@ -353,7 +353,7 @@ static void parse_ras_data(struct pthread_data *pdata, struct kbuffer *kbuf,
static int get_num_cpus(struct ras_events *ras)
{
- return sysconf(_SC_NPROCESSORS_CONF);
+ return sysconf(_SC_NPROCESSORS_ONLN);
#if 0
char fname[MAX_PATH + 1];
int num_cpus = 0;
--
2.35.3
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/barbo/rasdaemon.git
git@gitee.com:barbo/rasdaemon.git
barbo
rasdaemon
rasdaemon
master

搜索帮助