Skip to contentSkip to conversation

rasdaemon: Add support for memory_failure events and vendor errors

PATCH Applied Shiju Jose 2 participants 10 messages Mar 8, 2021 – May 26, 2021

Subsystems (2)
lore
Share & tools
lore

Shiju Jose

author
#0 lore raw

v3 cover rasdaemon: Add support for memory_failure events and vendor errors

1. Add support for the memory_failure trace event in the rasdaemon.
2. Add improvements & support for the vendor specific errors into the util/ras-mc-ctl.in script.

Changes:
v2 -> v3
Re-based and removed fix patch for the ras-mc-ctl exception as another fix patch merged recently.

v1 -> v2
1. Fix the feedback by Mauro for the fix patch for the exception in the ras-mc-ctl.in.
2. Rebased and grouped the previous v1 rasdaemon patches posted.

Shiju Jose (7):
rasdaemon: add support for memory_failure events
rasdaemon: ras-mc-ctl: Modify ARM processor error summary log
rasdaemon: ras-mc-ctl: Add memory failure events
rasdaemon: ras-mc-ctl: Add support for the vendor-specific errors
rasdaemon: ras-mc-ctl: Add support for HiSilicon Kunpeng920 errors
rasdaemon: ras-mc-ctl: Add support for HiSilicon Kunpeng9xx common
errors
rasdaemon: Modify confiure.ac for Hisilicon Kunpeng errors

 .travis.yml                  |   2 +-
 Makefile.am                  |   7 +-
 configure.ac                 |  13 +-
 ras-events.c                 |  15 ++
 ras-events.h                 |   1 +
 ras-memory-failure-handler.c | 179 +++++++++++++++++++++
 ras-memory-failure-handler.h |  25 +++
 ras-record.c                 |  70 ++++++++
 ras-record.h                 |  13 ++
 ras-report.c                 |  68 ++++++++
 ras-report.h                 |   2 +
 util/ras-mc-ctl.in           | 303 ++++++++++++++++++++++++++++++++++-
 12 files changed, 688 insertions(+), 10 deletions(-)
 create mode 100644 ras-memory-failure-handler.c
 create mode 100644 ras-memory-failure-handler.h
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH v3 1/7 rasdaemon: add support for memory_failure events

Add support to log the memory_failure kernel trace events.

Example rasdaemon log and SQLite DB output for the memory_failure event,
=================================================
rasdaemon: memory_failure_event store: 0x126ce8f8
rasdaemon: register inserted at db
<...>-785 [000] 0.000024: memory_failure_event: 2020-10-02 13:27:13 -0400 pfn=0x204000000 page_type=free buddy page action_result=Delayed

CREATE TABLE memory_failure_event (id INTEGER PRIMARY KEY, timestamp TEXT, pfn TEXT, page_type TEXT, action_result TEXT); INSERT INTO memory_failure_event VALUES(1,'2020-10-02 13:27:13 -0400','0x204000000','free buddy page','Delayed');
==================================================

---
 .travis.yml                  |   2 +-
 Makefile.am                  |   7 +-
 configure.ac                 |  11 +++
 ras-events.c                 |  15 +++
 ras-events.h                 |   1 +
 ras-memory-failure-handler.c | 179 +++++++++++++++++++++++++++++++++++
 ras-memory-failure-handler.h |  25 +++++
 ras-record.c                 |  70 ++++++++++++++
 ras-record.h                 |  13 +++
 ras-report.c                 |  68 +++++++++++++
 ras-report.h                 |   2 +
 11 files changed, 390 insertions(+), 3 deletions(-)
 create mode 100644 ras-memory-failure-handler.c
 create mode 100644 ras-memory-failure-handler.h
.travis.yml +1 -1
index 41d716d..7855b8e 100644
@@ -26,7 +26,7 @@ before_install:
 - sudo apt-get install -y sqlite3
 install:
 - autoreconf -vfi
-- ./configure --enable-sqlite3 --enable-aer --enable-non-standard --enable-arm --enable-mce --enable-extlog --enable-devlink --enable-diskerror --enable-abrt-report --enable-hisi-ns-decode --enable-memory-ce-pfa
+- ./configure --enable-sqlite3 --enable-aer --enable-non-standard --enable-arm --enable-mce --enable-extlog --enable-devlink --enable-diskerror --enable-memory-failure --enable-abrt-report --enable-hisi-ns-decode --enable-memory-ce-pfa
 
 script:
 - make && sudo make install
Makefile.am +5 -2
index de01098..7c1c027 100644
@@ -48,6 +48,9 @@ endif
 if WITH_DISKERROR
    rasdaemon_SOURCES += ras-diskerror-handler.c
 endif
+if WITH_MEMORY_FAILURE
+   rasdaemon_SOURCES += ras-memory-failure-handler.c
+endif
 if WITH_ABRT_REPORT
    rasdaemon_SOURCES += ras-report.c
 endif
@@ -62,8 +65,8 @@ rasdaemon_LDADD = -lpthread $(SQLITE3_LIBS) libtrace/libtrace.a
 include_HEADERS = config.h  ras-events.h  ras-logger.h  ras-mc-handler.h \
 		  ras-aer-handler.h ras-mce-handler.h ras-record.h bitfield.h ras-report.h \
 		  ras-extlog-handler.h ras-arm-handler.h ras-non-standard-handler.h \
-		  ras-devlink-handler.h ras-diskerror-handler.h rbtree.h ras-page-isolation.h \
-		  non-standard-hisilicon.h
+		  ras-devlink-handler.h ras-diskerror-handler.h ras-memory-failure-handler.h \
+		  rbtree.h ras-page-isolation.h non-standard-hisilicon.h
 
 # This rule can't be called with more than one Makefile job (like make -j8)
 # I can't figure out a way to fix that
configure.ac +11 -0
index e276c84..a6251d4 100644
@@ -111,6 +111,16 @@ AS_IF([test "x$enable_diskerror" = "xyes" || test "x$enable_all" == "xyes"], [
 AM_CONDITIONAL([WITH_DISKERROR], [test x$enable_diskerror = xyes || test x$enable_all == xyes])
 AM_COND_IF([WITH_DISKERROR], [USE_DISKERROR="yes"], [USE_DISKERROR="no"])
 
+AC_ARG_ENABLE([memory_failure],
+    AS_HELP_STRING([--enable-memory-failure], [enable memory failure events (currently experimental)]))
+
+AS_IF([test "x$enable_memory_failure" = "xyes" || test "x$enable_all" == "xyes"], [
+  AC_DEFINE(HAVE_MEMORY_FAILURE,1,"have memory failure events collect")
+  AC_SUBST([WITH_MEMORY_FAILURE])
+])
+AM_CONDITIONAL([WITH_MEMORY_FAILURE], [test x$enable_memory_failure = xyes || test x$enable_all == xyes])
+AM_COND_IF([WITH_MEMORY_FAILURE], [USE_MEMORY_FAILURE="yes"], [USE_MEMORY_FAILURE="no"])
+
 AC_ARG_ENABLE([abrt_report],
     AS_HELP_STRING([--enable-abrt-report], [enable report event to ABRT (currently experimental)]))
 
@@ -178,5 +188,6 @@ compile time options summary
     ARM events          : $USE_ARM
     DEVLINK             : $USE_DEVLINK
     Disk I/O errors     : $USE_DISKERROR
+    Memory Failure      : $USE_MEMORY_FAILURE
     Memory CE PFA       : $USE_MEMORY_CE_PFA
 EOF
ras-events.c +15 -0
index 4509f56..fe4bd26 100644
@@ -37,6 +37,7 @@
 #include "ras-extlog-handler.h"
 #include "ras-devlink-handler.h"
 #include "ras-diskerror-handler.h"
+#include "ras-memory-failure-handler.h"
 #include "ras-record.h"
 #include "ras-logger.h"
 #include "ras-page-isolation.h"
@@ -231,6 +232,10 @@ int toggle_ras_mc_event(int enable)
 	rc |= __toggle_ras_mc_event(ras, "block", "block_rq_complete", enable);
 #endif
 
+#ifdef HAVE_MEMORY_FAILURE
+	rc |= __toggle_ras_mc_event(ras, "ras", "memory_failure_event", enable);
+#endif
+
 free_ras:
 	free(ras);
 	return rc;
@@ -909,6 +914,16 @@ int handle_ras_events(int record_events)
 	}
 #endif
 
+#ifdef HAVE_MEMORY_FAILURE
+	rc = add_event_handler(ras, pevent, page_size, "ras", "memory_failure_event",
+			       ras_memory_failure_event_handler, NULL, MF_EVENT);
+	if (!rc)
+		num_events++;
+	else
+		log(ALL, LOG_ERR, "Can't get traces from %s:%s\n",
+		    "ras", "memory_failure_event");
+#endif
+
 	if (!num_events) {
 		log(ALL, LOG_INFO,
 		    "Failed to trace all supported RAS events. Aborting.\n");
ras-events.h +1 -0
index f028741..dfd690c 100644
@@ -38,6 +38,7 @@ enum {
 	EXTLOG_EVENT,
 	DEVLINK_EVENT,
 	DISKERROR_EVENT,
+	MF_EVENT,
 	NR_EVENTS
 };
 
ras-memory-failure-handler.c new file +179 -0

179 lines not on this page · raw message

ras-memory-failure-handler.h new file +25 -0
new file mode 100644
index 0000000..b9e9971
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+*/
+
+#ifndef __RAS_MEMORY_FAILURE_HANDLER_H
+#define __RAS_MEMORY_FAILURE_HANDLER_H
+
+#include "ras-events.h"
+#include "libtrace/event-parse.h"
+
+int ras_memory_failure_event_handler(struct trace_seq *s,
+				     struct pevent_record *record,
+				     struct event_format *event, void *context);
+
+#endif
ras-record.c +70 -0

88 lines not on this page · raw message

ras-record.h +13 -0
index cc217a9..4bbeb0c 100644
@@ -98,6 +98,13 @@ struct diskerror_event {
 	const char *cmd;
 };
 
+struct ras_mf_event {
+	char timestamp[64];
+	char pfn[30];
+	const char *page_type;
+	const char *action_result;
+};
+
 struct ras_mc_event;
 struct ras_aer_event;
 struct ras_extlog_event;
@@ -106,6 +113,7 @@ struct ras_arm_event;
 struct mce_event;
 struct devlink_event;
 struct diskerror_event;
+struct ras_mf_event;
 
 #ifdef HAVE_SQLITE3
 
@@ -135,6 +143,9 @@ struct sqlite3_priv {
 #ifdef HAVE_DISKERROR
 	sqlite3_stmt	*stmt_diskerror_event;
 #endif
+#ifdef HAVE_MEMORY_FAILURE
+	sqlite3_stmt	*stmt_mf_event;
+#endif
 };
 
 struct db_fields {
@@ -161,6 +172,7 @@ int ras_store_non_standard_record(struct ras_events *ras, struct ras_non_standar
 int ras_store_arm_record(struct ras_events *ras, struct ras_arm_event *ev);
 int ras_store_devlink_event(struct ras_events *ras, struct devlink_event *ev);
 int ras_store_diskerror_event(struct ras_events *ras, struct diskerror_event *ev);
+int ras_store_mf_event(struct ras_events *ras, struct ras_mf_event *ev);
 
 #else
 static inline int ras_mc_event_opendb(unsigned cpu, struct ras_events *ras) { return 0; };
@@ -173,6 +185,7 @@ static inline int ras_store_non_standard_record(struct ras_events *ras, struct r
 static inline int ras_store_arm_record(struct ras_events *ras, struct ras_arm_event *ev) { return 0; };
 static inline int ras_store_devlink_event(struct ras_events *ras, struct devlink_event *ev) { return 0; };
 static inline int ras_store_diskerror_event(struct ras_events *ras, struct diskerror_event *ev) { return 0; };
+static inline int ras_store_mf_event(struct ras_events *ras, struct ras_mf_event *ev) { return 0; };
 
 #endif
 
ras-report.c +68 -0

83 lines not on this page · raw message

ras-report.h +2 -0
index 1d911de..e605eb1 100644
@@ -38,6 +38,7 @@ int ras_report_non_standard_event(struct ras_events *ras, struct ras_non_standar
 int ras_report_arm_event(struct ras_events *ras, struct ras_arm_event *ev);
 int ras_report_devlink_event(struct ras_events *ras, struct devlink_event *ev);
 int ras_report_diskerror_event(struct ras_events *ras, struct diskerror_event *ev);
+int ras_report_mf_event(struct ras_events *ras, struct ras_mf_event *ev);
 
 #else
 
@@ -48,6 +49,7 @@ static inline int ras_report_non_standard_event(struct ras_events *ras, struct r
 static inline int ras_report_arm_event(struct ras_events *ras, struct ras_arm_event *ev) { return 0; };
 static inline int ras_report_devlink_event(struct ras_events *ras, struct devlink_event *ev) { return 0; };
 static inline int ras_report_diskerror_event(struct ras_events *ras, struct diskerror_event *ev) { return 0; };
+static inline int ras_report_mf_event(struct ras_events *ras, struct ras_mf_event *ev) { return 0; };
 
 #endif
 
Signature · 1 line
2.17.1
author
#2 lore raw

PATCH v3 2/7 rasdaemon: ras-mc-ctl: Modify ARM processor error summary log

In reply to Shiju Jose

Add CPU's mpidr information to the ARM processor error summary log.

---
 util/ras-mc-ctl.in | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
util/ras-mc-ctl.in +4 -4
index 1fbeb63..21e9d29 100755
@@ -1137,7 +1137,7 @@ sub summary
     my ($err_type, $label, $mc, $top, $mid, $low, $count, $msg);
     my ($etype, $severity, $etype_string, $severity_string);
     my ($dev_name, $dev);
-    my ($affinity, $mpidr);
+    my ($mpidr);
 
     my $dbh = DBI->connect("dbi:SQLite:dbname=$dbname", "", "", {});
 
@@ -1177,13 +1177,13 @@ sub summary
 
     # ARM processor arm_event errors
     if ($has_arm == 1) {
-        $query = "select affinity, mpidr, count(*) from arm_event group by affinity, mpidr";
+        $query = "select mpidr, count(*) from arm_event group by mpidr";
         $query_handle = $dbh->prepare($query);
         $query_handle->execute();
-        $query_handle->bind_columns(\($affinity, $mpidr, $count));
+        $query_handle->bind_columns(\($mpidr, $count));
         $out = "";
         while($query_handle->fetch()) {
-            $out .= "\t$count errors\n";
+            $out .= sprintf "\tCPU(mpidr=0x%x) has %d errors\n", $mpidr, $count;
         }
         if ($out ne "") {
             print "ARM processor events summary:\n$out\n";
Signature · 1 line
2.17.1
author
#3 lore raw

PATCH v3 3/7 rasdaemon: ras-mc-ctl: Add memory failure events

In reply to Shiju Jose

Add supporting memory failure errors (memory_failure_event) to the ras-mc-ctl tool.

Sample Log,
ras-mc-ctl --summary
...
Memory failure events summary:
Delayed errors: 4
Failed errors: 1
...

ras-mc-ctl --errors
...
Memory failure events:
1 2020-10-28 23:20:41 -0800 error: pfn=0x204000000, page_type=free buddy page, action_result=Delayed 2 2020-10-28 23:31:38 -0800 error: pfn=0x204000000, page_type=free buddy page, action_result=Delayed 3 2020-10-28 23:54:54 -0800 error: pfn=0x205000000, page_type=free buddy page, action_result=Delayed 4 2020-10-29 00:12:25 -0800 error: pfn=0x204000000, page_type=free buddy page, action_result=Delayed 5 2020-10-29 00:26:36 -0800 error: pfn=0x204000000, page_type=free buddy page, action_result=Failed

---
 util/ras-mc-ctl.in | 42 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 41 insertions(+), 1 deletion(-)
util/ras-mc-ctl.in +41 -1
index 21e9d29..44847d2 100755
@@ -46,6 +46,7 @@ my $has_arm = 0;
 my $has_devlink = 0;
 my $has_disk_errors = 0;
 my $has_extlog = 0;
+my $has_mem_failure = 0;
 my $has_mce = 0;
 
 @WITH_AER_TRUE@$has_aer = 1;
@@ -53,6 +54,7 @@ my $has_mce = 0;
 @WITH_DEVLINK_TRUE@$has_devlink = 1;
 @WITH_DISKERROR_TRUE@$has_disk_errors = 1;
 @WITH_EXTLOG_TRUE@$has_extlog = 1;
+@WITH_MEMORY_FAILURE_TRUE@$has_mem_failure = 1;
 @WITH_MCE_TRUE@$has_mce = 1;
 
 my %conf        = ();
@@ -1134,7 +1136,7 @@ sub summary
 {
     require DBI;
     my ($query, $query_handle, $out);
-    my ($err_type, $label, $mc, $top, $mid, $low, $count, $msg);
+    my ($err_type, $label, $mc, $top, $mid, $low, $count, $msg, $action_result);
     my ($etype, $severity, $etype_string, $severity_string);
     my ($dev_name, $dev);
     my ($mpidr);
@@ -1249,6 +1251,24 @@ sub summary
         $query_handle->finish;
     }
 
+    # Memory failure errors
+    if ($has_mem_failure == 1) {
+        $query = "select action_result, count(*) from memory_failure_event group by action_result";
+        $query_handle = $dbh->prepare($query);
+        $query_handle->execute();
+        $query_handle->bind_columns(\($action_result, $count));
+        $out = "";
+        while($query_handle->fetch()) {
+            $out .= "\t$action_result errors: $count\n";
+        }
+        if ($out ne "") {
+            print "Memory failure events summary:\n$out\n";
+        } else {
+            print "No Memory failure errors.\n\n";
+        }
+        $query_handle->finish;
+    }
+
     # MCE mce_record errors
     if ($has_mce == 1) {
         $query = "select error_msg, count(*) from mce_record group by error_msg";
@@ -1279,6 +1299,7 @@ sub errors
     my ($bus_name, $dev_name, $driver_name, $reporter_name);
     my ($dev, $sector, $nr_sector, $error, $rwbs, $cmd);
     my ($error_count, $affinity, $mpidr, $r_state, $psci_state);
+    my ($pfn, $page_type, $action_result);
 
     my $dbh = DBI->connect("dbi:SQLite:dbname=$dbname", "", "", {});
 
@@ -1420,6 +1441,25 @@ sub errors
         $query_handle->finish;
     }
 
+    # Memory failure errors
+    if ($has_mem_failure == 1) {
+        $query = "select id, timestamp, pfn, page_type, action_result from memory_failure_event order by id";
+        $query_handle = $dbh->prepare($query);
+        $query_handle->execute();
+        $query_handle->bind_columns(\($id, $timestamp, $pfn, $page_type, $action_result));
+        $out = "";
+        while($query_handle->fetch()) {
+            $out .= "$id $timestamp error: ";
+            $out .= "pfn=$pfn, page_type=$page_type, action_result=$action_result\n";
+        }
+        if ($out ne "") {
+            print "Memory failure events:\n$out\n";
+        } else {
+            print "No Memory failure errors.\n\n";
+        }
+        $query_handle->finish;
+    }
+
     # MCE mce_record errors
     if ($has_mce == 1) {
         $query = "select id, timestamp, mcgcap, mcgstatus, status, addr, misc, ip, tsc, walltime, cpu, cpuid, apicid, socketid, cs, bank, cpuvendor, bank_name, error_msg, mcgstatus_msg, mcistatus_msg, user_action, mc_location from mce_record order by id";
Signature · 1 line
2.17.1
author
#4 lore raw

PATCH v3 4/7 rasdaemon: ras-mc-ctl: Add support for the vendor-specific errors

In reply to Shiju Jose

Add commands to support logging the vendor-specific error info in the ras-mc-ctl.

---
 util/ras-mc-ctl.in | 64 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 63 insertions(+), 1 deletion(-)
util/ras-mc-ctl.in +63 -1
index 44847d2..f282eff 100755
@@ -95,6 +95,9 @@ Usage: $prog [OPTIONS...]
  --summary          Presents a summary of the logged errors.
  --errors           Shows the errors stored at the error database.
  --error-count      Shows the corrected and uncorrected error counts using sysfs.
+ --vendor-errors-summary <platform-id>    Presents a summary of the vendor-specific logged errors.
+ --vendor-errors         <platform-id>    Shows the vendor-specific errors stored in the error database.
+ --vendor-platforms Shows the supported platforms with platform-ids for the vendor-specific errors.
  --help             This help message.
 EOF
 
@@ -142,6 +145,18 @@ if ($conf{opt}{errors}) {
     errors ();
 }
 
+if ($conf{opt}{vendor_errors_summary}) {
+    vendor_errors_summary ();
+}
+
+if ($conf{opt}{vendor_errors}) {
+    vendor_errors ();
+}
+
+if ($conf{opt}{vendor_platforms}) {
+    vendor_platforms ();
+}
+
 exit (0);
 
 sub parse_cmdline
@@ -157,6 +172,9 @@ sub parse_cmdline
     $conf{opt}{summary} = 0;
     $conf{opt}{errors} = 0;
     $conf{opt}{error_count} = 0;
+    $conf{opt}{vendor_errors_summary} = 0;
+    $conf{opt}{vendor_errors} = 0;
+    $conf{opt}{vendor_platforms} = 0;
 
     my $rref = \$conf{opt}{report};
     my $mref = \$conf{opt}{mainboard};
@@ -174,7 +192,10 @@ sub parse_cmdline
                          "layout" =>          \$conf{opt}{display_memory_layout},
                          "summary" =>         \$conf{opt}{summary},
                          "errors" =>          \$conf{opt}{errors},
-                         "error-count" =>     \$conf{opt}{error_count}
+                         "error-count" =>     \$conf{opt}{error_count},
+                         "vendor-errors-summary" =>    \$conf{opt}{vendor_errors_summary},
+                         "vendor-errors" =>   \$conf{opt}{vendor_errors},
+                         "vendor-platforms" =>    \$conf{opt}{vendor_platforms},
             );
 
     usage(1) if !$rc;
@@ -1503,6 +1524,47 @@ sub errors
     undef($dbh);
 }
 
+sub vendor_errors_summary
+{
+    require DBI;
+    my ($num_args, $platform_id);
+
+    $num_args = $#ARGV + 1;
+    $platform_id = 0;
+    if ($num_args ne 0) {
+        $platform_id = $ARGV[0];
+    } else {
+        return;
+    }
+
+    my $dbh = DBI->connect("dbi:SQLite:dbname=$dbname", "", "", {});
+
+    undef($dbh);
+}
+
+sub vendor_errors
+{
+    require DBI;
+    my ($num_args, $platform_id);
+
+    $num_args = $#ARGV + 1;
+    $platform_id = 0;
+    if ($num_args ne 0) {
+        $platform_id = $ARGV[0];
+    } else {
+        return;
+    }
+
+    my $dbh = DBI->connect("dbi:SQLite:dbname=$dbname", "", "", {});
+
+    undef($dbh);
+}
+
+sub vendor_platforms
+{
+        print "\nSupported platforms for the vendor-specific errors:\n";
+}
+
 sub log_msg   { print STDERR "$prog: ", @_ unless $conf{opt}{quiet}; }
 sub log_error { log_msg ("Error: @_"); }
 
Signature · 1 line
2.17.1
author
#5 lore raw

PATCH v3 5/7 rasdaemon: ras-mc-ctl: Add support for HiSilicon Kunpeng920 errors

In reply to Shiju Jose

Add support for the HiSilicon Kunpeng920 errors. Supported error formats: OEM type 1, OEM typ2 and PCIe controller error formats.

---
 util/ras-mc-ctl.in | 149 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 149 insertions(+)
util/ras-mc-ctl.in +149 -0
index f282eff..407bf3c 100755
@@ -1524,10 +1524,17 @@ sub errors
     undef($dbh);
 }
 
+# Definitions of the vendor platform IDs.
+use constant {
+    HISILICON_KUNPENG_920 => "Kunpeng920",
+};
+
 sub vendor_errors_summary
 {
     require DBI;
     my ($num_args, $platform_id);
+    my ($query, $query_handle, $count, $out);
+    my ($module_id, $sub_module_id, $err_severity, $err_sev);
 
     $num_args = $#ARGV + 1;
     $platform_id = 0;
@@ -1539,6 +1546,69 @@ sub vendor_errors_summary
 
     my $dbh = DBI->connect("dbi:SQLite:dbname=$dbname", "", "", {});
 
+    # HiSilicon Kunpeng920 errors
+    if ($platform_id eq HISILICON_KUNPENG_920) {
+        $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";
+        }
+        if ($out ne "") {
+            print "HiSilicon Kunpeng920 OEM type1 error events summary:\n$out\n";
+        } else {
+            print "No HiSilicon Kunpeng920 OEM type1 errors.\n\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;
+            }
+            $out .= "\t$module_id: $count\n";
+        }
+        if ($out ne "") {
+            print "HiSilicon Kunpeng920 OEM type2 error events summary:\n$out\n";
+        } else {
+            print "No HiSilicon Kunpeng920 OEM type2 errors.\n\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;
+            }
+            $out .= "\t$sub_module_id: $count\n";
+        }
+        if ($out ne "") {
+            print "HiSilicon Kunpeng920 PCIe controller error events summary:\n$out\n";
+        } else {
+            print "No HiSilicon Kunpeng920 PCIe controller errors.\n\n";
+        }
+        $query_handle->finish;
+    }
+
     undef($dbh);
 }
 
@@ -1546,6 +1616,9 @@ sub vendor_errors
 {
     require DBI;
     my ($num_args, $platform_id);
+    my ($query, $query_handle, $id, $timestamp, $out);
+    my ($version, $soc_id, $socket_id, $nimbus_id, $core_id, $port_id);
+    my ($module_id, $sub_module_id, $err_severity, $err_type, $regs);
 
     $num_args = $#ARGV + 1;
     $platform_id = 0;
@@ -1557,12 +1630,88 @@ sub vendor_errors
 
     my $dbh = DBI->connect("dbi:SQLite:dbname=$dbname", "", "", {});
 
+    # HiSilicon Kunpeng920 errors
+    if ($platform_id eq HISILICON_KUNPENG_920) {
+        $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()) {
+            $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, \n" if ($err_severity);
+            $out .= "Error Registers: $regs\n\n" if ($regs);
+        }
+        if ($out ne "") {
+            print "HiSilicon Kunpeng920 OEM type1 error events:\n$out\n";
+        } else {
+            print "No HiSilicon Kunpeng920 OEM type1 errors.\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()) {
+            $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, \n" if ($err_severity);
+            $out .= "Error Registers: $regs\n\n" if ($regs);
+        }
+        if ($out ne "") {
+            print "HiSilicon Kunpeng920 OEM type2 error events:\n$out\n";
+        } else {
+            print "No HiSilicon Kunpeng920 OEM type2 errors.\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()) {
+            $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, \n" if ($err_type);
+            $out .= "Error Registers: $regs\n\n" if ($regs);
+        }
+        if ($out ne "") {
+            print "HiSilicon Kunpeng920 PCIe controller error events:\n$out\n";
+        } else {
+            print "No HiSilicon Kunpeng920 PCIe controller errors.\n";
+        }
+        $query_handle->finish;
+    }
+
     undef($dbh);
 }
 
 sub vendor_platforms
 {
         print "\nSupported platforms for the vendor-specific errors:\n";
+        print "\tHiSilicon Kunpeng920, platform-id=\"", HISILICON_KUNPENG_920, "\"\n";
+        print "\n";
 }
 
 sub log_msg   { print STDERR "$prog: ", @_ unless $conf{opt}{quiet}; }
Signature · 1 line
2.17.1
author
#6 lore raw

PATCH v3 6/7 rasdaemon: ras-mc-ctl: Add support for HiSilicon Kunpeng9xx common errors

In reply to Shiju Jose

Add support for the HiSilicon Kunpeng9xx platforms common errors.

---
 util/ras-mc-ctl.in | 44 ++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 42 insertions(+), 2 deletions(-)
util/ras-mc-ctl.in +42 -2
index 407bf3c..1e3aeb7 100755
@@ -1527,6 +1527,7 @@ sub errors
 # Definitions of the vendor platform IDs.
 use constant {
     HISILICON_KUNPENG_920 => "Kunpeng920",
+    HISILICON_KUNPENG_9XX => "Kunpeng9xx",
 };
 
 sub vendor_errors_summary
@@ -1534,7 +1535,7 @@ sub vendor_errors_summary
     require DBI;
     my ($num_args, $platform_id);
     my ($query, $query_handle, $count, $out);
-    my ($module_id, $sub_module_id, $err_severity, $err_sev);
+    my ($module_id, $sub_module_id, $err_severity, $err_sev, $err_info);
 
     $num_args = $#ARGV + 1;
     $platform_id = 0;
@@ -1609,6 +1610,24 @@ sub vendor_errors_summary
         $query_handle->finish;
     }
 
+    # HiSilicon Kunpeng9xx common errors
+    if ($platform_id eq HISILICON_KUNPENG_9XX) {
+        $query = "select err_info, count(*) from hisi_common_section";
+        $query_handle = $dbh->prepare($query);
+        $query_handle->execute();
+        $query_handle->bind_columns(\($err_info, $count));
+        $out = "";
+        while($query_handle->fetch()) {
+            $out .= "\terrors: $count\n";
+        }
+        if ($out ne "") {
+            print "HiSilicon Kunpeng9xx common error events summary:\n$out\n";
+        } else {
+            print "No HiSilicon Kunpeng9xx common errors.\n\n";
+        }
+        $query_handle->finish;
+    }
+
     undef($dbh);
 }
 
@@ -1618,7 +1637,7 @@ sub vendor_errors
     my ($num_args, $platform_id);
     my ($query, $query_handle, $id, $timestamp, $out);
     my ($version, $soc_id, $socket_id, $nimbus_id, $core_id, $port_id);
-    my ($module_id, $sub_module_id, $err_severity, $err_type, $regs);
+    my ($module_id, $sub_module_id, $err_severity, $err_type, $err_info, $regs);
 
     $num_args = $#ARGV + 1;
     $platform_id = 0;
@@ -1704,6 +1723,26 @@ sub vendor_errors
         $query_handle->finish;
     }
 
+    # HiSilicon Kunpeng9xx common errors
+    if ($platform_id eq HISILICON_KUNPENG_9XX) {
+        $query = "select id, timestamp, err_info, regs_dump from hisi_common_section order by id";
+        $query_handle = $dbh->prepare($query);
+        $query_handle->execute();
+        $query_handle->bind_columns(\($id, $timestamp, $err_info, $regs));
+        $out = "";
+        while($query_handle->fetch()) {
+            $out .= "$id. $timestamp ";
+            $out .= "Error Info:$err_info \n" if ($err_info);
+            $out .= "Error Registers: $regs\n\n" if ($regs);
+        }
+        if ($out ne "") {
+            print "HiSilicon Kunpeng9xx common error events:\n$out\n";
+        } else {
+            print "No HiSilicon Kunpeng9xx common errors.\n";
+        }
+        $query_handle->finish;
+    }
+
     undef($dbh);
 }
 
@@ -1711,6 +1750,7 @@ sub vendor_platforms
 {
         print "\nSupported platforms for the vendor-specific errors:\n";
         print "\tHiSilicon Kunpeng920, platform-id=\"", HISILICON_KUNPENG_920, "\"\n";
+        print "\tHiSilicon Kunpeng9xx, platform-id=\"", HISILICON_KUNPENG_9XX, "\"\n";
         print "\n";
 }
 
Signature · 1 line
2.17.1
author
#7 lore raw

PATCH v3 7/7 rasdaemon: Modify confiure.ac for Hisilicon Kunpeng errors

In reply to Shiju Jose

Modify HIP07 SAS HW errors : $USE_HISI_NS_DECODE to HISI Kunpeng errors : $USE_HISI_NS_DECODE.

---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure.ac +1 -1
index a6251d4..0b36f4f 100644
@@ -184,7 +184,7 @@ compile time options summary
     EXTLOG              : $USE_EXTLOG
     CPER non-standard   : $USE_NON_STANDARD
     ABRT report         : $USE_ABRT_REPORT
-    HIP07 SAS HW errors : $USE_HISI_NS_DECODE
+    HISI Kunpeng errors : $USE_HISI_NS_DECODE
     ARM events          : $USE_ARM
     DEVLINK             : $USE_DEVLINK
     Disk I/O errors     : $USE_DISKERROR
Signature · 1 line
2.17.1
author
#8 lore raw
In reply to Shiju Jose

Hi Mauro,

Ping...
Any comments on this series?

Thanks,
Shiju

Quoted 50 lines

-----Original Message-----
From: Shiju Jose
Sent: 08 March 2021 16:57
To: [email protected]; [email protected]
Cc: Linuxarm <[email protected]>; tanxiaofei <[email protected]>; Shiju Jose <[email protected]>
Subject: [PATCH v3 0/7] rasdaemon: Add support for memory_failure events and vendor errors

1. Add support for the memory_failure trace event in the rasdaemon.
2. Add improvements & support for the vendor specific errors into the util/ras-mc-ctl.in script.

Changes:
v2 -> v3
Re-based and removed fix patch for the ras-mc-ctl exception as another fix patch merged recently.

v1 -> v2
1. Fix the feedback by Mauro for the fix patch for the exception in the ras-mc-ctl.in.
2. Rebased and grouped the previous v1 rasdaemon patches posted.

Shiju Jose (7):
rasdaemon: add support for memory_failure events
rasdaemon: ras-mc-ctl: Modify ARM processor error summary log
rasdaemon: ras-mc-ctl: Add memory failure events
rasdaemon: ras-mc-ctl: Add support for the vendor-specific errors
rasdaemon: ras-mc-ctl: Add support for HiSilicon Kunpeng920 errors
rasdaemon: ras-mc-ctl: Add support for HiSilicon Kunpeng9xx common
errors
rasdaemon: Modify confiure.ac for Hisilicon Kunpeng errors

.travis.yml                  |   2 +-
Makefile.am                  |   7 +-
configure.ac                 |  13 +-
ras-events.c                 |  15 ++
ras-events.h                 |   1 +
ras-memory-failure-handler.c | 179 +++++++++++++++++++++  ras-memory-
failure-handler.h |  25 +++
ras-record.c                 |  70 ++++++++
ras-record.h                 |  13 ++
ras-report.c                 |  68 ++++++++
ras-report.h                 |   2 +
util/ras-mc-ctl.in           | 303 ++++++++++++++++++++++++++++++++++-
12 files changed, 688 insertions(+), 10 deletions(-)  create mode 100644 ras-

memory-failure-handler.c create mode 100644 ras-memory-failure-handler.h

--
2.17.1

#9 lore raw

Em Thu, 13 May 2021 08:55:02 +0000
Shiju Jose <[email protected]> escreveu:

Quoted 4 lines

Hi Mauro,

Ping...
Any comments on this series?

Applied, thanks!

Next time, it would be better to use github[1], as it is easier for me to track what's pending to review ;-)

[1] https://github.com/mchehab/rasdaemon

Regards,
Mauro

Quoted 55 lines

Thanks,
Shiju

Quoted 50 lines

-----Original Message-----
From: Shiju Jose
Sent: 08 March 2021 16:57
To: [email protected]; [email protected]
Cc: Linuxarm <[email protected]>; tanxiaofei <[email protected]>; Shiju Jose <[email protected]>
Subject: [PATCH v3 0/7] rasdaemon: Add support for memory_failure events and vendor errors

1. Add support for the memory_failure trace event in the rasdaemon.
2. Add improvements & support for the vendor specific errors into the util/ras-mc-ctl.in script.

Changes:
v2 -> v3
Re-based and removed fix patch for the ras-mc-ctl exception as another fix patch merged recently.

v1 -> v2
1. Fix the feedback by Mauro for the fix patch for the exception in the ras-mc-ctl.in.
2. Rebased and grouped the previous v1 rasdaemon patches posted.

Shiju Jose (7):
rasdaemon: add support for memory_failure events
rasdaemon: ras-mc-ctl: Modify ARM processor error summary log
rasdaemon: ras-mc-ctl: Add memory failure events
rasdaemon: ras-mc-ctl: Add support for the vendor-specific errors
rasdaemon: ras-mc-ctl: Add support for HiSilicon Kunpeng920 errors
rasdaemon: ras-mc-ctl: Add support for HiSilicon Kunpeng9xx common
errors
rasdaemon: Modify confiure.ac for Hisilicon Kunpeng errors

.travis.yml                  |   2 +-
Makefile.am                  |   7 +-
configure.ac                 |  13 +-
ras-events.c                 |  15 ++
ras-events.h                 |   1 +
ras-memory-failure-handler.c | 179 +++++++++++++++++++++  ras-memory-
failure-handler.h |  25 +++
ras-record.c                 |  70 ++++++++
ras-record.h                 |  13 ++
ras-report.c                 |  68 ++++++++
ras-report.h                 |   2 +
util/ras-mc-ctl.in           | 303 ++++++++++++++++++++++++++++++++++-
12 files changed, 688 insertions(+), 10 deletions(-)  create mode 100644 ras-

memory-failure-handler.c create mode 100644 ras-memory-failure-handler.h

--
2.17.1

Thanks,
Mauro