diff --git a/0001-rasdaemon-fix-return-value-type-issue-of-read-write-.patch b/0001-rasdaemon-fix-return-value-type-issue-of-read-write-.patch new file mode 100644 index 0000000000000000000000000000000000000000..f761d77999414c61bd7b87dad787a0aa3b1a7aa6 --- /dev/null +++ b/0001-rasdaemon-fix-return-value-type-issue-of-read-write-.patch @@ -0,0 +1,95 @@ +From 2eea64bc7437b0a5dabff52632a372446ddc4765 Mon Sep 17 00:00:00 2001 +From: Xiaofei Tan +Date: Thu, 11 May 2023 10:54:26 +0800 +Subject: [PATCH 1/4] 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 +Signed-off-by: Shiju Jose +--- + 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 + diff --git a/0002-rasdaemon-fix-issue-of-signed-and-unsigned-integer-c.patch b/0002-rasdaemon-fix-issue-of-signed-and-unsigned-integer-c.patch new file mode 100644 index 0000000000000000000000000000000000000000..a02e9a75f88b321422e5b5e11d82f0f1ea513e89 --- /dev/null +++ b/0002-rasdaemon-fix-issue-of-signed-and-unsigned-integer-c.patch @@ -0,0 +1,91 @@ +From 09b8c1c2d94c8c6dbf3e02f135784713c679bb64 Mon Sep 17 00:00:00 2001 +From: Xiaofei Tan +Date: Thu, 6 Apr 2023 14:41:14 +0800 +Subject: [PATCH 2/4] rasdaemon: fix issue of signed and unsigned integer + comparison + +The return value of ARRAY_SIZE() is unsigned integer. It isn't right to +compare it with a signed integer. This patch fix them. + +Signed-off-by: Xiaofei Tan +Signed-off-by: Shiju Jose +--- + non-standard-hisi_hip08.c | 2 +- + non-standard-hisilicon.c | 4 ++-- + ras-diskerror-handler.c | 2 +- + ras-memory-failure-handler.c | 4 ++-- + 4 files changed, 6 insertions(+), 6 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..dea3e11 100644 +--- a/non-standard-hisilicon.c ++++ b/non-standard-hisilicon.c +@@ -362,7 +362,7 @@ 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++) { +@@ -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..d66df6c 100644 +--- a/ras-memory-failure-handler.c ++++ b/ras-memory-failure-handler.c +@@ -99,7 +99,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 +110,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 + diff --git a/0003-rasdaemon-remove-redundant-header-file-and-do-some-c.patch b/0003-rasdaemon-remove-redundant-header-file-and-do-some-c.patch new file mode 100644 index 0000000000000000000000000000000000000000..e220e700c0e367cad6d6fcfd63caae443c8b76ee --- /dev/null +++ b/0003-rasdaemon-remove-redundant-header-file-and-do-some-c.patch @@ -0,0 +1,52 @@ +From 956e62ffe1976fd3a97e6cfd80f1dee44a8c0c5b Mon Sep 17 00:00:00 2001 +From: Xiaofei Tan +Date: Tue, 11 Apr 2023 10:29:08 +0800 +Subject: [PATCH 3/4] rasdaemon: remove redundant header file and do some + cleaup + +1.Remove redundant header file and adjust the header files sequence. +2.Use right character format for printf. + +Signed-off-by: Xiaofei Tan +Signed-off-by: Shiju Jose +--- + non-standard-hisilicon.c | 4 ++-- + ras-memory-failure-handler.c | 3 +-- + 2 files changed, 3 insertions(+), 4 deletions(-) + +diff --git a/non-standard-hisilicon.c b/non-standard-hisilicon.c +index dea3e11..0d5fe6b 100644 +--- a/non-standard-hisilicon.c ++++ b/non-standard-hisilicon.c +@@ -366,9 +366,9 @@ static int decode_hisi_common_section(struct ras_events *ras, + + 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]); + } + } +diff --git a/ras-memory-failure-handler.c b/ras-memory-failure-handler.c +index d66df6c..8fd7117 100644 +--- a/ras-memory-failure-handler.c ++++ b/ras-memory-failure-handler.c +@@ -15,11 +15,10 @@ + #include + #include + #include +-#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 { +-- +2.25.1 + diff --git a/0004-rasdaemon-ras-mc-ctl-Add-handling-of-run-time-errors.patch b/0004-rasdaemon-ras-mc-ctl-Add-handling-of-run-time-errors.patch new file mode 100644 index 0000000000000000000000000000000000000000..642310da94ae7db6ee4d8056fee99e1ca25cb162 --- /dev/null +++ b/0004-rasdaemon-ras-mc-ctl-Add-handling-of-run-time-errors.patch @@ -0,0 +1,481 @@ +From 4634ea4222edcc5c1f5b59ff794bf4c0f6e1e630 Mon Sep 17 00:00:00 2001 +From: Shiju Jose +Date: Thu, 27 Apr 2023 15:42:03 +0100 +Subject: [PATCH 4/4] rasdaemon: ras-mc-ctl: Add handling of run-time errors + reported when querying HiSilicon KunPeng9xx OEM errors + +Add try-catch for handling the run-time errors reported when querying +the HiSilicon KunPeng9xx OEM errors. +Reason: +For example, when an error table is not present in the SQLite DB, +then the DBI report error "no such table" and the ras-mc-ctl would exit +without query and log the other error types. +In the rasdaemon, for the vendor specific errors, the error table in the +SQLite database would be created, if not already done, when the corresponding +error is reported for the first time. + +Reported-by: Lei Feng +Signed-off-by: Shiju Jose +--- + util/ras-mc-ctl.in | 421 ++++++++++++++++++++++++++------------------- + 1 file changed, 245 insertions(+), 176 deletions(-) + +diff --git a/util/ras-mc-ctl.in b/util/ras-mc-ctl.in +index 1cc19b3..5abb5a0 100755 +--- a/util/ras-mc-ctl.in ++++ b/util/ras-mc-ctl.in +@@ -34,6 +34,7 @@ use File::Basename; + use File::Find; + use Getopt::Long; + use POSIX; ++use Try::Tiny; + + my $dbname = "@RASSTATEDIR@/@RAS_DB_FNAME@"; + my $prefix = "@prefix@"; +@@ -1551,81 +1552,115 @@ sub vendor_errors_summary + } + + my $dbh = DBI->connect("dbi:SQLite:dbname=$dbname", "", "", {}); ++ # Disable the DBI automatic error log ++ $dbh->{PrintError} = 0; + + # HiSilicon KunPeng9xx errors + if ($platform_id eq HISILICON_KUNPENG_9XX) { +- $found_platform = 1; +- $query = "select err_severity, module_id, count(*) from hip08_oem_type1_event_v2 group by err_severity, module_id"; +- $query_handle = $dbh->prepare($query); +- $query_handle->execute(); +- $query_handle->bind_columns(\($err_severity, $module_id, $count)); +- $out = ""; +- $err_sev = ""; +- while($query_handle->fetch()) { +- if ($err_severity ne $err_sev) { +- $out .= "$err_severity errors:\n"; +- $err_sev = $err_severity; ++ $found_platform = 1; ++ try { ++ $query = "select err_severity, module_id, count(*) from hip08_oem_type1_event_v2 group by err_severity, module_id"; ++ $query_handle = $dbh->prepare($query); ++ $query_handle->execute(); ++ $query_handle->bind_columns(\($err_severity, $module_id, $count)); ++ $out = ""; ++ $err_sev = ""; ++ while($query_handle->fetch()) { ++ if ($err_severity ne $err_sev) { ++ $out .= "$err_severity errors:\n"; ++ $err_sev = $err_severity; ++ } ++ $out .= "\t$module_id: $count\n"; + } +- $out .= "\t$module_id: $count\n"; +- } +- if ($out ne "") { +- print "HiSilicon KunPeng9xx OEM type1 error events summary:\n$out\n"; +- } +- $query_handle->finish; +- +- $query = "select err_severity, module_id, count(*) from hip08_oem_type2_event_v2 group by err_severity, module_id"; +- $query_handle = $dbh->prepare($query); +- $query_handle->execute(); +- $query_handle->bind_columns(\($err_severity, $module_id, $count)); +- $out = ""; +- $err_sev = ""; +- while($query_handle->fetch()) { +- if ($err_severity ne $err_sev) { +- $out .= "$err_severity errors:\n"; +- $err_sev = $err_severity; ++ if ($out ne "") { ++ print "HiSilicon KunPeng9xx OEM type1 error events summary:\n$out\n"; + } +- $out .= "\t$module_id: $count\n"; +- } +- if ($out ne "") { +- print "HiSilicon KunPeng9xx OEM type2 error events summary:\n$out\n"; +- } +- $query_handle->finish; +- +- $query = "select err_severity, sub_module_id, count(*) from hip08_pcie_local_event_v2 group by err_severity, sub_module_id"; +- $query_handle = $dbh->prepare($query); +- $query_handle->execute(); +- $query_handle->bind_columns(\($err_severity, $sub_module_id, $count)); +- $out = ""; +- $err_sev = ""; +- while($query_handle->fetch()) { +- if ($err_severity ne $err_sev) { +- $out .= "$err_severity errors:\n"; +- $err_sev = $err_severity; ++ $query_handle->finish; ++ } catch { ++ if ($DBI::errstr =~ "no such table") { ++ print "No HiSilicon KunPeng9xx OEM type1 errors\n\n"; ++ } else { ++ print "Warning: $DBI::errstr when querying HiSilicon KunPeng9xx OEM type1 errors\n\n"; + } +- $out .= "\t$sub_module_id: $count\n"; +- } +- if ($out ne "") { +- print "HiSilicon KunPeng9xx PCIe controller error events summary:\n$out\n"; +- } +- $query_handle->finish; +- +- $query = "select err_severity, module_id, count(*) from hisi_common_section_v2 group by err_severity, module_id"; +- $query_handle = $dbh->prepare($query); +- $query_handle->execute(); +- $query_handle->bind_columns(\($err_severity, $module_id, $count)); +- $out = ""; +- $err_sev = ""; +- while($query_handle->fetch()) { +- if ($err_severity ne $err_sev) { +- $out .= "$err_severity errors:\n"; +- $err_sev = $err_severity; ++ }; ++ ++ try { ++ $query = "select err_severity, module_id, count(*) from hip08_oem_type2_event_v2 group by err_severity, module_id"; ++ $query_handle = $dbh->prepare($query); ++ $query_handle->execute(); ++ $query_handle->bind_columns(\($err_severity, $module_id, $count)); ++ $out = ""; ++ $err_sev = ""; ++ while($query_handle->fetch()) { ++ if ($err_severity ne $err_sev) { ++ $out .= "$err_severity errors:\n"; ++ $err_sev = $err_severity; ++ } ++ $out .= "\t$module_id: $count\n"; + } +- $out .= "\t$module_id: $count\n"; +- } +- if ($out ne "") { +- print "HiSilicon KunPeng9xx common error events summary:\n$out\n"; +- } +- $query_handle->finish; ++ if ($out ne "") { ++ print "HiSilicon KunPeng9xx OEM type2 error events summary:\n$out\n"; ++ } ++ $query_handle->finish; ++ } catch { ++ if ($DBI::errstr =~ "no such table") { ++ print "No HiSilicon KunPeng9xx OEM type2 errors\n\n"; ++ } else { ++ print "Warning: $DBI::errstr when querying HiSilicon KunPeng9xx OEM type2 errors\n\n"; ++ } ++ }; ++ ++ try { ++ $query = "select err_severity, sub_module_id, count(*) from hip08_pcie_local_event_v2 group by err_severity, sub_module_id"; ++ $query_handle = $dbh->prepare($query); ++ $query_handle->execute(); ++ $query_handle->bind_columns(\($err_severity, $sub_module_id, $count)); ++ $out = ""; ++ $err_sev = ""; ++ while($query_handle->fetch()) { ++ if ($err_severity ne $err_sev) { ++ $out .= "$err_severity errors:\n"; ++ $err_sev = $err_severity; ++ } ++ $out .= "\t$sub_module_id: $count\n"; ++ } ++ if ($out ne "") { ++ print "HiSilicon KunPeng9xx PCIe controller error events summary:\n$out\n"; ++ } ++ $query_handle->finish; ++ } catch { ++ if ($DBI::errstr =~ "no such table") { ++ print "No HiSilicon KunPeng9xx PCIe controller errors\n\n"; ++ } else { ++ print "Warning: $DBI::errstr when querying HiSilicon KunPeng9xx PCIe controller errors\n\n"; ++ } ++ }; ++ ++ try { ++ $query = "select err_severity, module_id, count(*) from hisi_common_section_v2 group by err_severity, module_id"; ++ $query_handle = $dbh->prepare($query); ++ $query_handle->execute(); ++ $query_handle->bind_columns(\($err_severity, $module_id, $count)); ++ $out = ""; ++ $err_sev = ""; ++ while($query_handle->fetch()) { ++ if ($err_severity ne $err_sev) { ++ $out .= "$err_severity errors:\n"; ++ $err_sev = $err_severity; ++ } ++ $out .= "\t$module_id: $count\n"; ++ } ++ if ($out ne "") { ++ print "HiSilicon KunPeng9xx common error events summary:\n$out\n"; ++ } ++ $query_handle->finish; ++ } catch { ++ if ($DBI::errstr =~ "no such table") { ++ print "No HiSilicon KunPeng9xx common errors\n\n"; ++ } else { ++ print "Warning: $DBI::errstr when querying HiSilicon KunPeng9xx common errors\n\n"; ++ } ++ }; + } + + if ($platform_id && !($found_platform)) { +@@ -1659,117 +1694,151 @@ sub vendor_errors + } + + my $dbh = DBI->connect("dbi:SQLite:dbname=$dbname", "", "", {}); ++ # Disable the DBI automatic error log ++ $dbh->{PrintError} = 0; + + # HiSilicon KunPeng9xx errors + if ($platform_id eq HISILICON_KUNPENG_9XX) { +- $found_platform = 1; +- $query = "select id, timestamp, version, soc_id, socket_id, nimbus_id, module_id, sub_module_id, err_severity, regs_dump from hip08_oem_type1_event_v2 order by id, module_id, err_severity"; +- $query_handle = $dbh->prepare($query); +- $query_handle->execute(); +- $query_handle->bind_columns(\($id, $timestamp, $version, $soc_id, $socket_id, $nimbus_id, $module_id, $sub_module_id, $err_severity, $regs)); +- $out = ""; +- while($query_handle->fetch()) { +- if ($module eq 0 || ($module_id && uc($module) eq uc($module_id))) { +- $out .= "$id. $timestamp Error Info: "; +- $out .= "version=$version, "; +- $out .= "soc_id=$soc_id, " if ($soc_id); +- $out .= "socket_id=$socket_id, " if ($socket_id); +- $out .= "nimbus_id=$nimbus_id, " if ($nimbus_id); +- $out .= "module_id=$module_id, " if ($module_id); +- $out .= "sub_module_id=$sub_module_id, " if ($sub_module_id); +- $out .= "err_severity=$err_severity, " if ($err_severity); +- $out .= "Error Registers: $regs " if ($regs); +- $out .= "\n\n"; +- $found_module = 1; +- } +- } +- if ($out ne "") { +- print "HiSilicon KunPeng9xx OEM type1 error events:\n$out\n"; +- } +- $query_handle->finish; +- +- $query = "select id, timestamp, version, soc_id, socket_id, nimbus_id, module_id, sub_module_id, err_severity, regs_dump from hip08_oem_type2_event_v2 order by id, module_id, err_severity"; +- $query_handle = $dbh->prepare($query); +- $query_handle->execute(); +- $query_handle->bind_columns(\($id, $timestamp, $version, $soc_id, $socket_id, $nimbus_id, $module_id, $sub_module_id, $err_severity, $regs)); +- $out = ""; +- while($query_handle->fetch()) { +- if ($module eq 0 || ($module_id && uc($module) eq uc($module_id))) { +- $out .= "$id. $timestamp Error Info: "; +- $out .= "version=$version, "; +- $out .= "soc_id=$soc_id, " if ($soc_id); +- $out .= "socket_id=$socket_id, " if ($socket_id); +- $out .= "nimbus_id=$nimbus_id, " if ($nimbus_id); +- $out .= "module_id=$module_id, " if ($module_id); +- $out .= "sub_module_id=$sub_module_id, " if ($sub_module_id); +- $out .= "err_severity=$err_severity, " if ($err_severity); +- $out .= "Error Registers: $regs " if ($regs); +- $out .= "\n\n"; +- $found_module = 1; +- } +- } +- if ($out ne "") { +- print "HiSilicon KunPeng9xx OEM type2 error events:\n$out\n"; +- } +- $query_handle->finish; +- +- $query = "select id, timestamp, version, soc_id, socket_id, nimbus_id, sub_module_id, core_id, port_id, err_severity, err_type, regs_dump from hip08_pcie_local_event_v2 order by id, sub_module_id, err_severity"; +- $query_handle = $dbh->prepare($query); +- $query_handle->execute(); +- $query_handle->bind_columns(\($id, $timestamp, $version, $soc_id, $socket_id, $nimbus_id, $sub_module_id, $core_id, $port_id, $err_severity, $err_type, $regs)); +- $out = ""; +- while($query_handle->fetch()) { +- if ($module eq 0 || ($sub_module_id && uc($module) eq uc($sub_module_id))) { +- $out .= "$id. $timestamp Error Info: "; +- $out .= "version=$version, "; +- $out .= "soc_id=$soc_id, " if ($soc_id); +- $out .= "socket_id=$socket_id, " if ($socket_id); +- $out .= "nimbus_id=$nimbus_id, " if ($nimbus_id); +- $out .= "sub_module_id=$sub_module_id, " if ($sub_module_id); +- $out .= "core_id=$core_id, " if ($core_id); +- $out .= "port_id=$port_id, " if ($port_id); +- $out .= "err_severity=$err_severity, " if ($err_severity); +- $out .= "err_type=$err_type, " if ($err_type); +- $out .= "Error Registers: $regs " if ($regs); +- $out .= "\n\n"; +- $found_module = 1; +- } +- } +- if ($out ne "") { +- print "HiSilicon KunPeng9xx PCIe controller error events:\n$out\n"; +- } +- $query_handle->finish; +- +- $query = "select id, timestamp, version, soc_id, socket_id, totem_id, nimbus_id, sub_system_id, module_id, sub_module_id, core_id, port_id, err_type, pcie_info, err_severity, regs_dump from hisi_common_section_v2 order by id, module_id, err_severity"; +- $query_handle = $dbh->prepare($query); +- $query_handle->execute(); +- $query_handle->bind_columns(\($id, $timestamp, $version, $soc_id, $socket_id, $totem_id, $nimbus_id, $sub_system_id, $module_id, $sub_module_id, $core_id, $port_id, $err_type, $pcie_info, $err_severity, $regs)); +- $out = ""; +- while($query_handle->fetch()) { +- if ($module eq 0 || ($module_id && uc($module) eq uc($module_id))) { +- $out .= "$id. $timestamp Error Info: "; +- $out .= "version=$version, "; +- $out .= "soc_id=$soc_id, " if ($soc_id); +- $out .= "socket_id=$socket_id, " if ($socket_id); +- $out .= "totem_id=$totem_id, " if ($totem_id); +- $out .= "nimbus_id=$nimbus_id, " if ($nimbus_id); +- $out .= "sub_system_id=$sub_system_id, " if ($sub_system_id); +- $out .= "module_id=$module_id, " if ($module_id); +- $out .= "sub_module_id=$sub_module_id, " if ($sub_module_id); +- $out .= "core_id=$core_id, " if ($core_id); +- $out .= "port_id=$port_id, " if ($port_id); +- $out .= "err_type=$err_type, " if ($err_type); +- $out .= "pcie_info=$pcie_info, " if ($pcie_info); +- $out .= "err_severity=$err_severity, " if ($err_severity); +- $out .= "Error Registers: $regs" if ($regs); +- $out .= "\n\n"; +- $found_module = 1; +- } +- } +- if ($out ne "") { +- print "HiSilicon KunPeng9xx common error events:\n$out\n"; +- } +- $query_handle->finish; ++ $found_platform = 1; ++ try { ++ $query = "select id, timestamp, version, soc_id, socket_id, nimbus_id, module_id, sub_module_id, err_severity, regs_dump from hip08_oem_type1_event_v2 order by id, module_id, err_severity"; ++ $query_handle = $dbh->prepare($query); ++ $query_handle->execute(); ++ $query_handle->bind_columns(\($id, $timestamp, $version, $soc_id, $socket_id, $nimbus_id, $module_id, $sub_module_id, $err_severity, $regs)); ++ $out = ""; ++ while($query_handle->fetch()) { ++ if ($module eq 0 || ($module_id && uc($module) eq uc($module_id))) { ++ $out .= "$id. $timestamp Error Info: "; ++ $out .= "version=$version, "; ++ $out .= "soc_id=$soc_id, " if ($soc_id); ++ $out .= "socket_id=$socket_id, " if ($socket_id); ++ $out .= "nimbus_id=$nimbus_id, " if ($nimbus_id); ++ $out .= "module_id=$module_id, " if ($module_id); ++ $out .= "sub_module_id=$sub_module_id, " if ($sub_module_id); ++ $out .= "err_severity=$err_severity, " if ($err_severity); ++ $out .= "Error Registers: $regs " if ($regs); ++ $out .= "\n\n"; ++ $found_module = 1; ++ } ++ } ++ if ($out ne "") { ++ print "HiSilicon KunPeng9xx OEM type1 error events:\n$out\n"; ++ } ++ $query_handle->finish; ++ } catch { ++ if ($DBI::errstr =~ "no such table") { ++ print "No HiSilicon KunPeng9xx OEM type1 errors\n\n"; ++ } else { ++ print "Warning: $DBI::errstr when querying HiSilicon KunPeng9xx OEM type1 errors\n\n"; ++ } ++ }; ++ ++ try { ++ $query = "select id, timestamp, version, soc_id, socket_id, nimbus_id, module_id, sub_module_id, err_severity, regs_dump from hip08_oem_type2_event_v2 order by id, module_id, err_severity"; ++ $query_handle = $dbh->prepare($query); ++ $query_handle->execute(); ++ $query_handle->bind_columns(\($id, $timestamp, $version, $soc_id, $socket_id, $nimbus_id, $module_id, $sub_module_id, $err_severity, $regs)); ++ $out = ""; ++ while($query_handle->fetch()) { ++ if ($module eq 0 || ($module_id && uc($module) eq uc($module_id))) { ++ $out .= "$id. $timestamp Error Info: "; ++ $out .= "version=$version, "; ++ $out .= "soc_id=$soc_id, " if ($soc_id); ++ $out .= "socket_id=$socket_id, " if ($socket_id); ++ $out .= "nimbus_id=$nimbus_id, " if ($nimbus_id); ++ $out .= "module_id=$module_id, " if ($module_id); ++ $out .= "sub_module_id=$sub_module_id, " if ($sub_module_id); ++ $out .= "err_severity=$err_severity, " if ($err_severity); ++ $out .= "Error Registers: $regs " if ($regs); ++ $out .= "\n\n"; ++ $found_module = 1; ++ } ++ } ++ if ($out ne "") { ++ print "HiSilicon KunPeng9xx OEM type2 error events:\n$out\n"; ++ } ++ $query_handle->finish; ++ } catch { ++ if ($DBI::errstr =~ "no such table") { ++ print "No HiSilicon KunPeng9xx OEM type2 errors\n\n"; ++ } else { ++ print "Warning: $DBI::errstr when querying HiSilicon KunPeng9xx OEM type2 errors\n\n"; ++ } ++ }; ++ ++ try { ++ $query = "select id, timestamp, version, soc_id, socket_id, nimbus_id, sub_module_id, core_id, port_id, err_severity, err_type, regs_dump from hip08_pcie_local_event_v2 order by id, sub_module_id, err_severity"; ++ $query_handle = $dbh->prepare($query); ++ $query_handle->execute(); ++ $query_handle->bind_columns(\($id, $timestamp, $version, $soc_id, $socket_id, $nimbus_id, $sub_module_id, $core_id, $port_id, $err_severity, $err_type, $regs)); ++ $out = ""; ++ while($query_handle->fetch()) { ++ if ($module eq 0 || ($sub_module_id && uc($module) eq uc($sub_module_id))) { ++ $out .= "$id. $timestamp Error Info: "; ++ $out .= "version=$version, "; ++ $out .= "soc_id=$soc_id, " if ($soc_id); ++ $out .= "socket_id=$socket_id, " if ($socket_id); ++ $out .= "nimbus_id=$nimbus_id, " if ($nimbus_id); ++ $out .= "sub_module_id=$sub_module_id, " if ($sub_module_id); ++ $out .= "core_id=$core_id, " if ($core_id); ++ $out .= "port_id=$port_id, " if ($port_id); ++ $out .= "err_severity=$err_severity, " if ($err_severity); ++ $out .= "err_type=$err_type, " if ($err_type); ++ $out .= "Error Registers: $regs " if ($regs); ++ $out .= "\n\n"; ++ $found_module = 1; ++ } ++ } ++ if ($out ne "") { ++ print "HiSilicon KunPeng9xx PCIe controller error events:\n$out\n"; ++ } ++ $query_handle->finish; ++ } catch { ++ if ($DBI::errstr =~ "no such table") { ++ print "No HiSilicon KunPeng9xx PCIe controller errors\n\n"; ++ } else { ++ print "Warning: $DBI::errstr when querying HiSilicon KunPeng9xx PCIe controller errors\n\n"; ++ } ++ }; ++ ++ try { ++ $query = "select id, timestamp, version, soc_id, socket_id, totem_id, nimbus_id, sub_system_id, module_id, sub_module_id, core_id, port_id, err_type, pcie_info, err_severity, regs_dump from hisi_common_section_v2 order by id, module_id, err_severity"; ++ $query_handle = $dbh->prepare($query); ++ $query_handle->execute(); ++ $query_handle->bind_columns(\($id, $timestamp, $version, $soc_id, $socket_id, $totem_id, $nimbus_id, $sub_system_id, $module_id, $sub_module_id, $core_id, $port_id, $err_type, $pcie_info, $err_severity, $regs)); ++ $out = ""; ++ while($query_handle->fetch()) { ++ if ($module eq 0 || ($module_id && uc($module) eq uc($module_id))) { ++ $out .= "$id. $timestamp Error Info: "; ++ $out .= "version=$version, "; ++ $out .= "soc_id=$soc_id, " if ($soc_id); ++ $out .= "socket_id=$socket_id, " if ($socket_id); ++ $out .= "totem_id=$totem_id, " if ($totem_id); ++ $out .= "nimbus_id=$nimbus_id, " if ($nimbus_id); ++ $out .= "sub_system_id=$sub_system_id, " if ($sub_system_id); ++ $out .= "module_id=$module_id, " if ($module_id); ++ $out .= "sub_module_id=$sub_module_id, " if ($sub_module_id); ++ $out .= "core_id=$core_id, " if ($core_id); ++ $out .= "port_id=$port_id, " if ($port_id); ++ $out .= "err_type=$err_type, " if ($err_type); ++ $out .= "pcie_info=$pcie_info, " if ($pcie_info); ++ $out .= "err_severity=$err_severity, " if ($err_severity); ++ $out .= "Error Registers: $regs" if ($regs); ++ $out .= "\n\n"; ++ $found_module = 1; ++ } ++ } ++ if ($out ne "") { ++ print "HiSilicon KunPeng9xx common error events:\n$out\n"; ++ } ++ $query_handle->finish; ++ } catch { ++ if ($DBI::errstr =~ "no such table") { ++ print "No HiSilicon KunPeng9xx common errors\n\n"; ++ } else { ++ print "Warning: $DBI::errstr when querying HiSilicon KunPeng9xx common errors\n\n"; ++ } ++ }; + } + + if ($platform_id && !($found_platform)) { +-- +2.25.1 + diff --git a/rasdaemon.spec b/rasdaemon.spec index c0725c470e822c456c5678a99ca8941920b3a326..d3da1d38b3b118439fd48fef7af2d2cfef908415 100644 --- a/rasdaemon.spec +++ b/rasdaemon.spec @@ -1,6 +1,6 @@ Name: rasdaemon Version: 0.6.8 -Release: 3 +Release: 4 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 @@ -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 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 +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-remove-redundant-header-file-and-do-some-c.patch +Patch9019: 0004-rasdaemon-ras-mc-ctl-Add-handling-of-run-time-errors.patch %description The rasdaemon program is a daemon which monitors the platform @@ -83,6 +87,17 @@ rm INSTALL %{buildroot}/usr/include/*.h /usr/bin/systemctl enable rasdaemon.service >/dev/null 2>&1 || : %changelog +* Wed May 17 2023 Shiju Jose - 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 handling of run-time errors reported when querying + the HiSilicon KunPeng9xx OEM errors, in the ras-mc-ctl. + * Fri Mar 31 2023 huangfangrun - 0.6.8-3 - Type:bugfix - ID:NA