From db5fc9d2124c7d100185e02564fd3415ab9055a8 Mon Sep 17 00:00:00 2001 From: caixiaomeng Date: Mon, 18 Dec 2023 11:24:49 +0800 Subject: [PATCH] backport patches from upstream --- 0001-Check-CPUs-online-not-configured.patch | 38 ++++++ ...-ctl-Modify-check-for-HiSilicon-KunP.patch | 118 ++++++++++++++++++ rasdaemon.spec | 10 +- 3 files changed, 165 insertions(+), 1 deletion(-) create mode 100644 0001-Check-CPUs-online-not-configured.patch create mode 100644 0001-rasdaemon-ras-mc-ctl-Modify-check-for-HiSilicon-KunP.patch diff --git a/0001-Check-CPUs-online-not-configured.patch b/0001-Check-CPUs-online-not-configured.patch new file mode 100644 index 0000000..60f5b4e --- /dev/null +++ b/0001-Check-CPUs-online-not-configured.patch @@ -0,0 +1,38 @@ +From f1ea76375281001cdf4a048c1a4a24d86c6fbe48 Mon Sep 17 00:00:00 2001 +From: Zeph / Liz Loss-Cutler-Hull +Date: Sun, 9 Jul 2023 04:57:19 -0700 +Subject: [PATCH] Check CPUs online, not configured. + +When the number of CPUs detected is greater than the number of CPUs in +the system, rasdaemon will crash when it receives some events. + +Looking deeper, we also fail to use the poll method for similar reasons +in this case. + +All of this can be prevented by checking to see how many CPUs are +currently online (sysconf(_SC_NPROCESSORS_ONLN)) instead of how many +CPUs the current kernel was configured to support +(sysconf(_SC_NPROCESSORS_CONF)). + +For the kernel side of the discussion, see https://lore.kernel.org/lkml/CAM6Wdxft33zLeeXHhmNX5jyJtfGTLiwkQSApc=10fqf+rQh9DA@mail.gmail.com/T/ +Signed-off-by: Mauro Carvalho Chehab +--- + ras-events.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ras-events.c b/ras-events.c +index a82dab2..5935163 100644 +--- a/ras-events.c ++++ b/ras-events.c +@@ -350,7 +350,7 @@ static void parse_ras_data(struct pthread_data *pdata, struct kbuffer *kbuf, + + static int get_num_cpus(struct ras_events *ras) + { +- return sysconf(_SC_NPROCESSORS_CONF); ++ return sysconf(_SC_NPROCESSORS_ONLN); + #if 0 + char fname[MAX_PATH + 1]; + int num_cpus = 0; +-- +2.25.1 + diff --git a/0001-rasdaemon-ras-mc-ctl-Modify-check-for-HiSilicon-KunP.patch b/0001-rasdaemon-ras-mc-ctl-Modify-check-for-HiSilicon-KunP.patch new file mode 100644 index 0000000..78c5796 --- /dev/null +++ b/0001-rasdaemon-ras-mc-ctl-Modify-check-for-HiSilicon-KunP.patch @@ -0,0 +1,118 @@ +From cfabd93876e76cc1eb6231b2f4140a841d3ecbae Mon Sep 17 00:00:00 2001 +From: Shiju Jose +Date: Thu, 24 Aug 2023 13:07:17 +0100 +Subject: [PATCH] rasdaemon: ras-mc-ctl: Modify check for HiSilicon KunPeng9xx + error fields + +Modify check for valid HiSilicon KunPeng9xx error fields. +Fixes an error data is not printed when it's value is 0. + +Signed-off-by: Shiju Jose +Signed-off-by: Mauro Carvalho Chehab +--- + util/ras-mc-ctl.in | 72 +++++++++++++++++++++++----------------------- + 1 file changed, 36 insertions(+), 36 deletions(-) + +diff --git a/util/ras-mc-ctl.in b/util/ras-mc-ctl.in +index 5d8b46c..fb35afe 100755 +--- a/util/ras-mc-ctl.in ++++ b/util/ras-mc-ctl.in +@@ -1705,13 +1705,13 @@ sub vendor_errors + if ($module eq 0 || ($module_id && ($module eq $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 .= "soc_id=$soc_id, " if (defined $soc_id && length $soc_id); ++ $out .= "socket_id=$socket_id, " if (defined $socket_id && length $socket_id); ++ $out .= "nimbus_id=$nimbus_id, " if (defined $nimbus_id && length $nimbus_id); ++ $out .= "module_id=$module_id, " if (defined $module_id && length $module_id); ++ $out .= "sub_module_id=$sub_module_id, " if (defined $sub_module_id && length $sub_module_id); ++ $out .= "err_severity=$err_severity, " if (defined $err_severity && length $err_severity); ++ $out .= "Error Registers: $regs " if (defined $regs && length $regs); + $out .= "\n\n"; + } +@@ -1730,13 +1730,13 @@ sub vendor_errors + if ($module eq 0 || ($module_id && ($module eq $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 .= "soc_id=$soc_id, " if (defined $soc_id && length $soc_id); ++ $out .= "socket_id=$socket_id, " if (defined $socket_id && length $socket_id); ++ $out .= "nimbus_id=$nimbus_id, " if (defined $nimbus_id && length $nimbus_id); ++ $out .= "module_id=$module_id, " if (defined $module_id && length $module_id); ++ $out .= "sub_module_id=$sub_module_id, " if (defined $sub_module_id && length $sub_module_id); ++ $out .= "err_severity=$err_severity, " if (defined $err_severity && length $err_severity); ++ $out .= "Error Registers: $regs " if (defined $regs && length $regs); + $out .= "\n\n"; + } +@@ -1755,15 +1755,15 @@ sub vendor_errors + if ($module eq 0 || ($sub_module_id && ($module eq $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 .= "soc_id=$soc_id, " if (defined $soc_id && length $soc_id); ++ $out .= "socket_id=$socket_id, " if (defined $socket_id && length $socket_id); ++ $out .= "nimbus_id=$nimbus_id, " if (defined $nimbus_id && length $nimbus_id); ++ $out .= "sub_module_id=$sub_module_id, " if (defined $sub_module_id && length $sub_module_id); ++ $out .= "core_id=$core_id, " if (defined $core_id && length $core_id); ++ $out .= "port_id=$port_id, " if (defined $port_id && length $port_id); ++ $out .= "err_severity=$err_severity, " if (defined $err_severity && length $err_severity); ++ $out .= "err_type=$err_type, " if (defined $err_type && length $err_type); ++ $out .= "Error Registers: $regs " if (defined $regs && length $regs); + $out .= "\n\n"; + } +@@ -1782,19 +1782,19 @@ sub vendor_errors + if ($module eq 0 || ($module_id && ($module eq $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 .= "soc_id=$soc_id, " if (defined $soc_id && length $soc_id); ++ $out .= "socket_id=$socket_id, " if (defined $socket_id && length $socket_id); ++ $out .= "totem_id=$totem_id, " if (defined $totem_id && length $totem_id); ++ $out .= "nimbus_id=$nimbus_id, " if (defined $nimbus_id && length $nimbus_id); ++ $out .= "sub_system_id=$sub_system_id, " if (defined $sub_system_id && length $sub_system_id); ++ $out .= "module_id=$module_id, " if (defined $module_id && length $module_id); ++ $out .= "sub_module_id=$sub_module_id, " if (defined $sub_module_id && length $sub_module_id); ++ $out .= "core_id=$core_id, " if (defined $core_id && length $core_id ); ++ $out .= "port_id=$port_id, " if (defined $port_id && length $port_id); ++ $out .= "err_type=$err_type, " if (defined $err_type && length $err_type); ++ $out .= "pcie_info=$pcie_info, " if (defined $pcie_info && length $pcie_info); ++ $out .= "err_severity=$err_severity, " if (defined $err_severity && length $err_severity); ++ $out .= "Error Registers: $regs" if (defined $regs && length $regs); + $out .= "\n\n"; + } +-- +2.27.0 + diff --git a/rasdaemon.spec b/rasdaemon.spec index 167a435..aa82832 100644 --- a/rasdaemon.spec +++ b/rasdaemon.spec @@ -1,6 +1,6 @@ Name: rasdaemon Version: 0.6.7 -Release: 10 +Release: 11 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 @@ -36,6 +36,8 @@ Patch14: 0004-rasdaemon-ras-mc-ctl-Add-printing-usage-if-necessary.patch Patch15: 0005-rasdaemon-ras-mc-ctl-Add-support-to-display-the-HiSi.patch Patch16: 0006-rasdaemon-ras-mc-ctl-Relocate-reading-and-display-Ku.patch Patch17: backport-traceevent-Add-proper-KBUFFER_TYPE_TIME_STAMP-handling.patch +Patch18: 0001-rasdaemon-ras-mc-ctl-Modify-check-for-HiSilicon-KunP.patch +Patch19: 0001-Check-CPUs-online-not-configured.patch Patch6000: backport-rasdaemon-ras-mc-ctl-Fix-script-to-parse-dimm-sizes.patch Patch6001: backport-rasdaemon-Fix-for-a-memory-out-of-bounds-issue-and-o.patch @@ -94,6 +96,12 @@ fi /usr/bin/systemctl disable rasdaemon.service >/dev/null 2>&1 || : %changelog +* Mon Dec 18 2023 caixiaomeng - 0.6.7-11 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:backport patches from upstream + * Fri Dec 01 2023 renhongxun - 0.6.7-10 - Type:bugfix - ID:NA -- Gitee