8 Star 1 Fork 7

src-anolis-os/rasdaemon

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
1040-anolis-ras-arm-handler-be-compatible-with-upstream-K.patch 4.09 KB
一键复制 编辑 原始数据 按行查看 历史
From 26fa7f2122282920f4d3963db5f664d5f1a381a3 Mon Sep 17 00:00:00 2001
From: Mauro Carvalho Chehab <[email protected]>
Date: Tue, 25 Jun 2024 10:05:45 +0200
Subject: [PATCH 40/85] anolis: ras-arm-handler: be compatible with upstream
Kernel
Changeset e37eb2f11a82 ("Add code to decode Ampere specific error")
broke ARM event record with upstream Kernel, as it requires a different
trace event than the one that it is on upstream Kernel, and it is
part of a pending pull request:
https://lore.kernel.org/all/20240321-b4-arm-ras-error-vendor-info-v5-rc3-v5-0-850f9bfb97a8@os.amperecomputing.com/
Restore its behavior by making parsing the UEFI 2.6+ N.17 and N.16
table extra fields to be optional. That should make it compatible
with current upstream Kernels again.
Fixes: e37eb2f11a82 ("Add code to decode Ampere specific error")
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
[Ruidong: do not use libtraceevent]
---
ras-arm-handler.c | 78 ++++++++++++++++++++++++-----------------------
1 file changed, 40 insertions(+), 38 deletions(-)
diff --git a/ras-arm-handler.c b/ras-arm-handler.c
index abd8c9b..731176d 100644
--- a/ras-arm-handler.c
+++ b/ras-arm-handler.c
@@ -207,51 +207,53 @@ int ras_arm_event_handler(struct trace_seq *s,
ev.psci_state = val;
trace_seq_printf(s, " psci_state: %d", ev.psci_state);
- if (pevent_get_field_val(s, event, "pei_len", record, &val, 1) < 0)
- return -1;
- ev.pei_len = val;
- trace_seq_printf(s, " ARM Processor Err Info data len: %d\n",
- ev.pei_len);
-
- ev.pei_error = pevent_get_field_raw(s, event, "buf", record, &len, 1);
- if (!ev.pei_error)
- return -1;
- display_raw_data(s, ev.pei_error, ev.pei_len);
-
- if (pevent_get_field_val(s, event, "ctx_len", record, &val, 1) < 0)
- return -1;
- ev.ctx_len = val;
- trace_seq_printf(s, " ARM Processor Err Context Info data len: %d\n",
- ev.ctx_len);
-
- ev.ctx_error = pevent_get_field_raw(s, event, "buf1", record, &len, 1);
- if (!ev.ctx_error)
- return -1;
- display_raw_data(s, ev.ctx_error, ev.ctx_len);
-
- if (pevent_get_field_val(s, event, "oem_len", record, &val, 1) < 0)
- return -1;
- ev.oem_len = val;
- trace_seq_printf(s, " Vendor Specific Err Info data len: %d\n",
- ev.oem_len);
-
- ev.vsei_error = pevent_get_field_raw(s, event, "buf2", record, &len, 1);
- if (!ev.vsei_error)
- return -1;
+ // Upstream kKernels up to version 6.10 don't decode UEFI 2.6+ N.17 table
+ if (pevent_get_field_val(s, event, "pei_len", record, &val, 1) >= 0) {
+
+ ev.pei_len = val;
+ trace_seq_printf(s, " ARM Processor Err Info data len: %d\n",
+ ev.pei_len);
+
+ ev.pei_error = pevent_get_field_raw(s, event, "buf", record, &len, 1);
+ if (!ev.pei_error)
+ return -1;
+ display_raw_data(s, ev.pei_error, ev.pei_len);
+
+ if (pevent_get_field_val(s, event, "ctx_len", record, &val, 1) < 0)
+ return -1;
+ ev.ctx_len = val;
+ trace_seq_printf(s, " ARM Processor Err Context Info data len: %d\n",
+ ev.ctx_len);
+
+ ev.ctx_error = pevent_get_field_raw(s, event, "buf1", record, &len, 1);
+ if (!ev.ctx_error)
+ return -1;
+ display_raw_data(s, ev.ctx_error, ev.ctx_len);
+
+ if (pevent_get_field_val(s, event, "oem_len", record, &val, 1) < 0)
+ return -1;
+ ev.oem_len = val;
+ trace_seq_printf(s, " Vendor Specific Err Info data len: %d\n",
+ ev.oem_len);
+
+ ev.vsei_error = pevent_get_field_raw(s, event, "buf2", record, &len, 1);
+ if (!ev.vsei_error)
+ return -1;
#ifdef HAVE_AMP_NS_DECODE
- //decode ampere specific error
- decode_amp_payload0_err_regs(NULL, s,
- (struct amp_payload0_type_sec *)ev.vsei_error);
+ //decode ampere specific error
+ decode_amp_payload0_err_regs(NULL, s,
+ (struct amp_payload0_type_sec *)ev.vsei_error);
#else
- display_raw_data(s, ev.vsei_error, ev.oem_len);
+ display_raw_data(s, ev.vsei_error, ev.oem_len);
#endif
-
#ifdef HAVE_CPU_FAULT_ISOLATION
- if (ras_handle_cpu_error(s, record, event, &ev, now) < 0)
- return -1;
+ if (ras_handle_cpu_error(s, record, event, &ev, now) < 0)
+ printf("Can't do CPU fault isolation!\n");
#endif
+ }
+
/* Insert data into the SGBD */
#ifdef HAVE_SQLITE3
ras_store_arm_record(ras, &ev);
--
2.33.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-anolis-os/rasdaemon.git
[email protected]:src-anolis-os/rasdaemon.git
src-anolis-os
rasdaemon
rasdaemon
a8

搜索帮助