Skip to contentSkip to conversation

rasdaemon: add support for ARM events

PATCH New Tyler Baicar 1 participant 1 message Jun 12, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 2/2 rasdaemon: add support for ARM events

Add support to handle the ARM kernel trace events which cover RAS ARM processor errors.

---
 Makefile.am       |  3 ++
 configure.ac      |  9 ++++++
 ras-arm-handler.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 ras-arm-handler.h | 24 +++++++++++++++
 ras-events.c      | 15 ++++++++++
 ras-record.c      | 52 ++++++++++++++++++++++++++++++++
 ras-record.h      | 16 ++++++++++
 ras-report.c      | 75 ++++++++++++++++++++++++++++++++++++++++++++++
 ras-report.h      |  5 +++-
 9 files changed, 288 insertions(+), 1 deletion(-)
 create mode 100644 ras-arm-handler.c
 create mode 100644 ras-arm-handler.h
Makefile.am +3 -0
index 1bc25e4..83868e2 100644
@@ -27,6 +27,9 @@ endif
 if WITH_NON_STANDARD
    rasdaemon_SOURCES += ras-non-standard-handler.c
 endif
+if WITH_ARM
+   rasdaemon_SOURCES += ras-arm-handler.c
+endif
 if WITH_MCE
    rasdaemon_SOURCES += ras-mce-handler.c mce-intel.c mce-amd-k8.c \
 			mce-intel-p4-p6.c mce-intel-nehalem.c \
configure.ac +9 -0
index 2adb798..648a3ac 100644
@@ -53,6 +53,15 @@ AS_IF([test "x$enable_non_standard" = "xyes"], [
 ])
 AM_CONDITIONAL([WITH_NON_STANDARD], [test x$enable_non_standard = xyes])
 
+AC_ARG_ENABLE([arm],
+    AS_HELP_STRING([--enable-arm], [enable ARM events (currently experimental)]))
+
+AS_IF([test "x$enable_arm" = "xyes"], [
+  AC_DEFINE(HAVE_ARM,1,"have ARM events collect")
+  AC_SUBST([WITH_ARM])
+])
+AM_CONDITIONAL([WITH_ARM], [test x$enable_arm = xyes])
+
 AC_ARG_ENABLE([mce],
     AS_HELP_STRING([--enable-mce], [enable MCE events (currently experimental)]))
 
ras-arm-handler.c new file +90 -0

90 lines not on this page · raw message

ras-arm-handler.h new file +24 -0
new file mode 100644
index 0000000..eae10ec
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2016, The Linux Foundation. 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 version 2 and
+ * only version 2 as published by the Free Software Foundation.
+
+ * 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_ARM_HANDLER_H
+#define __RAS_ARM_HANDLER_H
+
+#include "ras-events.h"
+#include "libtrace/event-parse.h"
+
+int ras_arm_event_handler(struct trace_seq *s,
+			 struct pevent_record *record,
+			 struct event_format *event, void *context);
+
+#endif
ras-events.c +15 -0
index 96aa6f1..812d712 100644
@@ -30,6 +30,7 @@
 #include "ras-mc-handler.h"
 #include "ras-aer-handler.h"
 #include "ras-non-standard-handler.h"
+#include "ras-arm-handler.h"
 #include "ras-mce-handler.h"
 #include "ras-extlog-handler.h"
 #include "ras-record.h"
@@ -213,6 +214,10 @@ int toggle_ras_mc_event(int enable)
 	rc |= __toggle_ras_mc_event(ras, "ras", "non_standard_event", enable);
 #endif
 
+#ifdef HAVE_ARM
+	rc |= __toggle_ras_mc_event(ras, "ras", "arm_event", enable);
+#endif
+
 free_ras:
 	free(ras);
 	return rc;
@@ -691,6 +696,16 @@ int handle_ras_events(int record_events)
                     "ras", "non_standard_event");
 #endif
 
+#ifdef HAVE_ARM
+        rc = add_event_handler(ras, pevent, page_size, "ras", "arm_event",
+                               ras_arm_event_handler);
+        if (!rc)
+                num_events++;
+        else
+                log(ALL, LOG_ERR, "Can't get traces from %s:%s\n",
+                    "ras", "arm_event");
+#endif
+
 	cpus = get_num_cpus(ras);
 
 #ifdef HAVE_MCE
ras-record.c +52 -0

58 lines not on this page · raw message

ras-record.h +16 -0
index 473ae40..12c2218 100644
@@ -65,10 +65,21 @@ struct ras_non_standard_event {
 	uint32_t length;
 };
 
+struct ras_arm_event {
+	char timestamp[64];
+	int32_t error_count;
+	int8_t affinity;
+	int64_t mpidr;
+	int64_t midr;
+	int32_t running_state;
+	int32_t psci_state;
+};
+
 struct ras_mc_event;
 struct ras_aer_event;
 struct ras_extlog_event;
 struct ras_non_standard_event;
+struct ras_arm_event;
 struct mce_event;
 
 #ifdef HAVE_SQLITE3
@@ -90,6 +101,9 @@ struct sqlite3_priv {
 #ifdef HAVE_NON_STANDARD
 	sqlite3_stmt	*stmt_non_standard_record;
 #endif
+#ifdef HAVE_ARM
+	sqlite3_stmt	*stmt_arm_record;
+#endif
 };
 
 int ras_mc_event_opendb(unsigned cpu, struct ras_events *ras);
@@ -98,6 +112,7 @@ int ras_store_aer_event(struct ras_events *ras, struct ras_aer_event *ev);
 int ras_store_mce_record(struct ras_events *ras, struct mce_event *ev);
 int ras_store_extlog_mem_record(struct ras_events *ras, struct ras_extlog_event *ev);
 int ras_store_non_standard_record(struct ras_events *ras, struct ras_non_standard_event *ev);
+int ras_store_arm_record(struct ras_events *ras, struct ras_arm_event *ev);
 
 #else
 static inline int ras_mc_event_opendb(unsigned cpu, struct ras_events *ras) { return 0; };
@@ -106,6 +121,7 @@ static inline int ras_store_aer_event(struct ras_events *ras, struct ras_aer_eve
 static inline int ras_store_mce_record(struct ras_events *ras, struct mce_event *ev) { return 0; };
 static inline int ras_store_extlog_mem_record(struct ras_events *ras, struct ras_extlog_event *ev) { return 0; };
 static inline int ras_store_non_standard_record(struct ras_events *ras, struct ras_non_standard_event *ev) { return 0; };
+static inline int ras_store_arm_record(struct ras_events *ras, struct ras_arm_event *ev) { return 0; };
 
 #endif
 
ras-report.c +75 -0

93 lines not on this page · raw message

ras-report.h +4 -1
index c2fcf42..6c466f5 100644
@@ -33,7 +33,8 @@ enum {
 	MC_EVENT,
 	MCE_EVENT,
 	AER_EVENT,
-	NON_STANDARD_EVENT
+	NON_STANDARD_EVENT,
+	ARM_EVENT
 };
 
 #ifdef HAVE_ABRT_REPORT
@@ -42,6 +43,7 @@ int ras_report_mc_event(struct ras_events *ras, struct ras_mc_event *ev);
 int ras_report_aer_event(struct ras_events *ras, struct ras_aer_event *ev);
 int ras_report_mce_event(struct ras_events *ras, struct mce_event *ev);
 int ras_report_non_standard_event(struct ras_events *ras, struct ras_non_standard_event *ev);
+int ras_report_arm_event(struct ras_events *ras, struct ras_arm_event *ev);
 
 #else
 
@@ -49,6 +51,7 @@ static inline int ras_report_mc_event(struct ras_events *ras, struct ras_mc_even
 static inline int ras_report_aer_event(struct ras_events *ras, struct ras_aer_event *ev) { return 0; };
 static inline int ras_report_mce_event(struct ras_events *ras, struct mce_event *ev) { return 0; };
 static inline int ras_report_non_standard_event(struct ras_events *ras, struct ras_non_standard_event *ev) { return 0; };
+static inline int ras_report_arm_event(struct ras_events *ras, struct ras_arm_event *ev) { return 0; };
 
 #endif