diff --git a/0001-rasdaemon-Fix-the-issue-of-sprintf-data-type-mismatc.patch b/0001-rasdaemon-Fix-the-issue-of-sprintf-data-type-mismatc.patch new file mode 100644 index 0000000000000000000000000000000000000000..25a61ffd7cf40b5a7b8aa4557f2d3c225f03d6a5 --- /dev/null +++ b/0001-rasdaemon-Fix-the-issue-of-sprintf-data-type-mismatc.patch @@ -0,0 +1,55 @@ +From 44fa917e290255570772926a2a11fd5bee3af90c Mon Sep 17 00:00:00 2001 +From: Xiaofei Tan +Date: Mon, 11 Oct 2021 10:22:10 +0800 +Subject: [PATCH 1/4] rasdaemon: Fix the issue of sprintf data type mismatch in + uuid_le() + +The data type of sprintf called in the function uuid_le() is mismatch. +Arm64 compiler force it to unsigned char by default, and can work normally. +But if someone compile it with the option -fsigned-char, the function +can't work correctly. + +Signed-off-by: Xiaofei Tan +--- + ras-extlog-handler.c | 2 +- + ras-non-standard-handler.c | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/ras-extlog-handler.c b/ras-extlog-handler.c +index 5fd3580..1834687 100644 +--- a/ras-extlog-handler.c ++++ b/ras-extlog-handler.c +@@ -152,7 +152,7 @@ static char *uuid_le(const char *uu) + static const unsigned char le[16] = {3,2,1,0,5,4,7,6,8,9,10,11,12,13,14,15}; + + for (i = 0; i < 16; i++) { +- p += sprintf(p, "%.2x", uu[le[i]]); ++ p += sprintf(p, "%.2x", (unsigned char) uu[le[i]]); + switch (i) { + case 3: + case 5: +diff --git a/ras-non-standard-handler.c b/ras-non-standard-handler.c +index 6ccf5bc..6d5a6f8 100644 +--- a/ras-non-standard-handler.c ++++ b/ras-non-standard-handler.c +@@ -36,7 +36,7 @@ static char *uuid_le(const char *uu) + static const unsigned char le[16] = {3,2,1,0,5,4,7,6,8,9,10,11,12,13,14,15}; + + for (i = 0; i < 16; i++) { +- p += sprintf(p, "%.2x", uu[le[i]]); ++ p += sprintf(p, "%.2x", (unsigned char) uu[le[i]]); + switch (i) { + case 3: + case 5: +@@ -61,7 +61,7 @@ static int uuid_le_cmp(const char *sec_type, const char *uuid2) + 3, 2, 1, 0, 5, 4, 7, 6, 8, 9, 10, 11, 12, 13, 14, 15}; + + for (i = 0; i < 16; i++) +- p += sprintf(p, "%.2x", sec_type[le[i]]); ++ p += sprintf(p, "%.2x", (unsigned char) sec_type[le[i]]); + *p = 0; + return strncmp(uuid1, uuid2, 32); + } +-- +2.33.0 + diff --git a/0002-rasdaemon-Fix-the-issue-of-command-option-r-for-hip0.patch b/0002-rasdaemon-Fix-the-issue-of-command-option-r-for-hip0.patch new file mode 100644 index 0000000000000000000000000000000000000000..248ef783f172d0c3744e065664d746379f20d156 --- /dev/null +++ b/0002-rasdaemon-Fix-the-issue-of-command-option-r-for-hip0.patch @@ -0,0 +1,72 @@ +From 6af26231fd58be578ea7d2ceb009fddf14c386a7 Mon Sep 17 00:00:00 2001 +From: Xiaofei Tan +Date: Mon, 1 Feb 2021 19:09:59 +0800 +Subject: [PATCH 2/4] rasdaemon: Fix the issue of command option -r for hip08 + +It will record event even the option -r is not provided for hip08. +It is not right, and fix it. + +Signed-off-by: Xiaofei Tan +--- + non-standard-hisi_hip08.c | 6 +++--- + non-standard-hisilicon.c | 6 ++++++ + 2 files changed, 9 insertions(+), 3 deletions(-) + +diff --git a/non-standard-hisi_hip08.c b/non-standard-hisi_hip08.c +index ebf03e1..9092183 100644 +--- a/non-standard-hisi_hip08.c ++++ b/non-standard-hisi_hip08.c +@@ -670,7 +670,7 @@ static int decode_hip08_oem_type1_error(struct ras_events *ras, + } + + #ifdef HAVE_SQLITE3 +- if (!ev_decoder->stmt_dec_record) { ++ 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) { +@@ -842,7 +842,7 @@ static int decode_hip08_oem_type2_error(struct ras_events *ras, + } + + #ifdef HAVE_SQLITE3 +- if (!ev_decoder->stmt_dec_record) { ++ 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) { + trace_seq_printf(s, +@@ -992,7 +992,7 @@ static int decode_hip08_pcie_local_error(struct ras_events *ras, + } + + #ifdef HAVE_SQLITE3 +- if (!ev_decoder->stmt_dec_record) { ++ 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, +diff --git a/non-standard-hisilicon.c b/non-standard-hisilicon.c +index a6f5e78..3fccff6 100644 +--- a/non-standard-hisilicon.c ++++ b/non-standard-hisilicon.c +@@ -77,6 +77,9 @@ void record_vendor_data(struct ras_ns_ev_decoder *ev_decoder, + enum hisi_oem_data_type data_type, + int id, int64_t data, const char *text) + { ++ if (ev_decoder->stmt_dec_record == NULL) ++ return; ++ + switch (data_type) { + case HISI_OEM_DATA_TYPE_INT: + sqlite3_bind_int(ev_decoder->stmt_dec_record, id, data); +@@ -94,6 +97,9 @@ int step_vendor_data_tab(struct ras_ns_ev_decoder *ev_decoder, const char *name) + { + int rc; + ++ if (ev_decoder->stmt_dec_record == NULL) ++ return 0; ++ + rc = sqlite3_step(ev_decoder->stmt_dec_record); + if (rc != SQLITE_OK && rc != SQLITE_DONE) + log(TERM, LOG_ERR, +-- +2.33.0 + diff --git a/0003-rasdaemon-Fix-some-print-format-issues-for-hisi-comm.patch b/0003-rasdaemon-Fix-some-print-format-issues-for-hisi-comm.patch new file mode 100644 index 0000000000000000000000000000000000000000..4391e9dfb2b77839ce2cb7899d0d3e8ea61c14ed --- /dev/null +++ b/0003-rasdaemon-Fix-some-print-format-issues-for-hisi-comm.patch @@ -0,0 +1,76 @@ +From 6ff3528ea696377fe1ec666839258abfcf8802b6 Mon Sep 17 00:00:00 2001 +From: Xiaofei Tan +Date: Fri, 20 Aug 2021 10:02:04 +0800 +Subject: [PATCH 3/4] rasdaemon: Fix some print format issues for hisi common + error section + +It is not right to use '%d' to print uint8_t and uint16_t, although +there is no function issue. Change to use '%hhu' and '%hu' separately. + +Signed-off-by: Xiaofei Tan +--- + non-standard-hisilicon.c | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +diff --git a/non-standard-hisilicon.c b/non-standard-hisilicon.c +index 3fccff6..f9c7bd4 100644 +--- a/non-standard-hisilicon.c ++++ b/non-standard-hisilicon.c +@@ -198,7 +198,7 @@ static const char* get_soc_desc(uint8_t soc_id) + static void decode_module(struct hisi_event *event, uint8_t module_id) + { + if (module_id >= sizeof(module_name)/sizeof(char *)) +- HISI_SNPRINTF(event->error_msg, "module=unknown(id=%d) ", module_id); ++ HISI_SNPRINTF(event->error_msg, "module=unknown(id=%hhu) ", module_id); + else + HISI_SNPRINTF(event->error_msg, "module=%s ", module_name[module_id]); + } +@@ -207,36 +207,36 @@ static void decode_hisi_common_section_hdr(struct ras_ns_ev_decoder *ev_decoder, + const struct hisi_common_error_section *err, + struct hisi_event *event) + { +- HISI_SNPRINTF(event->error_msg, "[ table_version=%d", err->version); ++ HISI_SNPRINTF(event->error_msg, "[ table_version=%hhu", err->version); + if (err->val_bits & BIT(HISI_COMMON_VALID_SOC_ID)) + HISI_SNPRINTF(event->error_msg, "soc=%s", get_soc_desc(err->soc_id)); + + if (err->val_bits & BIT(HISI_COMMON_VALID_SOCKET_ID)) +- HISI_SNPRINTF(event->error_msg, "socket_id=%d", err->socket_id); ++ HISI_SNPRINTF(event->error_msg, "socket_id=%hhu", err->socket_id); + + if (err->val_bits & BIT(HISI_COMMON_VALID_TOTEM_ID)) +- HISI_SNPRINTF(event->error_msg, "totem_id=%d", err->totem_id); ++ HISI_SNPRINTF(event->error_msg, "totem_id=%hhu", err->totem_id); + + if (err->val_bits & BIT(HISI_COMMON_VALID_NIMBUS_ID)) +- HISI_SNPRINTF(event->error_msg, "nimbus_id=%d", err->nimbus_id); ++ HISI_SNPRINTF(event->error_msg, "nimbus_id=%hhu", err->nimbus_id); + + if (err->val_bits & BIT(HISI_COMMON_VALID_SUBSYSTEM_ID)) +- HISI_SNPRINTF(event->error_msg, "subsystem_id=%d", err->subsystem_id); ++ HISI_SNPRINTF(event->error_msg, "subsystem_id=%hhu", err->subsystem_id); + + if (err->val_bits & BIT(HISI_COMMON_VALID_MODULE_ID)) + decode_module(event, err->module_id); + + if (err->val_bits & BIT(HISI_COMMON_VALID_SUBMODULE_ID)) +- HISI_SNPRINTF(event->error_msg, "submodule_id=%d", err->submodule_id); ++ HISI_SNPRINTF(event->error_msg, "submodule_id=%hhu", err->submodule_id); + + if (err->val_bits & BIT(HISI_COMMON_VALID_CORE_ID)) +- HISI_SNPRINTF(event->error_msg, "core_id=%d", err->core_id); ++ HISI_SNPRINTF(event->error_msg, "core_id=%hhu", err->core_id); + + if (err->val_bits & BIT(HISI_COMMON_VALID_PORT_ID)) +- HISI_SNPRINTF(event->error_msg, "port_id=%d", err->port_id); ++ HISI_SNPRINTF(event->error_msg, "port_id=%hhu", err->port_id); + + if (err->val_bits & BIT(HISI_COMMON_VALID_ERR_TYPE)) +- HISI_SNPRINTF(event->error_msg, "err_type=%d", err->err_type); ++ HISI_SNPRINTF(event->error_msg, "err_type=%hu", err->err_type); + + if (err->val_bits & BIT(HISI_COMMON_VALID_PCIE_INFO)) + HISI_SNPRINTF(event->error_msg, "pcie_device_id=%04x:%02x:%02x.%x", +-- +2.33.0 + diff --git a/0004-rasdaemon-Add-some-modules-supported-by-hisi-common-.patch b/0004-rasdaemon-Add-some-modules-supported-by-hisi-common-.patch new file mode 100644 index 0000000000000000000000000000000000000000..1d7a09add2cf063b195f86992e197f875125ae93 --- /dev/null +++ b/0004-rasdaemon-Add-some-modules-supported-by-hisi-common-.patch @@ -0,0 +1,35 @@ +From 31c1d5f335aa63fb02583eca8fe21a18fbcb865e Mon Sep 17 00:00:00 2001 +From: Xiaofei Tan +Date: Fri, 20 Aug 2021 10:39:12 +0800 +Subject: [PATCH 4/4] rasdaemon: Add some modules supported by hisi common + error section + +Add some modules supported by hisi common error section. Besides, +HHA is the module for some old platform, and it takes the same place +of MATA, so remove it. + +Signed-off-by: Xiaofei Tan +--- + 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 f9c7bd4..1432163 100644 +--- a/non-standard-hisilicon.c ++++ b/non-standard-hisilicon.c +@@ -184,7 +184,11 @@ static const char* module_name[] = { + "SEC", + "RDE", + "MEE", +- "HHA", ++ "L4D", ++ "Tsensor", ++ "ROH", ++ "BTC", ++ "HILINK" + }; + + static const char* get_soc_desc(uint8_t soc_id) +-- +2.33.0 + diff --git a/backport-0001-rasdaemon-Modify-non-standard-error-decoding-interfa.patch b/backport-0001-rasdaemon-Modify-non-standard-error-decoding-interfa.patch new file mode 100644 index 0000000000000000000000000000000000000000..2d864086f9388c86eb15ced419dfc36115395c87 --- /dev/null +++ b/backport-0001-rasdaemon-Modify-non-standard-error-decoding-interfa.patch @@ -0,0 +1,785 @@ +From 1c085f983f01ec09e5b0dd67dbb8b4afa89e7300 Mon Sep 17 00:00:00 2001 +From: Shiju Jose +Date: Mon, 10 Aug 2020 15:42:56 +0100 +Subject: [PATCH] rasdaemon: Modify non-standard error decoding interface using + linked list + +Replace the current non-standard error decoding interface with the +interface based on the linked list to avoid using realloc and +to improve the interface. + +Signed-off-by: Shiju Jose +Signed-off-by: Mauro Carvalho Chehab +--- + non-standard-hisi_hip08.c | 114 +++++++++++++++++----------------- + non-standard-hisilicon.c | 46 +++++++------- + non-standard-hisilicon.h | 4 +- + ras-non-standard-handler.c | 122 ++++++++++++++++++++----------------- + ras-non-standard-handler.h | 13 ++-- + 5 files changed, 155 insertions(+), 144 deletions(-) + +diff --git a/non-standard-hisi_hip08.c b/non-standard-hisi_hip08.c +index 2197f81..ebf03e1 100644 +--- a/non-standard-hisi_hip08.c ++++ b/non-standard-hisi_hip08.c +@@ -528,7 +528,7 @@ static const struct db_table_descriptor hip08_pcie_local_event_tab = { + #endif + + #define IN_RANGE(p, start, end) ((p) >= (start) && (p) < (end)) +-static void decode_oem_type1_err_hdr(struct ras_ns_dec_tab *dec_tab, ++static void decode_oem_type1_err_hdr(struct ras_ns_ev_decoder *ev_decoder, + struct trace_seq *s, + const struct hisi_oem_type1_err_sec *err) + { +@@ -537,26 +537,26 @@ static void decode_oem_type1_err_hdr(struct ras_ns_dec_tab *dec_tab, + char *end = buf + HISI_BUF_LEN; + + p += snprintf(p, end - p, "[ table_version=%d ", err->version); +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_INT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_INT, + HIP08_OEM_TYPE1_FIELD_VERSION, err->version, NULL); + + if (err->val_bits & HISI_OEM_VALID_SOC_ID && IN_RANGE(p, buf, end)) { + p += snprintf(p, end - p, "SOC_ID=%d ", err->soc_id); +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_INT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_INT, + HIP08_OEM_TYPE1_FIELD_SOC_ID, + err->soc_id, NULL); + } + + if (err->val_bits & HISI_OEM_VALID_SOCKET_ID && IN_RANGE(p, buf, end)) { + p += snprintf(p, end - p, "socket_ID=%d ", err->socket_id); +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_INT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_INT, + HIP08_OEM_TYPE1_FIELD_SOCKET_ID, + err->socket_id, NULL); + } + + if (err->val_bits & HISI_OEM_VALID_NIMBUS_ID && IN_RANGE(p, buf, end)) { + p += snprintf(p, end - p, "nimbus_ID=%d ", err->nimbus_id); +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_INT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_INT, + HIP08_OEM_TYPE1_FIELD_NIMBUS_ID, + err->nimbus_id, NULL); + } +@@ -566,7 +566,7 @@ static void decode_oem_type1_err_hdr(struct ras_ns_dec_tab *dec_tab, + err->module_id); + + p += snprintf(p, end - p, "module=%s ", str); +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_TEXT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_TEXT, + HIP08_OEM_TYPE1_FIELD_MODULE_ID, + 0, str); + } +@@ -578,7 +578,7 @@ static void decode_oem_type1_err_hdr(struct ras_ns_dec_tab *dec_tab, + err->sub_module_id); + + p += snprintf(p, end - p, "submodule=%s ", str); +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_TEXT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_TEXT, + HIP08_OEM_TYPE1_FIELD_SUB_MODULE_ID, + 0, str); + } +@@ -587,7 +587,7 @@ static void decode_oem_type1_err_hdr(struct ras_ns_dec_tab *dec_tab, + IN_RANGE(p, buf, end)) { + p += snprintf(p, end - p, "error_severity=%s ", + err_severity(err->err_severity)); +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_TEXT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_TEXT, + HIP08_OEM_TYPE1_FIELD_ERR_SEV, + 0, err_severity(err->err_severity)); + } +@@ -598,7 +598,7 @@ static void decode_oem_type1_err_hdr(struct ras_ns_dec_tab *dec_tab, + trace_seq_printf(s, "%s\n", buf); + } + +-static void decode_oem_type1_err_regs(struct ras_ns_dec_tab *dec_tab, ++static void decode_oem_type1_err_regs(struct ras_ns_ev_decoder *ev_decoder, + struct trace_seq *s, + const struct hisi_oem_type1_err_sec *err) + { +@@ -649,14 +649,14 @@ static void decode_oem_type1_err_regs(struct ras_ns_dec_tab *dec_tab, + *p = '\0'; + } + +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_TEXT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_TEXT, + HIP08_OEM_TYPE1_FIELD_REGS_DUMP, 0, buf); +- step_vendor_data_tab(dec_tab, "hip08_oem_type1_event_tab"); ++ step_vendor_data_tab(ev_decoder, "hip08_oem_type1_event_tab"); + } + + /* error data decoding functions */ + static int decode_hip08_oem_type1_error(struct ras_events *ras, +- struct ras_ns_dec_tab *dec_tab, ++ struct ras_ns_ev_decoder *ev_decoder, + struct trace_seq *s, + struct ras_non_standard_event *event) + { +@@ -670,8 +670,8 @@ static int decode_hip08_oem_type1_error(struct ras_events *ras, + } + + #ifdef HAVE_SQLITE3 +- if (!dec_tab->stmt_dec_record) { +- if (ras_mc_add_vendor_table(ras, &dec_tab->stmt_dec_record, ++ if (!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, +@@ -680,18 +680,18 @@ static int decode_hip08_oem_type1_error(struct ras_events *ras, + } + } + #endif +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_TEXT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_TEXT, + HIP08_OEM_TYPE1_FIELD_TIMESTAMP, + 0, event->timestamp); + + trace_seq_printf(s, "\nHISI HIP08: OEM Type-1 Error\n"); +- decode_oem_type1_err_hdr(dec_tab, s, err); +- decode_oem_type1_err_regs(dec_tab, s, err); ++ decode_oem_type1_err_hdr(ev_decoder, s, err); ++ decode_oem_type1_err_regs(ev_decoder, s, err); + + return 0; + } + +-static void decode_oem_type2_err_hdr(struct ras_ns_dec_tab *dec_tab, ++static void decode_oem_type2_err_hdr(struct ras_ns_ev_decoder *ev_decoder, + struct trace_seq *s, + const struct hisi_oem_type2_err_sec *err) + { +@@ -700,26 +700,26 @@ static void decode_oem_type2_err_hdr(struct ras_ns_dec_tab *dec_tab, + char *end = buf + HISI_BUF_LEN; + + p += snprintf(p, end - p, "[ table_version=%d ", err->version); +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_INT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_INT, + HIP08_OEM_TYPE2_FIELD_VERSION, err->version, NULL); + + if (err->val_bits & HISI_OEM_VALID_SOC_ID && IN_RANGE(p, buf, end)) { + p += snprintf(p, end - p, "SOC_ID=%d ", err->soc_id); +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_INT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_INT, + HIP08_OEM_TYPE2_FIELD_SOC_ID, + err->soc_id, NULL); + } + + if (err->val_bits & HISI_OEM_VALID_SOCKET_ID && IN_RANGE(p, buf, end)) { + p += snprintf(p, end - p, "socket_ID=%d ", err->socket_id); +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_INT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_INT, + HIP08_OEM_TYPE2_FIELD_SOCKET_ID, + err->socket_id, NULL); + } + + if (err->val_bits & HISI_OEM_VALID_NIMBUS_ID && IN_RANGE(p, buf, end)) { + p += snprintf(p, end - p, "nimbus_ID=%d ", err->nimbus_id); +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_INT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_INT, + HIP08_OEM_TYPE2_FIELD_NIMBUS_ID, + err->nimbus_id, NULL); + } +@@ -729,7 +729,7 @@ static void decode_oem_type2_err_hdr(struct ras_ns_dec_tab *dec_tab, + err->module_id); + + p += snprintf(p, end - p, "module=%s ", str); +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_TEXT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_TEXT, + HIP08_OEM_TYPE2_FIELD_MODULE_ID, + 0, str); + } +@@ -741,7 +741,7 @@ static void decode_oem_type2_err_hdr(struct ras_ns_dec_tab *dec_tab, + err->sub_module_id); + + p += snprintf(p, end - p, "submodule=%s ", str); +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_TEXT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_TEXT, + HIP08_OEM_TYPE2_FIELD_SUB_MODULE_ID, + 0, str); + } +@@ -750,7 +750,7 @@ static void decode_oem_type2_err_hdr(struct ras_ns_dec_tab *dec_tab, + IN_RANGE(p, buf, end)) { + p += snprintf(p, end - p, "error_severity=%s ", + err_severity(err->err_severity)); +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_TEXT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_TEXT, + HIP08_OEM_TYPE2_FIELD_ERR_SEV, + 0, err_severity(err->err_severity)); + } +@@ -761,7 +761,7 @@ static void decode_oem_type2_err_hdr(struct ras_ns_dec_tab *dec_tab, + trace_seq_printf(s, "%s\n", buf); + } + +-static void decode_oem_type2_err_regs(struct ras_ns_dec_tab *dec_tab, ++static void decode_oem_type2_err_regs(struct ras_ns_ev_decoder *ev_decoder, + struct trace_seq *s, + const struct hisi_oem_type2_err_sec *err) + { +@@ -822,13 +822,13 @@ static void decode_oem_type2_err_regs(struct ras_ns_dec_tab *dec_tab, + *p = '\0'; + } + +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_TEXT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_TEXT, + HIP08_OEM_TYPE2_FIELD_REGS_DUMP, 0, buf); +- step_vendor_data_tab(dec_tab, "hip08_oem_type2_event_tab"); ++ step_vendor_data_tab(ev_decoder, "hip08_oem_type2_event_tab"); + } + + static int decode_hip08_oem_type2_error(struct ras_events *ras, +- struct ras_ns_dec_tab *dec_tab, ++ struct ras_ns_ev_decoder *ev_decoder, + struct trace_seq *s, + struct ras_non_standard_event *event) + { +@@ -842,8 +842,8 @@ static int decode_hip08_oem_type2_error(struct ras_events *ras, + } + + #ifdef HAVE_SQLITE3 +- if (!dec_tab->stmt_dec_record) { +- if (ras_mc_add_vendor_table(ras, &dec_tab->stmt_dec_record, ++ if (!ev_decoder->stmt_dec_record) { ++ if (ras_mc_add_vendor_table(ras, &ev_decoder->stmt_dec_record, + &hip08_oem_type2_event_tab) != SQLITE_OK) { + trace_seq_printf(s, + "create sql hip08_oem_type2_event_tab fail\n"); +@@ -851,18 +851,18 @@ static int decode_hip08_oem_type2_error(struct ras_events *ras, + } + } + #endif +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_TEXT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_TEXT, + HIP08_OEM_TYPE2_FIELD_TIMESTAMP, + 0, event->timestamp); + + trace_seq_printf(s, "\nHISI HIP08: OEM Type-2 Error\n"); +- decode_oem_type2_err_hdr(dec_tab, s, err); +- decode_oem_type2_err_regs(dec_tab, s, err); ++ decode_oem_type2_err_hdr(ev_decoder, s, err); ++ decode_oem_type2_err_regs(ev_decoder, s, err); + + return 0; + } + +-static void decode_pcie_local_err_hdr(struct ras_ns_dec_tab *dec_tab, ++static void decode_pcie_local_err_hdr(struct ras_ns_ev_decoder *ev_decoder, + struct trace_seq *s, + const struct hisi_pcie_local_err_sec *err) + { +@@ -871,14 +871,14 @@ static void decode_pcie_local_err_hdr(struct ras_ns_dec_tab *dec_tab, + char *end = buf + HISI_BUF_LEN; + + p += snprintf(p, end - p, "[ table_version=%d ", err->version); +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_INT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_INT, + HIP08_PCIE_LOCAL_FIELD_VERSION, + err->version, NULL); + + if (err->val_bits & HISI_PCIE_LOCAL_VALID_SOC_ID && + IN_RANGE(p, buf, end)) { + p += snprintf(p, end - p, "SOC_ID=%d ", err->soc_id); +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_INT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_INT, + HIP08_PCIE_LOCAL_FIELD_SOC_ID, + err->soc_id, NULL); + } +@@ -886,7 +886,7 @@ static void decode_pcie_local_err_hdr(struct ras_ns_dec_tab *dec_tab, + if (err->val_bits & HISI_PCIE_LOCAL_VALID_SOCKET_ID && + IN_RANGE(p, buf, end)) { + p += snprintf(p, end - p, "socket_ID=%d ", err->socket_id); +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_INT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_INT, + HIP08_PCIE_LOCAL_FIELD_SOCKET_ID, + err->socket_id, NULL); + } +@@ -894,7 +894,7 @@ static void decode_pcie_local_err_hdr(struct ras_ns_dec_tab *dec_tab, + if (err->val_bits & HISI_PCIE_LOCAL_VALID_NIMBUS_ID && + IN_RANGE(p, buf, end)) { + p += snprintf(p, end - p, "nimbus_ID=%d ", err->nimbus_id); +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_INT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_INT, + HIP08_PCIE_LOCAL_FIELD_NIMBUS_ID, + err->nimbus_id, NULL); + } +@@ -903,7 +903,7 @@ static void decode_pcie_local_err_hdr(struct ras_ns_dec_tab *dec_tab, + IN_RANGE(p, buf, end)) { + p += snprintf(p, end - p, "submodule=%s ", + pcie_local_sub_module_name(err->sub_module_id)); +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_TEXT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_TEXT, + HIP08_PCIE_LOCAL_FIELD_SUB_MODULE_ID, + 0, pcie_local_sub_module_name(err->sub_module_id)); + } +@@ -911,7 +911,7 @@ static void decode_pcie_local_err_hdr(struct ras_ns_dec_tab *dec_tab, + if (err->val_bits & HISI_PCIE_LOCAL_VALID_CORE_ID && + IN_RANGE(p, buf, end)) { + p += snprintf(p, end - p, "core_ID=core%d ", err->core_id); +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_INT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_INT, + HIP08_PCIE_LOCAL_FIELD_CORE_ID, + err->core_id, NULL); + } +@@ -919,7 +919,7 @@ static void decode_pcie_local_err_hdr(struct ras_ns_dec_tab *dec_tab, + if (err->val_bits & HISI_PCIE_LOCAL_VALID_PORT_ID && + IN_RANGE(p, buf, end)) { + p += snprintf(p, end - p, "port_ID=port%d ", err->port_id); +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_INT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_INT, + HIP08_PCIE_LOCAL_FIELD_PORT_ID, + err->port_id, NULL); + } +@@ -928,7 +928,7 @@ static void decode_pcie_local_err_hdr(struct ras_ns_dec_tab *dec_tab, + IN_RANGE(p, buf, end)) { + p += snprintf(p, end - p, "error_severity=%s ", + err_severity(err->err_severity)); +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_TEXT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_TEXT, + HIP08_PCIE_LOCAL_FIELD_ERR_SEV, + 0, err_severity(err->err_severity)); + } +@@ -936,7 +936,7 @@ static void decode_pcie_local_err_hdr(struct ras_ns_dec_tab *dec_tab, + if (err->val_bits & HISI_PCIE_LOCAL_VALID_ERR_TYPE && + IN_RANGE(p, buf, end)) { + p += snprintf(p, end - p, "error_type=0x%x ", err->err_type); +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_INT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_INT, + HIP08_PCIE_LOCAL_FIELD_ERR_TYPE, + err->err_type, NULL); + } +@@ -947,7 +947,7 @@ static void decode_pcie_local_err_hdr(struct ras_ns_dec_tab *dec_tab, + trace_seq_printf(s, "%s\n", buf); + } + +-static void decode_pcie_local_err_regs(struct ras_ns_dec_tab *dec_tab, ++static void decode_pcie_local_err_regs(struct ras_ns_ev_decoder *ev_decoder, + struct trace_seq *s, + const struct hisi_pcie_local_err_sec *err) + { +@@ -972,13 +972,13 @@ static void decode_pcie_local_err_regs(struct ras_ns_dec_tab *dec_tab, + *p = '\0'; + } + +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_TEXT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_TEXT, + HIP08_PCIE_LOCAL_FIELD_REGS_DUMP, 0, buf); +- step_vendor_data_tab(dec_tab, "hip08_pcie_local_event_tab"); ++ step_vendor_data_tab(ev_decoder, "hip08_pcie_local_event_tab"); + } + + static int decode_hip08_pcie_local_error(struct ras_events *ras, +- struct ras_ns_dec_tab *dec_tab, ++ struct ras_ns_ev_decoder *ev_decoder, + struct trace_seq *s, + struct ras_non_standard_event *event) + { +@@ -992,8 +992,8 @@ static int decode_hip08_pcie_local_error(struct ras_events *ras, + } + + #ifdef HAVE_SQLITE3 +- if (!dec_tab->stmt_dec_record) { +- if (ras_mc_add_vendor_table(ras, &dec_tab->stmt_dec_record, ++ if (!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"); +@@ -1001,18 +1001,18 @@ static int decode_hip08_pcie_local_error(struct ras_events *ras, + } + } + #endif +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_TEXT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_TEXT, + HIP08_PCIE_LOCAL_FIELD_TIMESTAMP, + 0, event->timestamp); + + trace_seq_printf(s, "\nHISI HIP08: PCIe local error\n"); +- decode_pcie_local_err_hdr(dec_tab, s, err); +- decode_pcie_local_err_regs(dec_tab, s, err); ++ decode_pcie_local_err_hdr(ev_decoder, s, err); ++ decode_pcie_local_err_regs(ev_decoder, s, err); + + return 0; + } + +-struct ras_ns_dec_tab hip08_ns_oem_tab[] = { ++static struct ras_ns_ev_decoder hip08_ns_ev_decoder[] = { + { + .sec_type = "1f8161e155d641e6bd107afd1dc5f7c5", + .decode = decode_hip08_oem_type1_error, +@@ -1025,10 +1025,12 @@ struct ras_ns_dec_tab hip08_ns_oem_tab[] = { + .sec_type = "b2889fc9e7d74f9da867af42e98be772", + .decode = decode_hip08_pcie_local_error, + }, +- { /* sentinel */ } + }; + + static void __attribute__((constructor)) hip08_init(void) + { +- register_ns_dec_tab(hip08_ns_oem_tab); ++ 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 c9e1fa9..a6f5e78 100644 +--- a/non-standard-hisilicon.c ++++ b/non-standard-hisilicon.c +@@ -73,38 +73,38 @@ struct hisi_event { + }; + + #ifdef HAVE_SQLITE3 +-void record_vendor_data(struct ras_ns_dec_tab *dec_tab, ++void record_vendor_data(struct ras_ns_ev_decoder *ev_decoder, + enum hisi_oem_data_type data_type, + int id, int64_t data, const char *text) + { + switch (data_type) { + case HISI_OEM_DATA_TYPE_INT: +- sqlite3_bind_int(dec_tab->stmt_dec_record, id, data); ++ sqlite3_bind_int(ev_decoder->stmt_dec_record, id, data); + break; + case HISI_OEM_DATA_TYPE_INT64: +- sqlite3_bind_int64(dec_tab->stmt_dec_record, id, data); ++ sqlite3_bind_int64(ev_decoder->stmt_dec_record, id, data); + break; + case HISI_OEM_DATA_TYPE_TEXT: +- sqlite3_bind_text(dec_tab->stmt_dec_record, id, text, -1, NULL); ++ sqlite3_bind_text(ev_decoder->stmt_dec_record, id, text, -1, NULL); + break; + } + } + +-int step_vendor_data_tab(struct ras_ns_dec_tab *dec_tab, const char *name) ++int step_vendor_data_tab(struct ras_ns_ev_decoder *ev_decoder, const char *name) + { + int rc; + +- rc = sqlite3_step(dec_tab->stmt_dec_record); ++ rc = sqlite3_step(ev_decoder->stmt_dec_record); + if (rc != SQLITE_OK && rc != SQLITE_DONE) + log(TERM, LOG_ERR, + "Failed to do %s step on sqlite: error = %d\n", name, rc); + +- rc = sqlite3_reset(dec_tab->stmt_dec_record); ++ rc = sqlite3_reset(ev_decoder->stmt_dec_record); + if (rc != SQLITE_OK && rc != SQLITE_DONE) + log(TERM, LOG_ERR, + "Failed to reset %s on sqlite: error = %d\n", name, rc); + +- rc = sqlite3_clear_bindings(dec_tab->stmt_dec_record); ++ rc = sqlite3_clear_bindings(ev_decoder->stmt_dec_record); + if (rc != SQLITE_OK && rc != SQLITE_DONE) + log(TERM, LOG_ERR, + "Failed to clear bindings %s on sqlite: error = %d\n", +@@ -113,12 +113,12 @@ int step_vendor_data_tab(struct ras_ns_dec_tab *dec_tab, const char *name) + return rc; + } + #else +-void record_vendor_data(struct ras_ns_dec_tab *dec_tab, ++void record_vendor_data(struct ras_ns_ev_decoder *ev_decoder, + enum hisi_oem_data_type data_type, + int id, int64_t data, const char *text) + { } + +-int step_vendor_data_tab(struct ras_ns_dec_tab *dec_tab, const char *name) ++int step_vendor_data_tab(struct ras_ns_ev_decoder *ev_decoder, const char *name) + { + return 0; + } +@@ -197,7 +197,7 @@ static void decode_module(struct hisi_event *event, uint8_t module_id) + HISI_SNPRINTF(event->error_msg, "module=%s ", module_name[module_id]); + } + +-static void decode_hisi_common_section_hdr(struct ras_ns_dec_tab *dec_tab, ++static void decode_hisi_common_section_hdr(struct ras_ns_ev_decoder *ev_decoder, + const struct hisi_common_error_section *err, + struct hisi_event *event) + { +@@ -244,7 +244,7 @@ static void decode_hisi_common_section_hdr(struct ras_ns_dec_tab *dec_tab, + } + + static int decode_hisi_common_section(struct ras_events *ras, +- struct ras_ns_dec_tab *dec_tab, ++ struct ras_ns_ev_decoder *ev_decoder, + struct trace_seq *s, + struct ras_non_standard_event *event) + { +@@ -253,8 +253,8 @@ static int decode_hisi_common_section(struct ras_events *ras, + struct hisi_event hevent; + + #ifdef HAVE_SQLITE3 +- if (ras->record_events && !dec_tab->stmt_dec_record) { +- if (ras_mc_add_vendor_table(ras, &dec_tab->stmt_dec_record, ++ 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; +@@ -264,7 +264,7 @@ static int decode_hisi_common_section(struct ras_events *ras, + + memset(&hevent, 0, sizeof(struct hisi_event)); + trace_seq_printf(s, "\nHisilicon Common Error Section:\n"); +- decode_hisi_common_section_hdr(dec_tab, err, &hevent); ++ decode_hisi_common_section_hdr(ev_decoder, err, &hevent); + 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) { +@@ -280,28 +280,30 @@ static int decode_hisi_common_section(struct ras_events *ras, + } + + if (ras->record_events) { +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_TEXT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_TEXT, + HISI_COMMON_FIELD_TIMESTAMP, + 0, event->timestamp); +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_TEXT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_TEXT, + HISI_COMMON_FIELD_ERR_INFO, 0, hevent.error_msg); +- record_vendor_data(dec_tab, HISI_OEM_DATA_TYPE_TEXT, ++ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_TEXT, + HISI_COMMON_FIELD_REGS_DUMP, 0, hevent.reg_msg); +- step_vendor_data_tab(dec_tab, "hisi_common_section_tab"); ++ step_vendor_data_tab(ev_decoder, "hisi_common_section_tab"); + } + + return 0; + } + +-struct ras_ns_dec_tab hisi_section_ns_tab[] = { ++static struct ras_ns_ev_decoder hisi_section_ns_ev_decoder[] = { + { + .sec_type = "c8b328a899174af69a132e08ab2e7586", + .decode = decode_hisi_common_section, + }, +- { /* sentinel */ } + }; + + static void __attribute__((constructor)) hisi_ns_init(void) + { +- register_ns_dec_tab(hisi_section_ns_tab); ++ 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/non-standard-hisilicon.h b/non-standard-hisilicon.h +index 1ce210a..75b911e 100644 +--- a/non-standard-hisilicon.h ++++ b/non-standard-hisilicon.h +@@ -41,9 +41,9 @@ static inline char *err_severity(uint8_t err_sev) + return "unknown"; + } + +-void record_vendor_data(struct ras_ns_dec_tab *dec_tab, ++void record_vendor_data(struct ras_ns_ev_decoder *ev_decoder, + enum hisi_oem_data_type data_type, + int id, int64_t data, const char *text); +-int step_vendor_data_tab(struct ras_ns_dec_tab *dec_tab, const char *name); ++int step_vendor_data_tab(struct ras_ns_ev_decoder *ev_decoder, const char *name); + + #endif +diff --git a/ras-non-standard-handler.c b/ras-non-standard-handler.c +index d92fd42..1862335 100644 +--- a/ras-non-standard-handler.c ++++ b/ras-non-standard-handler.c +@@ -22,46 +22,7 @@ + #include "ras-logger.h" + #include "ras-report.h" + +-static p_ns_dec_tab * ns_dec_tab; +-static size_t dec_tab_count; +- +-int register_ns_dec_tab(const p_ns_dec_tab tab) +-{ +- ns_dec_tab = (p_ns_dec_tab *)realloc(ns_dec_tab, +- (dec_tab_count + 1) * sizeof(tab)); +- if (ns_dec_tab == NULL) { +- printf("%s p_ns_dec_tab malloc failed", __func__); +- return -1; +- } +- ns_dec_tab[dec_tab_count] = tab; +- dec_tab_count++; +- return 0; +-} +- +-void unregister_ns_dec_tab(void) +-{ +- if (ns_dec_tab) { +-#ifdef HAVE_SQLITE3 +- p_ns_dec_tab dec_tab; +- int i, count; +- +- for (count = 0; count < dec_tab_count; count++) { +- dec_tab = ns_dec_tab[count]; +- for (i = 0; dec_tab[i].decode; i++) { +- if (dec_tab[i].stmt_dec_record) { +- ras_mc_finalize_vendor_table( +- dec_tab[i].stmt_dec_record); +- dec_tab[i].stmt_dec_record = NULL; +- } +- } +- } +-#endif +- +- free(ns_dec_tab); +- ns_dec_tab = NULL; +- dec_tab_count = 0; +- } +-} ++static struct ras_ns_ev_decoder *ras_ns_ev_dec_list; + + void print_le_hex(struct trace_seq *s, const uint8_t *buf, int index) { + trace_seq_printf(s, "%02x%02x%02x%02x", buf[index+3], buf[index+2], buf[index+1], buf[index]); +@@ -105,18 +66,75 @@ static int uuid_le_cmp(const char *sec_type, const char *uuid2) + return strncmp(uuid1, uuid2, 32); + } + ++int register_ns_ev_decoder(struct ras_ns_ev_decoder *ns_ev_decoder) ++{ ++ struct ras_ns_ev_decoder *list; ++ ++ if (!ns_ev_decoder) ++ return -1; ++ ++ ns_ev_decoder->next = NULL; ++ ns_ev_decoder->stmt_dec_record = NULL; ++ if (!ras_ns_ev_dec_list) { ++ ras_ns_ev_dec_list = ns_ev_decoder; ++ } else { ++ list = ras_ns_ev_dec_list; ++ while (list->next) ++ list = list->next; ++ list->next = ns_ev_decoder; ++ } ++ ++ 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; ++ int match = 0; ++ ++ ns_ev_decoder = ras_ns_ev_dec_list; ++ while (ns_ev_decoder) { ++ if (uuid_le_cmp(sec_type, ns_ev_decoder->sec_type) == 0) { ++ *p_ns_ev_dec = ns_ev_decoder; ++ match = 1; ++ break; ++ } ++ ns_ev_decoder = ns_ev_decoder->next; ++ } ++ ++ if (!match) ++ return -1; ++ ++ return 0; ++} ++ ++static void unregister_ns_ev_decoder(void) ++{ ++#ifdef HAVE_SQLITE3 ++ struct ras_ns_ev_decoder *ns_ev_decoder = ras_ns_ev_dec_list; ++ ++ while (ns_ev_decoder) { ++ if (ns_ev_decoder->stmt_dec_record) { ++ ras_mc_finalize_vendor_table(ns_ev_decoder->stmt_dec_record); ++ ns_ev_decoder->stmt_dec_record = NULL; ++ } ++ ns_ev_decoder = ns_ev_decoder->next; ++ } ++#endif ++ ras_ns_ev_dec_list = NULL; ++} ++ + int ras_non_standard_event_handler(struct trace_seq *s, + struct pevent_record *record, + struct event_format *event, void *context) + { +- int len, i, line_count, count; ++ int len, i, line_count; + unsigned long long val; + struct ras_events *ras = context; + time_t now; + struct tm *tm; + struct ras_non_standard_event ev; +- p_ns_dec_tab dec_tab; +- bool dec_done = false; ++ struct ras_ns_ev_decoder *ns_ev_decoder; + + /* + * Newer kernels (3.10-rc1 or upper) provide an uptime clock. +@@ -177,19 +195,9 @@ int ras_non_standard_event_handler(struct trace_seq *s, + if(!ev.error) + return -1; + +- for (count = 0; count < dec_tab_count && !dec_done; count++) { +- dec_tab = ns_dec_tab[count]; +- for (i = 0; dec_tab[i].decode; i++) { +- if (uuid_le_cmp(ev.sec_type, +- dec_tab[i].sec_type) == 0) { +- dec_tab[i].decode(ras, &dec_tab[i], s, &ev); +- dec_done = true; +- break; +- } +- } +- } +- +- if (!dec_done) { ++ if (!find_ns_ev_decoder(ev.sec_type, &ns_ev_decoder)) { ++ ns_ev_decoder->decode(ras, ns_ev_decoder, s, &ev); ++ } else { + len = ev.length; + i = 0; + line_count = 0; +@@ -222,5 +230,5 @@ int ras_non_standard_event_handler(struct trace_seq *s, + __attribute__((destructor)) + static void ns_exit(void) + { +- unregister_ns_dec_tab(); ++ unregister_ns_ev_decoder(); + } +diff --git a/ras-non-standard-handler.h b/ras-non-standard-handler.h +index 2b9bf40..57d4cb5 100644 +--- a/ras-non-standard-handler.h ++++ b/ras-non-standard-handler.h +@@ -20,15 +20,16 @@ + #define BIT(nr) (1UL << (nr)) + #define BIT_ULL(nr) (1ULL << (nr)) + +-typedef struct ras_ns_dec_tab { ++struct ras_ns_ev_decoder { ++ struct ras_ns_ev_decoder *next; + const char *sec_type; +- int (*decode)(struct ras_events *ras, struct ras_ns_dec_tab *dec_tab, ++ 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 + #include + sqlite3_stmt *stmt_dec_record; + #endif +-} *p_ns_dec_tab; ++}; + + int ras_non_standard_event_handler(struct trace_seq *s, + struct pevent_record *record, +@@ -37,11 +38,9 @@ int ras_non_standard_event_handler(struct trace_seq *s, + void print_le_hex(struct trace_seq *s, const uint8_t *buf, int index); + + #ifdef HAVE_NON_STANDARD +-int register_ns_dec_tab(const p_ns_dec_tab tab); +-void unregister_ns_dec_tab(void); ++int register_ns_ev_decoder(struct ras_ns_ev_decoder *ns_ev_decoder); + #else +-static inline int register_ns_dec_tab(const p_ns_dec_tab tab) { return 0; }; +-static inline void unregister_ns_dec_tab(void) { return; }; ++static inline int register_ns_ev_decoder(struct ras_ns_ev_decoder *ns_ev_decoder) { return 0; }; + #endif + + #endif +-- +2.33.0 + diff --git a/rasdaemon.spec b/rasdaemon.spec index defffc2568876a805e41d5496ef16570ac29af56..7112d825c30083defe23af5283280c717781209c 100644 --- a/rasdaemon.spec +++ b/rasdaemon.spec @@ -1,6 +1,6 @@ Name: rasdaemon Version: 0.6.6 -Release: 4 +Release: 5 License: GPLv2 Summary: Utility to get Platform Reliability, Availability and Serviceability (RAS) reports via the Kernel tracing events URL: https://github.com/mchehab/rasdaemon.git @@ -27,6 +27,11 @@ Patch5: backport-rasdaemon-Fix-error-print.patch Patch6: backport-0001-rasdaemon-delete-the-duplicate-code-about-the-defini.patch Patch7: backport-0002-rasdaemon-delete-the-code-of-non-standard-error-deco.patch Patch8: backport-0003-rasdaemon-add-support-for-hisilicon-common-section-d.patch +Patch9: backport-0001-rasdaemon-Modify-non-standard-error-decoding-interfa.patch +Patch10: 0001-rasdaemon-Fix-the-issue-of-sprintf-data-type-mismatc.patch +Patch11: 0002-rasdaemon-Fix-the-issue-of-command-option-r-for-hip0.patch +Patch12: 0003-rasdaemon-Fix-some-print-format-issues-for-hisi-comm.patch +Patch13: 0004-rasdaemon-Add-some-modules-supported-by-hisi-common-.patch %description The rasdaemon program is a daemon which monitors the platform @@ -73,6 +78,18 @@ rm INSTALL %{buildroot}/usr/include/*.h /usr/bin/systemctl enable rasdaemon.service >/dev/null 2>&1 || : %changelog +* Wed Oct 20 2021 tanxiaofei - 0.6.6-5 +- Type:Bugfix +- ID:NA +- SUG:NA +- DESC: Backport one patch, and some little fixes and add some modules + support for kunpeng series: + 1. Modify non-standard error decoding interface using linked list + 2. Fix the issue of sprintf data type mismatch in uuid_le() + 3. Fix the issue of command option -r for hip08 + 4. Fix some print format issues for hisi common error section + 5. Add some modules supported by hisi common error section + * Sat July 29 2021 tanxiaofei - 0.6.6-4 - Type:feature - ID:NA