rasdaemon: add support for non standard CPER section events
PATCH v3 1/2 rasdaemon: add support for non standard CPER section events
Add support to handle the non standard CPER section kernel trace events which cover RAS errors who's section type is unknown.
Signed-off-by Tyler Baicar <[email protected]>
Cc Shiju Jose <[email protected]>
--- Makefile.am | 3 + configure.ac | 9 +++ ras-events.c | 15 +++++ ras-events.h | 8 +++ ras-non-standard-handler.c | 147 +++++++++++++++++++++++++++++++++++++++++++++ ras-non-standard-handler.h | 26 ++++++++ ras-record.c | 59 ++++++++++++++++++ ras-record.h | 15 +++++ ras-report.c | 80 ++++++++++++++++++++++++ ras-report.h | 18 +++++- 10 files changed, 379 insertions(+), 1 deletion(-) create mode 100644 ras-non-standard-handler.c create mode 100644 ras-non-standard-handler.h
Makefile.am +3 -0
@@ -24,6 +24,9 @@ endif if WITH_AER rasdaemon_SOURCES += ras-aer-handler.c endif +if WITH_NON_STANDARD + rasdaemon_SOURCES += ras-non-standard-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
@@ -44,6 +44,15 @@ AS_IF([test "x$enable_aer" = "xyes"], [ ]) AM_CONDITIONAL([WITH_AER], [test x$enable_aer = xyes]) +AC_ARG_ENABLE([non_standard], + AS_HELP_STRING([--enable-non-standard], [enable NON_STANDARD events (currently experimental)])) + +AS_IF([test "x$enable_non_standard" = "xyes"], [ + AC_DEFINE(HAVE_NON_STANDARD,1,"have UNKNOWN_SEC events collect") + AC_SUBST([WITH_NON_STANDARD]) +]) +AM_CONDITIONAL([WITH_NON_STANDARD], [test x$enable_non_standard = xyes]) + AC_ARG_ENABLE([mce], AS_HELP_STRING([--enable-mce], [enable MCE events (currently experimental)]))
ras-events.c +15 -0
@@ -29,6 +29,7 @@#include "libtrace/event-parse.h" #include "ras-mc-handler.h" #include "ras-aer-handler.h" +#include "ras-non-standard-handler.h" #include "ras-mce-handler.h" #include "ras-extlog-handler.h" #include "ras-record.h"
@@ -208,6 +209,10 @@ int toggle_ras_mc_event(int enable) rc |=__toggle_ras_mc_event (ras,"ras" ,"extlog_mem_event" , enable);#endif +#ifdef HAVE_NON_STANDARD + rc |=__toggle_ras_mc_event (ras,"ras" ,"non_standard_event" , enable); +#endif + free_ras:free (ras);return rc;
@@ -676,6 +681,16 @@ int handle_ras_events(int record_events) "ras", "aer_event");#endif +#ifdef HAVE_NON_STANDARD + rc =add_event_handler (ras, pevent, page_size,"ras" ,"non_standard_event" , + ras_non_standard_event_handler); +if (!rc) + num_events++; +else +log (ALL ,LOG_ERR ,"Can't get traces from %s:%s\n" , +"ras" ,"non_standard_event" ); +#endif + cpus =get_num_cpus (ras);#ifdef HAVE_MCE
ras-events.h +8 -0
@@ -68,6 +68,14 @@ enum hw_event_mc_err_type { HW_EVENT_ERR_INFO, }; +/* Should match the code at Kernel's include/acpi/ghes.h */ +enum ghes_severity { +GHES_SEV_NO , +GHES_SEV_CORRECTED , +GHES_SEV_RECOVERABLE , +GHES_SEV_PANIC , +}; +/* Function prototypes */ int toggle_ras_mc_event (int enable);int handle_ras_events (int record_events);
ras-non-standard-handler.c new file +147 -0
147 lines not on this page · raw message
ras-non-standard-handler.h new file +26 -0
@@ -0,0 +1,26 @@ +/* +* 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_NON_STANDARD_HANDLER_H +#define __RAS_NON_STANDARD_HANDLER_H + +#include "ras-events.h" +#include "libtrace/event-parse.h" + +int ras_non_standard_event_handler (struct trace_seq *s, +struct pevent_record *record, +struct event_format *event,void *context); + +void print_le_hex (struct trace_seq *s,const uint8_t *buf,int index); + +#endif
ras-record.c +59 -0
76 lines not on this page · raw message
ras-record.h +15 -0
@@ -1,5 +1,6 @@/* * Copyright (C) 2013 Mauro Carvalho Chehab <[email protected]> +* 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 as published by
@@ -56,9 +57,18 @@ struct ras_extlog_event {unsigned short cper_data_length; }; +struct ras_non_standard_event { +char timestamp[64 ]; +const char *sec_type, *fru_id, *fru_text; +const char *severity; +const uint8_t *error; +uint32_t length; +}; +struct ras_mc_event ;struct ras_aer_event ;struct ras_extlog_event ; +struct ras_non_standard_event ;struct mce_event ;#ifdef HAVE_SQLITE3
@@ -77,6 +87,9 @@ struct sqlite3_priv {#ifdef HAVE_EXTLOG sqlite3_stmt *stmt_extlog_record;#endif +#ifdef HAVE_NON_STANDARD +sqlite3_stmt *stmt_non_standard_record; +#endif };int ras_mc_event_opendb (unsigned cpu,struct ras_events *ras);
@@ -84,6 +97,7 @@ int ras_store_mc_event(struct ras_events *ras, struct ras_mc_event *ev);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);#else static inline int ras_mc_event_opendb (unsigned cpu,struct ras_events *ras) {return 0 ; };
@@ -91,6 +105,7 @@ static inline int ras_store_mc_event(struct ras_events *ras, struct ras_mc_eventstatic inline int ras_store_aer_event (struct ras_events *ras,struct ras_aer_event *ev) {return 0 ; };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 ; };#endif
ras-report.c +80 -0
101 lines not on this page · raw message
ras-report.h +17 -1
@@ -1,3 +1,16 @@ +/* +* 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_REPORT_H#define __RAS_REPORT_H
@@ -19,7 +32,8 @@enum {MC_EVENT ,MCE_EVENT , -AER_EVENT +AER_EVENT , +NON_STANDARD_EVENT };#ifdef HAVE_ABRT_REPORT
@@ -27,12 +41,14 @@ enum {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);#else static inline int ras_report_mc_event (struct ras_events *ras,struct ras_mc_event *ev) {return 0 ; };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 ; };#endif