!82 rasdaemon: Add fix patches for rasdaemon and Add support for creating the vendor error tables at startup
From: @shijujose Reviewed-by: @lvying6 Signed-off-by: @lvying6
This commit is contained in:
commit
1146bbaed5
@ -0,0 +1,95 @@
|
|||||||
|
From 2eea64bc7437b0a5dabff52632a372446ddc4765 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Xiaofei Tan <tanxiaofei@huawei.com>
|
||||||
|
Date: Thu, 11 May 2023 10:54:26 +0800
|
||||||
|
Subject: [PATCH 1/3] rasdaemon: fix return value type issue of read/write
|
||||||
|
function from unistd.h
|
||||||
|
|
||||||
|
The return value type of read/write function from unistd.h is ssize_t.
|
||||||
|
It's signed normally, and return -1 on error. Fix incorrect use in the
|
||||||
|
function read_ras_event_all_cpus().
|
||||||
|
|
||||||
|
BTW, make setting buffer_percent as a separate function.
|
||||||
|
|
||||||
|
Fixes: 94750bcf9309 ("rasdaemon: Fix poll() on per_cpu trace_pipe_raw blocks indefinitely")
|
||||||
|
Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
|
||||||
|
Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
|
||||||
|
---
|
||||||
|
ras-events.c | 45 ++++++++++++++++++++++++++++++---------------
|
||||||
|
1 file changed, 30 insertions(+), 15 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/ras-events.c b/ras-events.c
|
||||||
|
index 6e928a3..d08bf37 100644
|
||||||
|
--- a/ras-events.c
|
||||||
|
+++ b/ras-events.c
|
||||||
|
@@ -376,10 +376,37 @@ static int get_num_cpus(struct ras_events *ras)
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
+static int set_buffer_percent(struct ras_events *ras, int percent)
|
||||||
|
+{
|
||||||
|
+ char buf[16];
|
||||||
|
+ ssize_t size;
|
||||||
|
+ int res = 0;
|
||||||
|
+ int fd;
|
||||||
|
+
|
||||||
|
+ fd = open_trace(ras, "buffer_percent", O_WRONLY);
|
||||||
|
+ if (fd >= 0) {
|
||||||
|
+ /* For the backward compatibility to the old kernels, do not return
|
||||||
|
+ * if fail to set the buffer_percent.
|
||||||
|
+ */
|
||||||
|
+ snprintf(buf, sizeof(buf), "%d", percent);
|
||||||
|
+ size = write(fd, buf, strlen(buf));
|
||||||
|
+ if (size <= 0) {
|
||||||
|
+ log(TERM, LOG_WARNING, "can't write to buffer_percent\n");
|
||||||
|
+ res = -1;
|
||||||
|
+ }
|
||||||
|
+ close(fd);
|
||||||
|
+ } else {
|
||||||
|
+ log(TERM, LOG_WARNING, "Can't open buffer_percent\n");
|
||||||
|
+ res = -1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return res;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static int read_ras_event_all_cpus(struct pthread_data *pdata,
|
||||||
|
unsigned n_cpus)
|
||||||
|
{
|
||||||
|
- unsigned size;
|
||||||
|
+ ssize_t size;
|
||||||
|
unsigned long long time_stamp;
|
||||||
|
void *data;
|
||||||
|
int ready, i, count_nready;
|
||||||
|
@@ -391,8 +418,6 @@ static int read_ras_event_all_cpus(struct pthread_data *pdata,
|
||||||
|
int warnonce[n_cpus];
|
||||||
|
char pipe_raw[PATH_MAX];
|
||||||
|
int legacy_kernel = 0;
|
||||||
|
- int fd;
|
||||||
|
- char buf[16];
|
||||||
|
#if 0
|
||||||
|
int need_sleep = 0;
|
||||||
|
#endif
|
||||||
|
@@ -419,18 +444,8 @@ static int read_ras_event_all_cpus(struct pthread_data *pdata,
|
||||||
|
* Set buffer_percent to 0 so that poll() will return immediately
|
||||||
|
* when the trace data is available in the ras per_cpu trace pipe_raw
|
||||||
|
*/
|
||||||
|
- fd = open_trace(pdata[0].ras, "buffer_percent", O_WRONLY);
|
||||||
|
- if (fd >= 0) {
|
||||||
|
- /* For the backward compatibility to the old kernels, do not return
|
||||||
|
- * if fail to set the buffer_percent.
|
||||||
|
- */
|
||||||
|
- snprintf(buf, sizeof(buf), "0");
|
||||||
|
- size = write(fd, buf, strlen(buf));
|
||||||
|
- if (size <= 0)
|
||||||
|
- log(TERM, LOG_WARNING, "can't write to buffer_percent\n");
|
||||||
|
- close(fd);
|
||||||
|
- } else
|
||||||
|
- log(TERM, LOG_WARNING, "Can't open buffer_percent\n");
|
||||||
|
+ if (set_buffer_percent(pdata[0].ras, 0))
|
||||||
|
+ log(TERM, LOG_WARNING, "Set buffer_percent failed\n");
|
||||||
|
|
||||||
|
for (i = 0; i < (n_cpus + 1); i++)
|
||||||
|
fds[i].fd = -1;
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
114
0002-rasdaemon-fix-issue-of-signed-and-unsigned-integer-c.patch
Normal file
114
0002-rasdaemon-fix-issue-of-signed-and-unsigned-integer-c.patch
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
From ad9c1bc8ea907d6faebfb916916b5f898a8e0518 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Xiaofei Tan <tanxiaofei@huawei.com>
|
||||||
|
Date: Tue, 30 May 2023 11:44:12 +0100
|
||||||
|
Subject: [PATCH 2/3] rasdaemon: fix issue of signed and unsigned integer
|
||||||
|
comparison and remove redundant header file
|
||||||
|
|
||||||
|
1. The return value of ARRAY_SIZE() is unsigned integer. It isn't right to
|
||||||
|
compare it with a signed integer. This patch fix them.
|
||||||
|
|
||||||
|
2. Remove redundant header file and adjust the header files sequence.
|
||||||
|
|
||||||
|
Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
|
||||||
|
Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
|
||||||
|
---
|
||||||
|
non-standard-hisi_hip08.c | 2 +-
|
||||||
|
non-standard-hisilicon.c | 8 ++++----
|
||||||
|
ras-diskerror-handler.c | 2 +-
|
||||||
|
ras-memory-failure-handler.c | 7 +++----
|
||||||
|
4 files changed, 9 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/non-standard-hisi_hip08.c b/non-standard-hisi_hip08.c
|
||||||
|
index 4ef47ea..61f12eb 100644
|
||||||
|
--- a/non-standard-hisi_hip08.c
|
||||||
|
+++ b/non-standard-hisi_hip08.c
|
||||||
|
@@ -1029,7 +1029,7 @@ static struct ras_ns_ev_decoder hip08_ns_ev_decoder[] = {
|
||||||
|
|
||||||
|
static void __attribute__((constructor)) hip08_init(void)
|
||||||
|
{
|
||||||
|
- int i;
|
||||||
|
+ unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(hip08_ns_ev_decoder); i++)
|
||||||
|
register_ns_ev_decoder(&hip08_ns_ev_decoder[i]);
|
||||||
|
diff --git a/non-standard-hisilicon.c b/non-standard-hisilicon.c
|
||||||
|
index 6ee9271..0d5fe6b 100644
|
||||||
|
--- a/non-standard-hisilicon.c
|
||||||
|
+++ b/non-standard-hisilicon.c
|
||||||
|
@@ -362,13 +362,13 @@ static int decode_hisi_common_section(struct ras_events *ras,
|
||||||
|
trace_seq_printf(s, "%s\n", hevent.error_msg);
|
||||||
|
|
||||||
|
if (err->val_bits & BIT(HISI_COMMON_VALID_REG_ARRAY_SIZE) && err->reg_array_size > 0) {
|
||||||
|
- int i;
|
||||||
|
+ unsigned int i;
|
||||||
|
|
||||||
|
trace_seq_printf(s, "Register Dump:\n");
|
||||||
|
for (i = 0; i < err->reg_array_size / sizeof(uint32_t); i++) {
|
||||||
|
- trace_seq_printf(s, "reg%02d=0x%08x\n", i,
|
||||||
|
+ trace_seq_printf(s, "reg%02u=0x%08x\n", i,
|
||||||
|
err->reg_array[i]);
|
||||||
|
- HISI_SNPRINTF(hevent.reg_msg, "reg%02d=0x%08x",
|
||||||
|
+ HISI_SNPRINTF(hevent.reg_msg, "reg%02u=0x%08x",
|
||||||
|
i, err->reg_array[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -394,7 +394,7 @@ static struct ras_ns_ev_decoder hisi_section_ns_ev_decoder[] = {
|
||||||
|
|
||||||
|
static void __attribute__((constructor)) hisi_ns_init(void)
|
||||||
|
{
|
||||||
|
- int i;
|
||||||
|
+ unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(hisi_section_ns_ev_decoder); i++)
|
||||||
|
register_ns_ev_decoder(&hisi_section_ns_ev_decoder[i]);
|
||||||
|
diff --git a/ras-diskerror-handler.c b/ras-diskerror-handler.c
|
||||||
|
index b16319f..b46f859 100644
|
||||||
|
--- a/ras-diskerror-handler.c
|
||||||
|
+++ b/ras-diskerror-handler.c
|
||||||
|
@@ -52,7 +52,7 @@ static const struct {
|
||||||
|
|
||||||
|
static const char *get_blk_error(int err)
|
||||||
|
{
|
||||||
|
- int i;
|
||||||
|
+ unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(blk_errors); i++)
|
||||||
|
if (blk_errors[i].error == err)
|
||||||
|
diff --git a/ras-memory-failure-handler.c b/ras-memory-failure-handler.c
|
||||||
|
index 9941e68..8fd7117 100644
|
||||||
|
--- a/ras-memory-failure-handler.c
|
||||||
|
+++ b/ras-memory-failure-handler.c
|
||||||
|
@@ -15,11 +15,10 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
-#include "libtrace/kbuffer.h"
|
||||||
|
-#include "ras-memory-failure-handler.h"
|
||||||
|
#include "ras-record.h"
|
||||||
|
#include "ras-logger.h"
|
||||||
|
#include "ras-report.h"
|
||||||
|
+#include "ras-memory-failure-handler.h"
|
||||||
|
|
||||||
|
/* Memory failure - various types of pages */
|
||||||
|
enum mf_action_page_type {
|
||||||
|
@@ -99,7 +98,7 @@ static const struct {
|
||||||
|
|
||||||
|
static const char *get_page_type(int page_type)
|
||||||
|
{
|
||||||
|
- int i;
|
||||||
|
+ unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(mf_page_type); i++)
|
||||||
|
if (mf_page_type[i].type == page_type)
|
||||||
|
@@ -110,7 +109,7 @@ static const char *get_page_type(int page_type)
|
||||||
|
|
||||||
|
static const char *get_action_result(int result)
|
||||||
|
{
|
||||||
|
- int i;
|
||||||
|
+ unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(mf_action_result); i++)
|
||||||
|
if (mf_action_result[i].result == result)
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
325
0003-rasdaemon-Add-support-for-creating-the-vendor-error-.patch
Normal file
325
0003-rasdaemon-Add-support-for-creating-the-vendor-error-.patch
Normal file
@ -0,0 +1,325 @@
|
|||||||
|
From 9fd84965e70b6d245699d36f8ac4f260d87013cb Mon Sep 17 00:00:00 2001
|
||||||
|
From: Shiju Jose <shiju.jose@huawei.com>
|
||||||
|
Date: Thu, 1 Jun 2023 15:34:53 +0100
|
||||||
|
Subject: [PATCH 3/3] rasdaemon: Add support for creating the vendor error
|
||||||
|
tables at startup
|
||||||
|
|
||||||
|
1. Support for create/open the vendor error tables at rasdaemon startup.
|
||||||
|
2. Make changes in the HiSilicon error handling code for the same.
|
||||||
|
|
||||||
|
Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
|
||||||
|
---
|
||||||
|
non-standard-hisi_hip08.c | 66 ++++++++++++++++++++++++++------------
|
||||||
|
non-standard-hisilicon.c | 28 ++++++++++------
|
||||||
|
ras-events.c | 17 +++++++++-
|
||||||
|
ras-non-standard-handler.c | 35 +++++++++++++++++++-
|
||||||
|
ras-non-standard-handler.h | 3 ++
|
||||||
|
5 files changed, 116 insertions(+), 33 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/non-standard-hisi_hip08.c b/non-standard-hisi_hip08.c
|
||||||
|
index 61f12eb..be84c22 100644
|
||||||
|
--- a/non-standard-hisi_hip08.c
|
||||||
|
+++ b/non-standard-hisi_hip08.c
|
||||||
|
@@ -654,6 +654,20 @@ static void decode_oem_type1_err_regs(struct ras_ns_ev_decoder *ev_decoder,
|
||||||
|
step_vendor_data_tab(ev_decoder, "hip08_oem_type1_event_tab");
|
||||||
|
}
|
||||||
|
|
||||||
|
+static int add_hip08_oem_type1_table(struct ras_events *ras, struct ras_ns_ev_decoder *ev_decoder)
|
||||||
|
+{
|
||||||
|
+#ifdef HAVE_SQLITE3
|
||||||
|
+ if (ras->record_events && !ev_decoder->stmt_dec_record) {
|
||||||
|
+ if (ras_mc_add_vendor_table(ras, &ev_decoder->stmt_dec_record,
|
||||||
|
+ &hip08_oem_type1_event_tab) != SQLITE_OK) {
|
||||||
|
+ log(TERM, LOG_WARNING, "Failed to create sql hip08_oem_type1_event_tab\n");
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+#endif
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/* error data decoding functions */
|
||||||
|
static int decode_hip08_oem_type1_error(struct ras_events *ras,
|
||||||
|
struct ras_ns_ev_decoder *ev_decoder,
|
||||||
|
@@ -669,17 +683,6 @@ static int decode_hip08_oem_type1_error(struct ras_events *ras,
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
-#ifdef HAVE_SQLITE3
|
||||||
|
- if (ras->record_events && !ev_decoder->stmt_dec_record) {
|
||||||
|
- if (ras_mc_add_vendor_table(ras, &ev_decoder->stmt_dec_record,
|
||||||
|
- &hip08_oem_type1_event_tab)
|
||||||
|
- != SQLITE_OK) {
|
||||||
|
- trace_seq_printf(s,
|
||||||
|
- "create sql hip08_oem_type1_event_tab fail\n");
|
||||||
|
- return -1;
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-#endif
|
||||||
|
record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_TEXT,
|
||||||
|
HIP08_OEM_TYPE1_FIELD_TIMESTAMP,
|
||||||
|
0, event->timestamp);
|
||||||
|
@@ -827,6 +830,20 @@ static void decode_oem_type2_err_regs(struct ras_ns_ev_decoder *ev_decoder,
|
||||||
|
step_vendor_data_tab(ev_decoder, "hip08_oem_type2_event_tab");
|
||||||
|
}
|
||||||
|
|
||||||
|
+static int add_hip08_oem_type2_table(struct ras_events *ras, struct ras_ns_ev_decoder *ev_decoder)
|
||||||
|
+{
|
||||||
|
+#ifdef HAVE_SQLITE3
|
||||||
|
+ if (ras->record_events && !ev_decoder->stmt_dec_record) {
|
||||||
|
+ if (ras_mc_add_vendor_table(ras, &ev_decoder->stmt_dec_record,
|
||||||
|
+ &hip08_oem_type2_event_tab) != SQLITE_OK) {
|
||||||
|
+ log(TERM, LOG_WARNING, "Failed to create sql hip08_oem_type2_event_tab\n");
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+#endif
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static int decode_hip08_oem_type2_error(struct ras_events *ras,
|
||||||
|
struct ras_ns_ev_decoder *ev_decoder,
|
||||||
|
struct trace_seq *s,
|
||||||
|
@@ -977,6 +994,20 @@ static void decode_pcie_local_err_regs(struct ras_ns_ev_decoder *ev_decoder,
|
||||||
|
step_vendor_data_tab(ev_decoder, "hip08_pcie_local_event_tab");
|
||||||
|
}
|
||||||
|
|
||||||
|
+static int add_hip08_pcie_local_table(struct ras_events *ras, struct ras_ns_ev_decoder *ev_decoder)
|
||||||
|
+{
|
||||||
|
+#ifdef HAVE_SQLITE3
|
||||||
|
+ if (ras->record_events && !ev_decoder->stmt_dec_record) {
|
||||||
|
+ if (ras_mc_add_vendor_table(ras, &ev_decoder->stmt_dec_record,
|
||||||
|
+ &hip08_pcie_local_event_tab) != SQLITE_OK) {
|
||||||
|
+ log(TERM, LOG_WARNING, "Failed to create sql hip08_pcie_local_event_tab\n");
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+#endif
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static int decode_hip08_pcie_local_error(struct ras_events *ras,
|
||||||
|
struct ras_ns_ev_decoder *ev_decoder,
|
||||||
|
struct trace_seq *s,
|
||||||
|
@@ -991,16 +1022,6 @@ static int decode_hip08_pcie_local_error(struct ras_events *ras,
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
-#ifdef HAVE_SQLITE3
|
||||||
|
- if (ras->record_events && !ev_decoder->stmt_dec_record) {
|
||||||
|
- if (ras_mc_add_vendor_table(ras, &ev_decoder->stmt_dec_record,
|
||||||
|
- &hip08_pcie_local_event_tab) != SQLITE_OK) {
|
||||||
|
- trace_seq_printf(s,
|
||||||
|
- "create sql hip08_pcie_local_event_tab fail\n");
|
||||||
|
- return -1;
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-#endif
|
||||||
|
record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_TEXT,
|
||||||
|
HIP08_PCIE_LOCAL_FIELD_TIMESTAMP,
|
||||||
|
0, event->timestamp);
|
||||||
|
@@ -1015,14 +1036,17 @@ static int decode_hip08_pcie_local_error(struct ras_events *ras,
|
||||||
|
static struct ras_ns_ev_decoder hip08_ns_ev_decoder[] = {
|
||||||
|
{
|
||||||
|
.sec_type = "1f8161e1-55d6-41e6-bd10-7afd1dc5f7c5",
|
||||||
|
+ .add_table = add_hip08_oem_type1_table,
|
||||||
|
.decode = decode_hip08_oem_type1_error,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.sec_type = "45534ea6-ce23-4115-8535-e07ab3aef91d",
|
||||||
|
+ .add_table = add_hip08_oem_type2_table,
|
||||||
|
.decode = decode_hip08_oem_type2_error,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.sec_type = "b2889fc9-e7d7-4f9d-a867-af42e98be772",
|
||||||
|
+ .add_table = add_hip08_pcie_local_table,
|
||||||
|
.decode = decode_hip08_pcie_local_error,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
diff --git a/non-standard-hisilicon.c b/non-standard-hisilicon.c
|
||||||
|
index 0d5fe6b..0ddb5ec 100644
|
||||||
|
--- a/non-standard-hisilicon.c
|
||||||
|
+++ b/non-standard-hisilicon.c
|
||||||
|
@@ -337,6 +337,23 @@ static void decode_hisi_common_section_hdr(struct ras_ns_ev_decoder *ev_decoder,
|
||||||
|
HISI_SNPRINTF(event->error_msg, "]");
|
||||||
|
}
|
||||||
|
|
||||||
|
+static int add_hisi_common_table(struct ras_events *ras,
|
||||||
|
+ struct ras_ns_ev_decoder *ev_decoder)
|
||||||
|
+{
|
||||||
|
+#ifdef HAVE_SQLITE3
|
||||||
|
+ if (ras->record_events &&
|
||||||
|
+ !ev_decoder->stmt_dec_record) {
|
||||||
|
+ if (ras_mc_add_vendor_table(ras, &ev_decoder->stmt_dec_record,
|
||||||
|
+ &hisi_common_section_tab) != SQLITE_OK) {
|
||||||
|
+ log(TERM, LOG_WARNING, "Failed to create sql hisi_common_section_tab\n");
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static int decode_hisi_common_section(struct ras_events *ras,
|
||||||
|
struct ras_ns_ev_decoder *ev_decoder,
|
||||||
|
struct trace_seq *s,
|
||||||
|
@@ -346,16 +363,6 @@ static int decode_hisi_common_section(struct ras_events *ras,
|
||||||
|
(struct hisi_common_error_section *)event->error;
|
||||||
|
struct hisi_event hevent;
|
||||||
|
|
||||||
|
-#ifdef HAVE_SQLITE3
|
||||||
|
- if (ras->record_events && !ev_decoder->stmt_dec_record) {
|
||||||
|
- if (ras_mc_add_vendor_table(ras, &ev_decoder->stmt_dec_record,
|
||||||
|
- &hisi_common_section_tab) != SQLITE_OK) {
|
||||||
|
- trace_seq_printf(s, "create sql hisi_common_section_tab fail\n");
|
||||||
|
- return -1;
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
memset(&hevent, 0, sizeof(struct hisi_event));
|
||||||
|
trace_seq_printf(s, "\nHisilicon Common Error Section:\n");
|
||||||
|
decode_hisi_common_section_hdr(ev_decoder, err, &hevent);
|
||||||
|
@@ -388,6 +395,7 @@ static int decode_hisi_common_section(struct ras_events *ras,
|
||||||
|
static struct ras_ns_ev_decoder hisi_section_ns_ev_decoder[] = {
|
||||||
|
{
|
||||||
|
.sec_type = "c8b328a8-9917-4af6-9a13-2e08ab2e7586",
|
||||||
|
+ .add_table = add_hisi_common_table,
|
||||||
|
.decode = decode_hisi_common_section,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
diff --git a/ras-events.c b/ras-events.c
|
||||||
|
index d08bf37..fc54325 100644
|
||||||
|
--- a/ras-events.c
|
||||||
|
+++ b/ras-events.c
|
||||||
|
@@ -482,6 +482,10 @@ static int read_ras_event_all_cpus(struct pthread_data *pdata,
|
||||||
|
if (pdata[0].ras->record_events) {
|
||||||
|
if (ras_mc_event_opendb(pdata[0].cpu, pdata[0].ras))
|
||||||
|
goto error;
|
||||||
|
+#ifdef HAVE_NON_STANDARD
|
||||||
|
+ if (ras_ns_add_vendor_tables(pdata[0].ras))
|
||||||
|
+ log(TERM, LOG_ERR, "Can't add vendor table\n");
|
||||||
|
+#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
|
@@ -566,8 +570,12 @@ static int read_ras_event_all_cpus(struct pthread_data *pdata,
|
||||||
|
"Old kernel detected. Stop listening and fall back to pthread way.\n");
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
- if (pdata[0].ras->record_events)
|
||||||
|
+ if (pdata[0].ras->record_events) {
|
||||||
|
+#ifdef HAVE_NON_STANDARD
|
||||||
|
+ ras_ns_finalize_vendor_tables();
|
||||||
|
+#endif
|
||||||
|
ras_mc_event_closedb(pdata[0].cpu, pdata[0].ras);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
error:
|
||||||
|
kbuffer_free(kbuf);
|
||||||
|
@@ -664,6 +672,10 @@ static void *handle_ras_events_cpu(void *priv)
|
||||||
|
free(page);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
+#ifdef HAVE_NON_STANDARD
|
||||||
|
+ if (ras_ns_add_vendor_tables(pdata->ras))
|
||||||
|
+ log(TERM, LOG_ERR, "Can't add vendor table\n");
|
||||||
|
+#endif
|
||||||
|
pthread_mutex_unlock(&pdata->ras->db_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -671,6 +683,9 @@ static void *handle_ras_events_cpu(void *priv)
|
||||||
|
|
||||||
|
if (pdata->ras->record_events) {
|
||||||
|
pthread_mutex_lock(&pdata->ras->db_lock);
|
||||||
|
+#ifdef HAVE_NON_STANDARD
|
||||||
|
+ ras_ns_finalize_vendor_tables();
|
||||||
|
+#endif
|
||||||
|
ras_mc_event_closedb(pdata->cpu, pdata->ras);
|
||||||
|
pthread_mutex_unlock(&pdata->ras->db_lock);
|
||||||
|
}
|
||||||
|
diff --git a/ras-non-standard-handler.c b/ras-non-standard-handler.c
|
||||||
|
index 6932e58..20d514b 100644
|
||||||
|
--- a/ras-non-standard-handler.c
|
||||||
|
+++ b/ras-non-standard-handler.c
|
||||||
|
@@ -75,6 +75,32 @@ int register_ns_ev_decoder(struct ras_ns_ev_decoder *ns_ev_decoder)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+int ras_ns_add_vendor_tables(struct ras_events *ras)
|
||||||
|
+{
|
||||||
|
+ struct ras_ns_ev_decoder *ns_ev_decoder;
|
||||||
|
+ int error = 0;
|
||||||
|
+
|
||||||
|
+#ifdef HAVE_SQLITE3
|
||||||
|
+ if (!ras)
|
||||||
|
+ return -1;
|
||||||
|
+
|
||||||
|
+ ns_ev_decoder = ras_ns_ev_dec_list;
|
||||||
|
+ while (ns_ev_decoder) {
|
||||||
|
+ if (ns_ev_decoder->add_table && !ns_ev_decoder->stmt_dec_record) {
|
||||||
|
+ error = ns_ev_decoder->add_table(ras, ns_ev_decoder);
|
||||||
|
+ if (error)
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ ns_ev_decoder = ns_ev_decoder->next;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (error)
|
||||||
|
+ return -1;
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static int find_ns_ev_decoder(const char *sec_type, struct ras_ns_ev_decoder **p_ns_ev_dec)
|
||||||
|
{
|
||||||
|
struct ras_ns_ev_decoder *ns_ev_decoder;
|
||||||
|
@@ -96,7 +122,7 @@ static int find_ns_ev_decoder(const char *sec_type, struct ras_ns_ev_decoder **p
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static void unregister_ns_ev_decoder(void)
|
||||||
|
+void ras_ns_finalize_vendor_tables(void)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_SQLITE3
|
||||||
|
struct ras_ns_ev_decoder *ns_ev_decoder = ras_ns_ev_dec_list;
|
||||||
|
@@ -108,6 +134,13 @@ static void unregister_ns_ev_decoder(void)
|
||||||
|
}
|
||||||
|
ns_ev_decoder = ns_ev_decoder->next;
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void unregister_ns_ev_decoder(void)
|
||||||
|
+{
|
||||||
|
+#ifdef HAVE_SQLITE3
|
||||||
|
+ ras_ns_finalize_vendor_tables();
|
||||||
|
#endif
|
||||||
|
ras_ns_ev_dec_list = NULL;
|
||||||
|
}
|
||||||
|
diff --git a/ras-non-standard-handler.h b/ras-non-standard-handler.h
|
||||||
|
index 57d4cb5..341206a 100644
|
||||||
|
--- a/ras-non-standard-handler.h
|
||||||
|
+++ b/ras-non-standard-handler.h
|
||||||
|
@@ -23,6 +23,7 @@
|
||||||
|
struct ras_ns_ev_decoder {
|
||||||
|
struct ras_ns_ev_decoder *next;
|
||||||
|
const char *sec_type;
|
||||||
|
+ int (*add_table)(struct ras_events *ras, struct ras_ns_ev_decoder *ev_decoder);
|
||||||
|
int (*decode)(struct ras_events *ras, struct ras_ns_ev_decoder *ev_decoder,
|
||||||
|
struct trace_seq *s, struct ras_non_standard_event *event);
|
||||||
|
#ifdef HAVE_SQLITE3
|
||||||
|
@@ -39,6 +40,8 @@ void print_le_hex(struct trace_seq *s, const uint8_t *buf, int index);
|
||||||
|
|
||||||
|
#ifdef HAVE_NON_STANDARD
|
||||||
|
int register_ns_ev_decoder(struct ras_ns_ev_decoder *ns_ev_decoder);
|
||||||
|
+int ras_ns_add_vendor_tables(struct ras_events *ras);
|
||||||
|
+void ras_ns_finalize_vendor_tables(void);
|
||||||
|
#else
|
||||||
|
static inline int register_ns_ev_decoder(struct ras_ns_ev_decoder *ns_ev_decoder) { return 0; };
|
||||||
|
#endif
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
From c46f65e1315aab8585e24d24223bd56c8931202a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Xiaofei Tan <tanxiaofei@huawei.com>
|
||||||
|
Date: Mon, 31 Oct 2022 18:36:26 +0800
|
||||||
|
Subject: [PATCH 4/4] rasdaemon: Add four modules supported by HiSilicon common
|
||||||
|
section
|
||||||
|
|
||||||
|
Add four modules supported by HiSilicon common error section.
|
||||||
|
|
||||||
|
Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
|
||||||
|
Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
|
||||||
|
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
|
||||||
|
---
|
||||||
|
non-standard-hisilicon.c | 6 +++++-
|
||||||
|
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/non-standard-hisilicon.c b/non-standard-hisilicon.c
|
||||||
|
index 0ddb5ec..7296d28 100644
|
||||||
|
--- a/non-standard-hisilicon.c
|
||||||
|
+++ b/non-standard-hisilicon.c
|
||||||
|
@@ -214,7 +214,11 @@ static const char* module_name[] = {
|
||||||
|
"Tsensor",
|
||||||
|
"ROH",
|
||||||
|
"BTC",
|
||||||
|
- "HILINK"
|
||||||
|
+ "HILINK",
|
||||||
|
+ "STARS",
|
||||||
|
+ "SDMA",
|
||||||
|
+ "UC",
|
||||||
|
+ "HBMC",
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char* get_soc_desc(uint8_t soc_id)
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: rasdaemon
|
Name: rasdaemon
|
||||||
Version: 0.6.8
|
Version: 0.6.8
|
||||||
Release: 3
|
Release: 4
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
Summary: Utility to get Platform Reliability, Availability and Serviceability (RAS) reports via the Kernel tracing events
|
Summary: Utility to get Platform Reliability, Availability and Serviceability (RAS) reports via the Kernel tracing events
|
||||||
URL: https://github.com/mchehab/rasdaemon.git
|
URL: https://github.com/mchehab/rasdaemon.git
|
||||||
@ -38,6 +38,10 @@ Patch9012: 0010-rasdaemon-Fix-for-a-memory-out-of-bounds-issue-and-o.patch
|
|||||||
Patch9013: 0001-rasdaemon-use-standard-length-PATH_MAX-for-path-name.patch
|
Patch9013: 0001-rasdaemon-use-standard-length-PATH_MAX-for-path-name.patch
|
||||||
Patch9014: 0001-rasdaemon-Fix-for-regression-in-ras_mc_create_table-.patch
|
Patch9014: 0001-rasdaemon-Fix-for-regression-in-ras_mc_create_table-.patch
|
||||||
Patch9015: 0002-rasdaemon-Fix-poll-on-per_cpu-trace_pipe_raw-blocks-.patch
|
Patch9015: 0002-rasdaemon-Fix-poll-on-per_cpu-trace_pipe_raw-blocks-.patch
|
||||||
|
Patch9016: 0001-rasdaemon-fix-return-value-type-issue-of-read-write-.patch
|
||||||
|
Patch9017: 0002-rasdaemon-fix-issue-of-signed-and-unsigned-integer-c.patch
|
||||||
|
Patch9018: 0003-rasdaemon-Add-support-for-creating-the-vendor-error-.patch
|
||||||
|
Patch9019: 0004-rasdaemon-Add-four-modules-supported-by-HiSilicon-co.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
The rasdaemon program is a daemon which monitors the platform
|
The rasdaemon program is a daemon which monitors the platform
|
||||||
@ -83,6 +87,18 @@ rm INSTALL %{buildroot}/usr/include/*.h
|
|||||||
/usr/bin/systemctl enable rasdaemon.service >/dev/null 2>&1 || :
|
/usr/bin/systemctl enable rasdaemon.service >/dev/null 2>&1 || :
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Jun 2 2023 Shiju Jose<shiju.jose@huawei.com> - 0.6.8-4
|
||||||
|
- Type:bugfix
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:
|
||||||
|
1. Fix return value type issue of read/write function from unistd.h.
|
||||||
|
2. Fix issue of signed and unsigned integer comparison.
|
||||||
|
3. Remove redundant header file and do some cleaup.
|
||||||
|
4. Add support for create/open the vendor error tables at rasdaemon startup.
|
||||||
|
5. Make changes in the HiSilicon error handling code for the same.
|
||||||
|
6. Add four modules supported by HiSilicon common section
|
||||||
|
|
||||||
* Fri Mar 31 2023 huangfangrun <huangfangrun1@h-partners.com> - 0.6.8-3
|
* Fri Mar 31 2023 huangfangrun <huangfangrun1@h-partners.com> - 0.6.8-3
|
||||||
- Type:bugfix
|
- Type:bugfix
|
||||||
- ID:NA
|
- ID:NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user