|
|
d9e469 |
From 5662e5376adcc45da43d7818c8ac1882883c18ac Mon Sep 17 00:00:00 2001
|
|
|
d9e469 |
From: Tyler Baicar <tbaicar@codeaurora.org>
|
|
|
d9e469 |
Date: Tue, 12 Sep 2017 14:58:25 -0600
|
|
|
d9e469 |
Subject: [PATCH 1/2] rasdaemon: add support for ARM events
|
|
|
d9e469 |
|
|
|
d9e469 |
Add support to handle the ARM kernel trace events
|
|
|
d9e469 |
which cover RAS ARM processor errors.
|
|
|
d9e469 |
|
|
|
d9e469 |
[V4]: fix arm_event_tab usage
|
|
|
d9e469 |
|
|
|
d9e469 |
Change-Id: Ife99c97042498d5fad4d9b8e873ecfba6a47947d
|
|
|
d9e469 |
Signed-off-by: Tyler Baicar <tbaicar@codeaurora.org>
|
|
|
d9e469 |
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
|
|
|
d9e469 |
---
|
|
|
d9e469 |
Makefile.am | 3 ++
|
|
|
d9e469 |
configure.ac | 9 ++++++
|
|
|
d9e469 |
ras-arm-handler.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
d9e469 |
ras-arm-handler.h | 24 +++++++++++++++
|
|
|
d9e469 |
ras-events.c | 15 ++++++++++
|
|
|
d9e469 |
ras-record.c | 59 ++++++++++++++++++++++++++++++++++++
|
|
|
d9e469 |
ras-record.h | 16 ++++++++++
|
|
|
d9e469 |
ras-report.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
d9e469 |
ras-report.h | 5 +++-
|
|
|
d9e469 |
9 files changed, 295 insertions(+), 1 deletion(-)
|
|
|
d9e469 |
create mode 100644 ras-arm-handler.c
|
|
|
d9e469 |
create mode 100644 ras-arm-handler.h
|
|
|
d9e469 |
|
|
|
d9e469 |
diff --git a/Makefile.am b/Makefile.am
|
|
|
d9e469 |
index 2500772..4aa5543 100644
|
|
|
d9e469 |
--- a/Makefile.am
|
|
|
d9e469 |
+++ b/Makefile.am
|
|
|
d9e469 |
@@ -27,6 +27,9 @@ endif
|
|
|
d9e469 |
if WITH_NON_STANDARD
|
|
|
d9e469 |
rasdaemon_SOURCES += ras-non-standard-handler.c
|
|
|
d9e469 |
endif
|
|
|
d9e469 |
+if WITH_ARM
|
|
|
d9e469 |
+ rasdaemon_SOURCES += ras-arm-handler.c
|
|
|
d9e469 |
+endif
|
|
|
d9e469 |
if WITH_MCE
|
|
|
d9e469 |
rasdaemon_SOURCES += ras-mce-handler.c mce-intel.c mce-amd-k8.c \
|
|
|
d9e469 |
mce-intel-p4-p6.c mce-intel-nehalem.c \
|
|
|
d9e469 |
diff --git a/configure.ac b/configure.ac
|
|
|
d9e469 |
index ecd4b2f..14fc2f2 100644
|
|
|
d9e469 |
--- a/configure.ac
|
|
|
d9e469 |
+++ b/configure.ac
|
|
|
d9e469 |
@@ -53,6 +53,15 @@ AS_IF([test "x$enable_non_standard" = "xyes"], [
|
|
|
d9e469 |
])
|
|
|
d9e469 |
AM_CONDITIONAL([WITH_NON_STANDARD], [test x$enable_non_standard = xyes])
|
|
|
d9e469 |
|
|
|
d9e469 |
+AC_ARG_ENABLE([arm],
|
|
|
d9e469 |
+ AS_HELP_STRING([--enable-arm], [enable ARM events (currently experimental)]))
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+AS_IF([test "x$enable_arm" = "xyes"], [
|
|
|
d9e469 |
+ AC_DEFINE(HAVE_ARM,1,"have ARM events collect")
|
|
|
d9e469 |
+ AC_SUBST([WITH_ARM])
|
|
|
d9e469 |
+])
|
|
|
d9e469 |
+AM_CONDITIONAL([WITH_ARM], [test x$enable_arm = xyes])
|
|
|
d9e469 |
+
|
|
|
d9e469 |
AC_ARG_ENABLE([mce],
|
|
|
d9e469 |
AS_HELP_STRING([--enable-mce], [enable MCE events (currently experimental)]))
|
|
|
d9e469 |
|
|
|
d9e469 |
diff --git a/ras-arm-handler.c b/ras-arm-handler.c
|
|
|
d9e469 |
new file mode 100644
|
|
|
d9e469 |
index 0000000..a76470d
|
|
|
d9e469 |
--- /dev/null
|
|
|
d9e469 |
+++ b/ras-arm-handler.c
|
|
|
d9e469 |
@@ -0,0 +1,90 @@
|
|
|
d9e469 |
+/*
|
|
|
d9e469 |
+ * Copyright (c) 2016, The Linux Foundation. All rights reserved.
|
|
|
d9e469 |
+ *
|
|
|
d9e469 |
+ * This program is free software; you can redistribute it and/or modify
|
|
|
d9e469 |
+ * it under the terms of the GNU General Public License version 2 and
|
|
|
d9e469 |
+ * only version 2 as published by the Free Software Foundation.
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ * This program is distributed in the hope that it will be useful,
|
|
|
d9e469 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
d9e469 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
d9e469 |
+ * GNU General Public License for more details.
|
|
|
d9e469 |
+ */
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+#include <stdio.h>
|
|
|
d9e469 |
+#include <stdlib.h>
|
|
|
d9e469 |
+#include <string.h>
|
|
|
d9e469 |
+#include <unistd.h>
|
|
|
d9e469 |
+#include "libtrace/kbuffer.h"
|
|
|
d9e469 |
+#include "ras-arm-handler.h"
|
|
|
d9e469 |
+#include "ras-record.h"
|
|
|
d9e469 |
+#include "ras-logger.h"
|
|
|
d9e469 |
+#include "ras-report.h"
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+int ras_arm_event_handler(struct trace_seq *s,
|
|
|
d9e469 |
+ struct pevent_record *record,
|
|
|
d9e469 |
+ struct event_format *event, void *context)
|
|
|
d9e469 |
+{
|
|
|
d9e469 |
+ unsigned long long val;
|
|
|
d9e469 |
+ struct ras_events *ras = context;
|
|
|
d9e469 |
+ time_t now;
|
|
|
d9e469 |
+ struct tm *tm;
|
|
|
d9e469 |
+ struct ras_arm_event ev;
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ /*
|
|
|
d9e469 |
+ * Newer kernels (3.10-rc1 or upper) provide an uptime clock.
|
|
|
d9e469 |
+ * On previous kernels, the way to properly generate an event would
|
|
|
d9e469 |
+ * be to inject a fake one, measure its timestamp and diff it against
|
|
|
d9e469 |
+ * gettimeofday. We won't do it here. Instead, let's use uptime,
|
|
|
d9e469 |
+ * falling-back to the event report's time, if "uptime" clock is
|
|
|
d9e469 |
+ * not available (legacy kernels).
|
|
|
d9e469 |
+ */
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ if (ras->use_uptime)
|
|
|
d9e469 |
+ now = record->ts/user_hz + ras->uptime_diff;
|
|
|
d9e469 |
+ else
|
|
|
d9e469 |
+ now = time(NULL);
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ tm = localtime(&now;;
|
|
|
d9e469 |
+ if (tm)
|
|
|
d9e469 |
+ strftime(ev.timestamp, sizeof(ev.timestamp),
|
|
|
d9e469 |
+ "%Y-%m-%d %H:%M:%S %z", tm);
|
|
|
d9e469 |
+ trace_seq_printf(s, "%s\n", ev.timestamp);
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ if (pevent_get_field_val(s, event, "affinity", record, &val, 1) < 0)
|
|
|
d9e469 |
+ return -1;
|
|
|
d9e469 |
+ ev.affinity = val;
|
|
|
d9e469 |
+ trace_seq_printf(s, " affinity: %d", ev.affinity);
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ if (pevent_get_field_val(s, event, "mpidr", record, &val, 1) < 0)
|
|
|
d9e469 |
+ return -1;
|
|
|
d9e469 |
+ ev.mpidr = val;
|
|
|
d9e469 |
+ trace_seq_printf(s, "\n MPIDR: 0x%llx", (unsigned long long)ev.mpidr);
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ if (pevent_get_field_val(s, event, "midr", record, &val, 1) < 0)
|
|
|
d9e469 |
+ return -1;
|
|
|
d9e469 |
+ ev.midr = val;
|
|
|
d9e469 |
+ trace_seq_printf(s, "\n MIDR: 0x%llx", (unsigned long long)ev.midr);
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ if (pevent_get_field_val(s, event, "running_state", record, &val, 1) < 0)
|
|
|
d9e469 |
+ return -1;
|
|
|
d9e469 |
+ ev.running_state = val;
|
|
|
d9e469 |
+ trace_seq_printf(s, "\n running_state: %d", ev.running_state);
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ if (pevent_get_field_val(s, event, "psci_state", record, &val, 1) < 0)
|
|
|
d9e469 |
+ return -1;
|
|
|
d9e469 |
+ ev.psci_state = val;
|
|
|
d9e469 |
+ trace_seq_printf(s, "\n psci_state: %d", ev.psci_state);
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ /* Insert data into the SGBD */
|
|
|
d9e469 |
+#ifdef HAVE_SQLITE3
|
|
|
d9e469 |
+ ras_store_arm_record(ras, &ev;;
|
|
|
d9e469 |
+#endif
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+#ifdef HAVE_ABRT_REPORT
|
|
|
d9e469 |
+ /* Report event to ABRT */
|
|
|
d9e469 |
+ ras_report_arm_event(ras, &ev;;
|
|
|
d9e469 |
+#endif
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ return 0;
|
|
|
d9e469 |
+}
|
|
|
d9e469 |
diff --git a/ras-arm-handler.h b/ras-arm-handler.h
|
|
|
d9e469 |
new file mode 100644
|
|
|
d9e469 |
index 0000000..eae10ec
|
|
|
d9e469 |
--- /dev/null
|
|
|
d9e469 |
+++ b/ras-arm-handler.h
|
|
|
d9e469 |
@@ -0,0 +1,24 @@
|
|
|
d9e469 |
+/*
|
|
|
d9e469 |
+ * Copyright (c) 2016, The Linux Foundation. All rights reserved.
|
|
|
d9e469 |
+ *
|
|
|
d9e469 |
+ * This program is free software; you can redistribute it and/or modify
|
|
|
d9e469 |
+ * it under the terms of the GNU General Public License version 2 and
|
|
|
d9e469 |
+ * only version 2 as published by the Free Software Foundation.
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ * This program is distributed in the hope that it will be useful,
|
|
|
d9e469 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
d9e469 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
d9e469 |
+ * GNU General Public License for more details.
|
|
|
d9e469 |
+ */
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+#ifndef __RAS_ARM_HANDLER_H
|
|
|
d9e469 |
+#define __RAS_ARM_HANDLER_H
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+#include "ras-events.h"
|
|
|
d9e469 |
+#include "libtrace/event-parse.h"
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+int ras_arm_event_handler(struct trace_seq *s,
|
|
|
d9e469 |
+ struct pevent_record *record,
|
|
|
d9e469 |
+ struct event_format *event, void *context);
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+#endif
|
|
|
d9e469 |
diff --git a/ras-events.c b/ras-events.c
|
|
|
d9e469 |
index 96aa6f1..812d712 100644
|
|
|
d9e469 |
--- a/ras-events.c
|
|
|
d9e469 |
+++ b/ras-events.c
|
|
|
d9e469 |
@@ -30,6 +30,7 @@
|
|
|
d9e469 |
#include "ras-mc-handler.h"
|
|
|
d9e469 |
#include "ras-aer-handler.h"
|
|
|
d9e469 |
#include "ras-non-standard-handler.h"
|
|
|
d9e469 |
+#include "ras-arm-handler.h"
|
|
|
d9e469 |
#include "ras-mce-handler.h"
|
|
|
d9e469 |
#include "ras-extlog-handler.h"
|
|
|
d9e469 |
#include "ras-record.h"
|
|
|
d9e469 |
@@ -213,6 +214,10 @@ int toggle_ras_mc_event(int enable)
|
|
|
d9e469 |
rc |= __toggle_ras_mc_event(ras, "ras", "non_standard_event", enable);
|
|
|
d9e469 |
#endif
|
|
|
d9e469 |
|
|
|
d9e469 |
+#ifdef HAVE_ARM
|
|
|
d9e469 |
+ rc |= __toggle_ras_mc_event(ras, "ras", "arm_event", enable);
|
|
|
d9e469 |
+#endif
|
|
|
d9e469 |
+
|
|
|
d9e469 |
free_ras:
|
|
|
d9e469 |
free(ras);
|
|
|
d9e469 |
return rc;
|
|
|
d9e469 |
@@ -691,6 +696,16 @@ int handle_ras_events(int record_events)
|
|
|
d9e469 |
"ras", "non_standard_event");
|
|
|
d9e469 |
#endif
|
|
|
d9e469 |
|
|
|
d9e469 |
+#ifdef HAVE_ARM
|
|
|
d9e469 |
+ rc = add_event_handler(ras, pevent, page_size, "ras", "arm_event",
|
|
|
d9e469 |
+ ras_arm_event_handler);
|
|
|
d9e469 |
+ if (!rc)
|
|
|
d9e469 |
+ num_events++;
|
|
|
d9e469 |
+ else
|
|
|
d9e469 |
+ log(ALL, LOG_ERR, "Can't get traces from %s:%s\n",
|
|
|
d9e469 |
+ "ras", "arm_event");
|
|
|
d9e469 |
+#endif
|
|
|
d9e469 |
+
|
|
|
d9e469 |
cpus = get_num_cpus(ras);
|
|
|
d9e469 |
|
|
|
d9e469 |
#ifdef HAVE_MCE
|
|
|
d9e469 |
diff --git a/ras-record.c b/ras-record.c
|
|
|
d9e469 |
index 357ab61..c3644cb 100644
|
|
|
d9e469 |
--- a/ras-record.c
|
|
|
d9e469 |
+++ b/ras-record.c
|
|
|
d9e469 |
@@ -209,6 +209,58 @@ int ras_store_non_standard_record(struct ras_events *ras, struct ras_non_standar
|
|
|
d9e469 |
}
|
|
|
d9e469 |
#endif
|
|
|
d9e469 |
|
|
|
d9e469 |
+/*
|
|
|
d9e469 |
+ * Table and functions to handle ras:arm
|
|
|
d9e469 |
+ */
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+#ifdef HAVE_ARM
|
|
|
d9e469 |
+static const struct db_fields arm_event_fields[] = {
|
|
|
d9e469 |
+ { .name="id", .type="INTEGER PRIMARY KEY" },
|
|
|
d9e469 |
+ { .name="timestamp", .type="TEXT" },
|
|
|
d9e469 |
+ { .name="error_count", .type="INTEGER" },
|
|
|
d9e469 |
+ { .name="affinity", .type="INTEGER" },
|
|
|
d9e469 |
+ { .name="mpidr", .type="INTEGER" },
|
|
|
d9e469 |
+ { .name="running_state", .type="INTEGER" },
|
|
|
d9e469 |
+ { .name="psci_state", .type="INTEGER" },
|
|
|
d9e469 |
+};
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+static const struct db_table_descriptor arm_event_tab = {
|
|
|
d9e469 |
+ .name = "arm_event",
|
|
|
d9e469 |
+ .fields = arm_event_fields,
|
|
|
d9e469 |
+ .num_fields = ARRAY_SIZE(arm_event_fields),
|
|
|
d9e469 |
+};
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+int ras_store_arm_record(struct ras_events *ras, struct ras_arm_event *ev)
|
|
|
d9e469 |
+{
|
|
|
d9e469 |
+ int rc;
|
|
|
d9e469 |
+ struct sqlite3_priv *priv = ras->db_priv;
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ if (!priv || !priv->stmt_arm_record)
|
|
|
d9e469 |
+ return 0;
|
|
|
d9e469 |
+ log(TERM, LOG_INFO, "arm_event store: %p\n", priv->stmt_arm_record);
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ sqlite3_bind_text (priv->stmt_arm_record, 1, ev->timestamp, -1, NULL);
|
|
|
d9e469 |
+ sqlite3_bind_int (priv->stmt_arm_record, 2, ev->error_count);
|
|
|
d9e469 |
+ sqlite3_bind_int (priv->stmt_arm_record, 3, ev->affinity);
|
|
|
d9e469 |
+ sqlite3_bind_int (priv->stmt_arm_record, 4, ev->mpidr);
|
|
|
d9e469 |
+ sqlite3_bind_int (priv->stmt_arm_record, 5, ev->running_state);
|
|
|
d9e469 |
+ sqlite3_bind_int (priv->stmt_arm_record, 6, ev->psci_state);
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ rc = sqlite3_step(priv->stmt_arm_record);
|
|
|
d9e469 |
+ if (rc != SQLITE_OK && rc != SQLITE_DONE)
|
|
|
d9e469 |
+ log(TERM, LOG_ERR,
|
|
|
d9e469 |
+ "Failed to do arm_event step on sqlite: error = %d\n", rc);
|
|
|
d9e469 |
+ rc = sqlite3_reset(priv->stmt_arm_record);
|
|
|
d9e469 |
+ if (rc != SQLITE_OK && rc != SQLITE_DONE)
|
|
|
d9e469 |
+ log(TERM, LOG_ERR,
|
|
|
d9e469 |
+ "Failed reset arm_event on sqlite: error = %d\n",
|
|
|
d9e469 |
+ rc);
|
|
|
d9e469 |
+ log(TERM, LOG_INFO, "register inserted at db\n");
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ return rc;
|
|
|
d9e469 |
+}
|
|
|
d9e469 |
+#endif
|
|
|
d9e469 |
+
|
|
|
d9e469 |
#ifdef HAVE_EXTLOG
|
|
|
d9e469 |
static const struct db_fields extlog_event_fields[] = {
|
|
|
d9e469 |
{ .name="id", .type="INTEGER PRIMARY KEY" },
|
|
|
d9e469 |
@@ -509,6 +561,13 @@ int ras_mc_event_opendb(unsigned cpu, struct ras_events *ras)
|
|
|
d9e469 |
&non_standard_event_tab);
|
|
|
d9e469 |
#endif
|
|
|
d9e469 |
|
|
|
d9e469 |
+#ifdef HAVE_ARM
|
|
|
d9e469 |
+ rc = ras_mc_create_table(priv, &arm_event_tab);
|
|
|
d9e469 |
+ if (rc == SQLITE_OK)
|
|
|
d9e469 |
+ rc = ras_mc_prepare_stmt(priv, &priv->stmt_arm_record,
|
|
|
d9e469 |
+ &arm_event_tab);
|
|
|
d9e469 |
+#endif
|
|
|
d9e469 |
+
|
|
|
d9e469 |
ras->db_priv = priv;
|
|
|
d9e469 |
return 0;
|
|
|
d9e469 |
}
|
|
|
d9e469 |
diff --git a/ras-record.h b/ras-record.h
|
|
|
d9e469 |
index 473ae40..12c2218 100644
|
|
|
d9e469 |
--- a/ras-record.h
|
|
|
d9e469 |
+++ b/ras-record.h
|
|
|
d9e469 |
@@ -65,10 +65,21 @@ struct ras_non_standard_event {
|
|
|
d9e469 |
uint32_t length;
|
|
|
d9e469 |
};
|
|
|
d9e469 |
|
|
|
d9e469 |
+struct ras_arm_event {
|
|
|
d9e469 |
+ char timestamp[64];
|
|
|
d9e469 |
+ int32_t error_count;
|
|
|
d9e469 |
+ int8_t affinity;
|
|
|
d9e469 |
+ int64_t mpidr;
|
|
|
d9e469 |
+ int64_t midr;
|
|
|
d9e469 |
+ int32_t running_state;
|
|
|
d9e469 |
+ int32_t psci_state;
|
|
|
d9e469 |
+};
|
|
|
d9e469 |
+
|
|
|
d9e469 |
struct ras_mc_event;
|
|
|
d9e469 |
struct ras_aer_event;
|
|
|
d9e469 |
struct ras_extlog_event;
|
|
|
d9e469 |
struct ras_non_standard_event;
|
|
|
d9e469 |
+struct ras_arm_event;
|
|
|
d9e469 |
struct mce_event;
|
|
|
d9e469 |
|
|
|
d9e469 |
#ifdef HAVE_SQLITE3
|
|
|
d9e469 |
@@ -90,6 +101,9 @@ struct sqlite3_priv {
|
|
|
d9e469 |
#ifdef HAVE_NON_STANDARD
|
|
|
d9e469 |
sqlite3_stmt *stmt_non_standard_record;
|
|
|
d9e469 |
#endif
|
|
|
d9e469 |
+#ifdef HAVE_ARM
|
|
|
d9e469 |
+ sqlite3_stmt *stmt_arm_record;
|
|
|
d9e469 |
+#endif
|
|
|
d9e469 |
};
|
|
|
d9e469 |
|
|
|
d9e469 |
int ras_mc_event_opendb(unsigned cpu, struct ras_events *ras);
|
|
|
d9e469 |
@@ -98,6 +112,7 @@ int ras_store_aer_event(struct ras_events *ras, struct ras_aer_event *ev);
|
|
|
d9e469 |
int ras_store_mce_record(struct ras_events *ras, struct mce_event *ev);
|
|
|
d9e469 |
int ras_store_extlog_mem_record(struct ras_events *ras, struct ras_extlog_event *ev);
|
|
|
d9e469 |
int ras_store_non_standard_record(struct ras_events *ras, struct ras_non_standard_event *ev);
|
|
|
d9e469 |
+int ras_store_arm_record(struct ras_events *ras, struct ras_arm_event *ev);
|
|
|
d9e469 |
|
|
|
d9e469 |
#else
|
|
|
d9e469 |
static inline int ras_mc_event_opendb(unsigned cpu, struct ras_events *ras) { return 0; };
|
|
|
d9e469 |
@@ -106,6 +121,7 @@ static inline int ras_store_aer_event(struct ras_events *ras, struct ras_aer_eve
|
|
|
d9e469 |
static inline int ras_store_mce_record(struct ras_events *ras, struct mce_event *ev) { return 0; };
|
|
|
d9e469 |
static inline int ras_store_extlog_mem_record(struct ras_events *ras, struct ras_extlog_event *ev) { return 0; };
|
|
|
d9e469 |
static inline int ras_store_non_standard_record(struct ras_events *ras, struct ras_non_standard_event *ev) { return 0; };
|
|
|
d9e469 |
+static inline int ras_store_arm_record(struct ras_events *ras, struct ras_arm_event *ev) { return 0; };
|
|
|
d9e469 |
|
|
|
d9e469 |
#endif
|
|
|
d9e469 |
|
|
|
d9e469 |
diff --git a/ras-report.c b/ras-report.c
|
|
|
d9e469 |
index 1eb9f79..d4beee0 100644
|
|
|
d9e469 |
--- a/ras-report.c
|
|
|
d9e469 |
+++ b/ras-report.c
|
|
|
d9e469 |
@@ -228,6 +228,33 @@ static int set_non_standard_event_backtrace(char *buf, struct ras_non_standard_e
|
|
|
d9e469 |
return 0;
|
|
|
d9e469 |
}
|
|
|
d9e469 |
|
|
|
d9e469 |
+static int set_arm_event_backtrace(char *buf, struct ras_arm_event *ev){
|
|
|
d9e469 |
+ char bt_buf[MAX_BACKTRACE_SIZE];
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ if(!buf || !ev)
|
|
|
d9e469 |
+ return -1;
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ sprintf(bt_buf, "BACKTRACE=" \
|
|
|
d9e469 |
+ "timestamp=%s\n" \
|
|
|
d9e469 |
+ "error_count=%d\n" \
|
|
|
d9e469 |
+ "affinity=%d\n" \
|
|
|
d9e469 |
+ "mpidr=0x%lx\n" \
|
|
|
d9e469 |
+ "midr=0x%lx\n" \
|
|
|
d9e469 |
+ "running_state=%d\n" \
|
|
|
d9e469 |
+ "psci_state=%d\n", \
|
|
|
d9e469 |
+ ev->timestamp, \
|
|
|
d9e469 |
+ ev->error_count, \
|
|
|
d9e469 |
+ ev->affinity, \
|
|
|
d9e469 |
+ ev->mpidr, \
|
|
|
d9e469 |
+ ev->midr, \
|
|
|
d9e469 |
+ ev->running_state, \
|
|
|
d9e469 |
+ ev->psci_state);
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ strcat(buf, bt_buf);
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ return 0;
|
|
|
d9e469 |
+}
|
|
|
d9e469 |
+
|
|
|
d9e469 |
static int commit_report_backtrace(int sockfd, int type, void *ev){
|
|
|
d9e469 |
char buf[MAX_BACKTRACE_SIZE];
|
|
|
d9e469 |
char *pbuf = buf;
|
|
|
d9e469 |
@@ -253,6 +280,9 @@ static int commit_report_backtrace(int sockfd, int type, void *ev){
|
|
|
d9e469 |
case NON_STANDARD_EVENT:
|
|
|
d9e469 |
rc = set_non_standard_event_backtrace(buf, (struct ras_non_standard_event *)ev);
|
|
|
d9e469 |
break;
|
|
|
d9e469 |
+ case ARM_EVENT:
|
|
|
d9e469 |
+ rc = set_arm_event_backtrace(buf, (struct ras_arm_event *)ev);
|
|
|
d9e469 |
+ break;
|
|
|
d9e469 |
default:
|
|
|
d9e469 |
return -1;
|
|
|
d9e469 |
}
|
|
|
d9e469 |
@@ -425,6 +455,51 @@ non_standard_fail:
|
|
|
d9e469 |
return rc;
|
|
|
d9e469 |
}
|
|
|
d9e469 |
|
|
|
d9e469 |
+int ras_report_arm_event(struct ras_events *ras, struct ras_arm_event *ev){
|
|
|
d9e469 |
+ char buf[MAX_MESSAGE_SIZE];
|
|
|
d9e469 |
+ int sockfd = 0;
|
|
|
d9e469 |
+ int rc = -1;
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ memset(buf, 0, sizeof(buf));
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ sockfd = setup_report_socket();
|
|
|
d9e469 |
+ if(sockfd < 0){
|
|
|
d9e469 |
+ return rc;
|
|
|
d9e469 |
+ }
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ rc = commit_report_basic(sockfd);
|
|
|
d9e469 |
+ if(rc < 0){
|
|
|
d9e469 |
+ goto arm_fail;
|
|
|
d9e469 |
+ }
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ rc = commit_report_backtrace(sockfd, ARM_EVENT, ev);
|
|
|
d9e469 |
+ if(rc < 0){
|
|
|
d9e469 |
+ goto arm_fail;
|
|
|
d9e469 |
+ }
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ sprintf(buf, "ANALYZER=%s", "rasdaemon-arm");
|
|
|
d9e469 |
+ rc = write(sockfd, buf, strlen(buf) + 1);
|
|
|
d9e469 |
+ if(rc < strlen(buf) + 1){
|
|
|
d9e469 |
+ goto arm_fail;
|
|
|
d9e469 |
+ }
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ sprintf(buf, "REASON=%s", "ARM CPU report problem");
|
|
|
d9e469 |
+ rc = write(sockfd, buf, strlen(buf) + 1);
|
|
|
d9e469 |
+ if(rc < strlen(buf) + 1){
|
|
|
d9e469 |
+ goto arm_fail;
|
|
|
d9e469 |
+ }
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ rc = 0;
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+arm_fail:
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ if(sockfd > 0){
|
|
|
d9e469 |
+ close(sockfd);
|
|
|
d9e469 |
+ }
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ return rc;
|
|
|
d9e469 |
+}
|
|
|
d9e469 |
+
|
|
|
d9e469 |
int ras_report_mce_event(struct ras_events *ras, struct mce_event *ev){
|
|
|
d9e469 |
char buf[MAX_MESSAGE_SIZE];
|
|
|
d9e469 |
int sockfd = 0;
|
|
|
d9e469 |
diff --git a/ras-report.h b/ras-report.h
|
|
|
d9e469 |
index c2fcf42..6c466f5 100644
|
|
|
d9e469 |
--- a/ras-report.h
|
|
|
d9e469 |
+++ b/ras-report.h
|
|
|
d9e469 |
@@ -33,7 +33,8 @@ enum {
|
|
|
d9e469 |
MC_EVENT,
|
|
|
d9e469 |
MCE_EVENT,
|
|
|
d9e469 |
AER_EVENT,
|
|
|
d9e469 |
- NON_STANDARD_EVENT
|
|
|
d9e469 |
+ NON_STANDARD_EVENT,
|
|
|
d9e469 |
+ ARM_EVENT
|
|
|
d9e469 |
};
|
|
|
d9e469 |
|
|
|
d9e469 |
#ifdef HAVE_ABRT_REPORT
|
|
|
d9e469 |
@@ -42,6 +43,7 @@ int ras_report_mc_event(struct ras_events *ras, struct ras_mc_event *ev);
|
|
|
d9e469 |
int ras_report_aer_event(struct ras_events *ras, struct ras_aer_event *ev);
|
|
|
d9e469 |
int ras_report_mce_event(struct ras_events *ras, struct mce_event *ev);
|
|
|
d9e469 |
int ras_report_non_standard_event(struct ras_events *ras, struct ras_non_standard_event *ev);
|
|
|
d9e469 |
+int ras_report_arm_event(struct ras_events *ras, struct ras_arm_event *ev);
|
|
|
d9e469 |
|
|
|
d9e469 |
#else
|
|
|
d9e469 |
|
|
|
d9e469 |
@@ -49,6 +51,7 @@ static inline int ras_report_mc_event(struct ras_events *ras, struct ras_mc_even
|
|
|
d9e469 |
static inline int ras_report_aer_event(struct ras_events *ras, struct ras_aer_event *ev) { return 0; };
|
|
|
d9e469 |
static inline int ras_report_mce_event(struct ras_events *ras, struct mce_event *ev) { return 0; };
|
|
|
d9e469 |
static inline int ras_report_non_standard_event(struct ras_events *ras, struct ras_non_standard_event *ev) { return 0; };
|
|
|
d9e469 |
+static inline int ras_report_arm_event(struct ras_events *ras, struct ras_arm_event *ev) { return 0; };
|
|
|
d9e469 |
|
|
|
d9e469 |
#endif
|
|
|
d9e469 |
|
|
|
d9e469 |
--
|
|
|
d9e469 |
1.8.3.1
|
|
|
d9e469 |
|