rasdaemon: Add support for the CXL error events
v6 cover rasdaemon: Add support for the CXL error events
From: Shiju Jose <[email protected]>
Log and record the following CXL error records reported through the kernel trace events. CXL poison errors, CXL AER uncorrectable errors and CXL AER correctable errors.
Shiju Jose (4):
rasdaemon: Move definition for BIT and BIT_ULL to a common file
rasdaemon: Add support for the CXL poison events
rasdaemon: Add support for the CXL AER uncorrectable errors
rasdaemon: Add support for the CXL AER correctable errors
Changes:
V5 -> V6
1. Following modification in the CXL poison due to changes in the kernel patches for the cxl_poison.
- length -> dpa_length
- add field trace_type
V4 -> V5
1. Add logging of device serial number for the CXL AER uncorrectable and CXL AER correctable errors.
2. Rebased.
3. Updated the patches description.
V3 -> V4
1. Modification for the changes in the kernel patches
a) https://lore.kernel.org/lkml/[email protected]/
b) https://lore.kernel.org/linux-cxl/[email protected]/T/#t
V2 -> V3
1. Fix for the comments from Dave Jiang.
RFC V1 -> V2
1. Rename uuid to region_uuid in the log and SQLite DB.
2. Rebase to the latest rasdaemon code.
3. Modify to match the name changes of interface structures and functions in the latest libtraceevent-dev, use in the rasdaemon.
Makefile.am | 7 +- configure.ac | 11 + ras-cxl-handler.c | 426 +++++++++++++++++++++++++++++++++++++ ras-cxl-handler.h | 32 +++ ras-events.c | 33 +++ ras-events.h | 3 + ras-non-standard-handler.h | 3 - ras-record.c | 215 +++++++++++++++++++ ras-record.h | 55 +++++ ras-report.c | 231 ++++++++++++++++++++ ras-report.h | 6 + 11 files changed, 1018 insertions(+), 4 deletions(-) create mode 100644 ras-cxl-handler.c create mode 100644 ras-cxl-handler.h
Signature · 1 line
2.25.1
PATCH v6 1/4 rasdaemon: Move definition for BIT and BIT_ULL to a common file
From: Shiju Jose <[email protected]>
Move definition for BIT() and BIT_ULL() to the
common file ras-record.h
--- ras-non-standard-handler.h | 3 --- ras-record.h | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-)
ras-non-standard-handler.h +0 -3
@@ -17,9 +17,6 @@#include "ras-events.h" #include <traceevent/event-parse.h> -#define BIT (nr) (1UL << (nr)) -#define BIT_ULL (nr) (1ULL << (nr)) -struct ras_ns_ev_decoder {struct ras_ns_ev_decoder *next;const char *sec_type;
ras-record.h +3 -0
@@ -25,6 +25,9 @@#define ARRAY_SIZE (x) (sizeof(x)/sizeof(*(x))) +#define BIT (nr) (1UL << (nr)) +#define BIT_ULL (nr) (1ULL << (nr)) +extern long user_hz;struct ras_events ;
Signature · 1 line
2.25.1
PATCH v6 2/4 rasdaemon: Add support for the CXL poison events
In reply to [email protected]From: Shiju Jose <[email protected]>
Add support to log and record the CXL poison events.
The corresponding Kernel patches here:
https://lore.kernel.org/linux-cxl/[email protected]/T/#t
Presently for logging only, could be extended for the policy based recovery action for the frequent poison events depending on the above kernel patches.
--- Makefile.am | 7 +- configure.ac | 11 +++ ras-cxl-handler.c | 194 ++++++++++++++++++++++++++++++++++++++++++++++ ras-cxl-handler.h | 24 ++++++ ras-events.c | 15 ++++ ras-events.h | 1 + ras-record.c | 85 ++++++++++++++++++++ ras-record.h | 22 ++++++ ras-report.c | 87 +++++++++++++++++++++ ras-report.h | 2 + 10 files changed, 447 insertions(+), 1 deletion(-) create mode 100644 ras-cxl-handler.c create mode 100644 ras-cxl-handler.h
Makefile.am +6 -1
@@ -73,6 +73,11 @@ endif if WITH_CPU_FAULT_ISOLATION rasdaemon_SOURCES += ras-cpu-isolation.c queue.c endif + +if WITH_CXL + rasdaemon_SOURCES += ras-cxl-handler.c +endif + rasdaemon_LDADD = -lpthread $(SQLITE3_LIBS) $(LIBTRACEEVENT_LIBS) rasdaemon_CFLAGS = $(SQLITE3_CFLAGS) $(LIBTRACEEVENT_CFLAGS)
@@ -81,7 +86,7 @@ include_HEADERS = config.h ras-events.h ras-logger.h ras-mc-handler.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 non-standard-ampere.h ras-memory-failure-handler.h \ - ras-cpu-isolation.h queue.h + ras-cxl-handler.h ras-cpu-isolation.h queue.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
@@ -127,6 +127,16 @@ AS_IF([test "x$enable_memory_failure" = "xyes" || test "x$enable_all" = "xyes"], 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([cxl], + AS_HELP_STRING([--enable-cxl], [enable CXL events (currently experimental)])) + +AS_IF([test "x$enable_cxl" = "xyes" || test "x$enable_all" == "xyes"], [ + AC_DEFINE(HAVE_CXL,1,"have CXL events collect") + AC_SUBST([WITH_CXL]) +]) +AM_CONDITIONAL([WITH_CXL], [test x$enable_cxl = xyes || test x$enable_all == xyes]) +AM_COND_IF([WITH_CXL], [USE_CXL="yes"], [USE_CXL="no"]) + AC_ARG_ENABLE([abrt_report], AS_HELP_STRING([--enable-abrt-report], [enable report event to ABRT (currently experimental)]))
@@ -215,6 +225,7 @@ compile time options summary DEVLINK : $USE_DEVLINK Disk I/O errors : $USE_DISKERROR Memory Failure : $USE_MEMORY_FAILURE + CXL events : $USE_CXL Memory CE PFA : $USE_MEMORY_CE_PFA AMP RAS errors : $USE_AMP_NS_DECODE CPU fault isolation : $USE_CPU_FAULT_ISOLATION
ras-cxl-handler.c new file +194 -0
194 lines not on this page · raw message
ras-cxl-handler.h new file +24 -0
@@ -0,0 +1,24 @@ +/* +* Copyright (c) Huawei Technologies Co., Ltd. 2023. 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_CXL_HANDLER_H +#define __RAS_CXL_HANDLER_H + +#include "ras-events.h" +#include <traceevent/event-parse.h> + +int ras_cxl_poison_event_handler (struct trace_seq *s, +struct tep_record *record, +struct tep_event *event,void *context); +#endif
ras-events.c +15 -0
@@ -40,6 +40,7 @@#include "ras-devlink-handler.h" #include "ras-diskerror-handler.h" #include "ras-memory-failure-handler.h" +#include "ras-cxl-handler.h" #include "ras-record.h" #include "ras-logger.h" #include "ras-page-isolation.h"
@@ -243,6 +244,10 @@ int toggle_ras_mc_event(int enable) rc |=__toggle_ras_mc_event (ras,"ras" ,"memory_failure_event" , enable);#endif +#ifdef HAVE_CXL + rc |=__toggle_ras_mc_event (ras,"cxl" ,"cxl_poison" , enable); +#endif + free_ras:free (ras);return rc;
@@ -973,6 +978,16 @@ int handle_ras_events(int record_events) "ras", "memory_failure_event");#endif +#ifdef HAVE_CXL + rc =add_event_handler (ras, pevent, page_size,"cxl" ,"cxl_poison" , + ras_cxl_poison_event_handler,NULL ,CXL_POISON_EVENT ); +if (!rc) + num_events++; +else +log (ALL ,LOG_ERR ,"Can't get traces from %s:%s\n" , +"cxl" ,"cxl_poison" ); +#endif +if (!num_events) {log (ALL ,LOG_INFO ,"Failed to trace all supported RAS events. Aborting.\n" );
ras-events.h +1 -0
@@ -39,6 +39,7 @@ enum {DEVLINK_EVENT ,DISKERROR_EVENT ,MF_EVENT , +CXL_POISON_EVENT , NR_EVENTS };
ras-record.c +85 -0
103 lines not on this page · raw message
ras-record.h +22 -0
@@ -114,6 +114,22 @@ struct ras_mf_event {const char *action_result; }; +struct ras_cxl_poison_event { +char timestamp[64 ]; +const char *memdev; +const char *host; +uint64_t serial; +const char *trace_type; +const char *region; +const char *uuid; +uint64_t hpa; +uint64_t dpa; +uint32_t dpa_length; +const char *source; +uint8_t flags; +char overflow_ts[64 ]; +}; +struct ras_mc_event ;struct ras_aer_event ;struct ras_extlog_event ;
@@ -123,6 +139,7 @@ struct mce_event;struct devlink_event ;struct diskerror_event ;struct ras_mf_event ; +struct ras_cxl_poison_event ;#ifdef HAVE_SQLITE3
@@ -155,6 +172,9 @@ struct sqlite3_priv {#ifdef HAVE_MEMORY_FAILURE sqlite3_stmt *stmt_mf_event;#endif +#ifdef HAVE_CXL +sqlite3_stmt *stmt_cxl_poison_event; +#endif };struct db_fields {
@@ -182,6 +202,7 @@ 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); +int ras_store_cxl_poison_event (struct ras_events *ras,struct ras_cxl_poison_event *ev);#else static inline int ras_mc_event_opendb (unsigned cpu,struct ras_events *ras) {return 0 ; };
@@ -195,6 +216,7 @@ static inline int ras_store_arm_record(struct ras_events *ras, struct ras_arm_evstatic 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 ; }; +static inline int ras_store_cxl_poison_event (struct ras_events *ras,struct ras_cxl_poison_event *ev) {return 0 ; };#endif
ras-report.c +87 -0
102 lines not on this page · raw message
ras-report.h +2 -0
@@ -39,6 +39,7 @@ 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); +int ras_report_cxl_poison_event (struct ras_events *ras,struct ras_cxl_poison_event *ev);#else
@@ -50,6 +51,7 @@ static inline int ras_report_arm_event(struct ras_events *ras, struct ras_arm_evstatic 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 ; }; +static inline int ras_report_cxl_poison_event (struct ras_events *ras,struct ras_cxl_poison_event *ev) {return 0 ; };#endif
Signature · 1 line
2.25.1
PATCH v6 3/4 rasdaemon: Add support for the CXL AER uncorrectable errors
In reply to [email protected]From: Shiju Jose <[email protected]>
Add support to log and record the CXL AER uncorrectable errors.
The corresponding Kernel patches are here:
https://lore.kernel.org/linux-cxl/166974401763.1608150.5424589924034481387.stgit@djiang5-desk3.ch.intel.com/T/#t
https://lore.kernel.org/lkml/[email protected]/T/
It was found that the header log data to be converted to the big-endian format to correctly store in the SQLite DB likely because the SQLite database seems uses the big-endian storage.
--- ras-cxl-handler.c | 151 ++++++++++++++++++++++++++++++++++++++++++++++ ras-cxl-handler.h | 4 ++ ras-events.c | 9 +++ ras-events.h | 1 + ras-record.c | 67 ++++++++++++++++++++ ras-record.h | 18 ++++++ ras-report.c | 73 ++++++++++++++++++++++ ras-report.h | 2 + 8 files changed, 325 insertions(+)
ras-cxl-handler.c +151 -0
@@ -21,6 +21,7 @@#include "ras-record.h" #include "ras-logger.h" #include "ras-report.h" +#include <endian.h> /* Poison List: Payload out flags */ #define CXL_POISON_FLAG_MORE BIT(0)
@@ -192,3 +193,153 @@ int ras_cxl_poison_event_handler(struct trace_seq *s,return 0 ; } + +/* CXL AER Errors */ + +#define CXL_AER_UE_CACHE_DATA_PARITY BIT(0) +#define CXL_AER_UE_CACHE_ADDR_PARITY BIT(1) +#define CXL_AER_UE_CACHE_BE_PARITY BIT(2) +#define CXL_AER_UE_CACHE_DATA_ECC BIT(3) +#define CXL_AER_UE_MEM_DATA_PARITY BIT(4) +#define CXL_AER_UE_MEM_ADDR_PARITY BIT(5) +#define CXL_AER_UE_MEM_BE_PARITY BIT(6) +#define CXL_AER_UE_MEM_DATA_ECC BIT(7) +#define CXL_AER_UE_REINIT_THRESH BIT(8) +#define CXL_AER_UE_RSVD_ENCODE BIT(9) +#define CXL_AER_UE_POISON BIT(10) +#define CXL_AER_UE_RECV_OVERFLOW BIT(11) +#define CXL_AER_UE_INTERNAL_ERR BIT(14) +#define CXL_AER_UE_IDE_TX_ERR BIT(15) +#define CXL_AER_UE_IDE_RX_ERR BIT(16) + +struct cxl_error_list { +uint32_t bit; +const char *error; +}; + +static const struct cxl_error_list cxl_aer_ue[] = { + { .bit =CXL_AER_UE_CACHE_DATA_PARITY , .error ="Cache Data Parity Error" }, + { .bit =CXL_AER_UE_CACHE_ADDR_PARITY , .error ="Cache Address Parity Error" }, + { .bit =CXL_AER_UE_CACHE_BE_PARITY , .error ="Cache Byte Enable Parity Error" }, + { .bit =CXL_AER_UE_CACHE_DATA_ECC , .error ="Cache Data ECC Error" }, + { .bit =CXL_AER_UE_MEM_DATA_PARITY , .error ="Memory Data Parity Error" }, + { .bit =CXL_AER_UE_MEM_ADDR_PARITY , .error ="Memory Address Parity Error" }, + { .bit =CXL_AER_UE_MEM_BE_PARITY , .error ="Memory Byte Enable Parity Error" }, + { .bit =CXL_AER_UE_MEM_DATA_ECC , .error ="Memory Data ECC Error" }, + { .bit =CXL_AER_UE_REINIT_THRESH , .error ="REINIT Threshold Hit" }, + { .bit =CXL_AER_UE_RSVD_ENCODE , .error ="Received Unrecognized Encoding" }, + { .bit =CXL_AER_UE_POISON , .error ="Received Poison From Peer" }, + { .bit =CXL_AER_UE_RECV_OVERFLOW , .error ="Receiver Overflow" }, + { .bit =CXL_AER_UE_INTERNAL_ERR , .error ="Component Specific Error" }, + { .bit =CXL_AER_UE_IDE_TX_ERR , .error ="IDE Tx Error" }, + { .bit =CXL_AER_UE_IDE_RX_ERR , .error ="IDE Rx Error" }, +}; + +static int decode_cxl_error_status (struct trace_seq *s,uint32_t status, +const struct cxl_error_list *cxl_error_list, +uint8_t num_elems) +{ +int i; + +for (i =0 ; i < num_elems; i++) { +if (status & cxl_error_list[i].bit) +if (trace_seq_printf (s,"\'%s\' " , cxl_error_list[i].error) <=0 ) +return -1 ; + } +return 0 ; +} + +int ras_cxl_aer_ue_event_handler (struct trace_seq *s, +struct tep_record *record, +struct tep_event *event,void *context) +{ +int len, i; +unsigned long long val; +time_t now; +struct tm *tm; +struct ras_events *ras = context; +struct ras_cxl_aer_ue_event ev; + +memset (&ev,0 ,sizeof (ev)); + now = record->ts / user_hz + ras->uptime_diff; + tm =localtime (&now); +if (tm) +strftime (ev.timestamp,sizeof (ev.timestamp), +"%Y-%m-%d %H:%M:%S %z" , tm); +else +strncpy (ev.timestamp,"1970-01-01 00:00:00 +0000" ,sizeof (ev.timestamp)); +if (trace_seq_printf (s,"%s " , ev.timestamp) <=0 ) +return -1 ; + + ev.memdev =tep_get_field_raw (s, event,"memdev" , + record, &len,1 ); +if (!ev.memdev) +return -1 ; +if (trace_seq_printf (s,"memdev:%s " , ev.memdev) <=0 ) +return -1 ; + + ev.host =tep_get_field_raw (s, event,"host" , + record, &len,1 ); +if (!ev.host) +return -1 ; +if (trace_seq_printf (s,"host:%s " , ev.host) <=0 ) +return -1 ; + +if (tep_get_field_val (s, event,"serial" , record, &val,1 ) <0 ) +return -1 ; + ev.serial = val; +if (trace_seq_printf (s,"serial:0x%llx " , (unsigned long long )ev.serial) <=0 ) +return -1 ; + +if (tep_get_field_val (s, event,"status" , record, &val,1 ) <0 ) +return -1 ; + ev.error_status = val; + +if (trace_seq_printf (s,"error status:" ) <=0 ) +return -1 ; +if (decode_cxl_error_status (s, ev.error_status, + cxl_aer_ue,ARRAY_SIZE (cxl_aer_ue)) <0 ) +return -1 ; + +if (tep_get_field_val (s, event,"first_error" , record, &val,1 ) <0 ) +return -1 ; + ev.first_error = val; + +if (trace_seq_printf (s,"first error:" ) <=0 ) +return -1 ; +if (decode_cxl_error_status (s, ev.first_error, + cxl_aer_ue,ARRAY_SIZE (cxl_aer_ue)) <0 ) +return -1 ; + + ev.header_log =tep_get_field_raw (s, event,"header_log" , + record, &len,1 ); +if (!ev.header_log) +return -1 ; +if (trace_seq_printf (s,"header log:\n" ) <=0 ) +return -1 ; +for (i =0 ; i <CXL_HEADERLOG_SIZE_U32 ; i++) { +if (trace_seq_printf (s,"%08x " , ev.header_log[i]) <=0 ) +break ; +if ((i >0 ) && ((i %20 ) ==0 )) +if (trace_seq_printf (s,"\n" ) <=0 ) +break ; +/* Convert header log data to the big-endian format because +* the SQLite database seems uses the big-endian storage. +*/ + ev.header_log[i] =htobe32 (ev.header_log[i]); + } +if (i <CXL_HEADERLOG_SIZE_U32 ) +return -1 ; + +/* Insert data into the SGBD */ +#ifdef HAVE_SQLITE3 +ras_store_cxl_aer_ue_event (ras, &ev); +#endif + +#ifdef HAVE_ABRT_REPORT +/* Report event to ABRT */ +ras_report_cxl_aer_ue_event (ras, &ev); +#endif + +return 0 ; +}
ras-cxl-handler.h +4 -0
@@ -21,4 +21,8 @@int ras_cxl_poison_event_handler (struct trace_seq *s,struct tep_record *record,struct tep_event *event,void *context); + +int ras_cxl_aer_ue_event_handler (struct trace_seq *s, +struct tep_record *record, +struct tep_event *event,void *context);#endif
ras-events.c +9 -0
@@ -246,6 +246,7 @@ int toggle_ras_mc_event(int enable)#ifdef HAVE_CXL rc |=__toggle_ras_mc_event (ras,"cxl" ,"cxl_poison" , enable); + rc |=__toggle_ras_mc_event (ras,"cxl" ,"cxl_aer_uncorrectable_error" , enable);#endif free_ras:
@@ -986,6 +987,14 @@ int handle_ras_events(int record_events) else log(ALL, LOG_ERR, "Can't get traces from %s:%s\n", "cxl", "cxl_poison"); + + rc =add_event_handler (ras, pevent, page_size,"cxl" ,"cxl_aer_uncorrectable_error" , + ras_cxl_aer_ue_event_handler,NULL ,CXL_AER_UE_EVENT ); +if (!rc) + num_events++; +else +log (ALL ,LOG_ERR ,"Can't get traces from %s:%s\n" , +"cxl" ,"cxl_aer_uncorrectable_error" );#endif if (!num_events) {
ras-events.h +1 -0
@@ -40,6 +40,7 @@ enum {DISKERROR_EVENT ,MF_EVENT ,CXL_POISON_EVENT , +CXL_AER_UE_EVENT , NR_EVENTS };
ras-record.c +67 -0
85 lines not on this page · raw message
ras-record.h +18 -0
@@ -130,6 +130,20 @@ struct ras_cxl_poison_event {char overflow_ts[64 ]; }; +#define SZ_512 0x200 +#define CXL_HEADERLOG_SIZE SZ_512 +#define CXL_HEADERLOG_SIZE_U32 (SZ_512 / sizeof(uint32_t)) + +struct ras_cxl_aer_ue_event { +char timestamp[64 ]; +const char *memdev; +const char *host; +uint64_t serial; +uint32_t error_status; +uint32_t first_error; +uint32_t *header_log; +}; +struct ras_mc_event ;struct ras_aer_event ;struct ras_extlog_event ;
@@ -140,6 +154,7 @@ struct devlink_event;struct diskerror_event ;struct ras_mf_event ;struct ras_cxl_poison_event ; +struct ras_cxl_aer_ue_event ;#ifdef HAVE_SQLITE3
@@ -174,6 +189,7 @@ struct sqlite3_priv {#endif #ifdef HAVE_CXL sqlite3_stmt *stmt_cxl_poison_event; +sqlite3_stmt *stmt_cxl_aer_ue_event;#endif };
@@ -203,6 +219,7 @@ 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);int ras_store_cxl_poison_event (struct ras_events *ras,struct ras_cxl_poison_event *ev); +int ras_store_cxl_aer_ue_event (struct ras_events *ras,struct ras_cxl_aer_ue_event *ev);#else static inline int ras_mc_event_opendb (unsigned cpu,struct ras_events *ras) {return 0 ; };
@@ -217,6 +234,7 @@ static inline int ras_store_devlink_event(struct ras_events *ras, struct devlinkstatic 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 ; };static inline int ras_store_cxl_poison_event (struct ras_events *ras,struct ras_cxl_poison_event *ev) {return 0 ; }; +static inline int ras_store_cxl_aer_ue_event (struct ras_events *ras,struct ras_cxl_aer_ue_event *ev) {return 0 ; };#endif
ras-report.c +73 -0
88 lines not on this page · raw message
ras-report.h +2 -0
@@ -40,6 +40,7 @@ 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);int ras_report_cxl_poison_event (struct ras_events *ras,struct ras_cxl_poison_event *ev); +int ras_report_cxl_aer_ue_event (struct ras_events *ras,struct ras_cxl_aer_ue_event *ev);#else
@@ -52,6 +53,7 @@ static inline int ras_report_devlink_event(struct ras_events *ras, struct devlinstatic 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 ; };static inline int ras_report_cxl_poison_event (struct ras_events *ras,struct ras_cxl_poison_event *ev) {return 0 ; }; +static inline int ras_report_cxl_aer_ue_event (struct ras_events *ras,struct ras_cxl_aer_ue_event *ev) {return 0 ; };#endif
Signature · 1 line
2.25.1
PATCH v6 4/4 rasdaemon: Add support for the CXL AER correctable errors
In reply to [email protected]From: Shiju Jose <[email protected]>
Add support to log and record the CXL AER correctable errors.
The corresponding Kernel patches are here:
https://lore.kernel.org/linux-cxl/166974401763.1608150.5424589924034481387.stgit@djiang5-desk3.ch.intel.com/T/#t
https://lore.kernel.org/linux-cxl/[email protected]/T/#t
--- ras-cxl-handler.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++ ras-cxl-handler.h | 4 +++ ras-events.c | 9 ++++++ ras-events.h | 1 + ras-record.c | 63 ++++++++++++++++++++++++++++++++++++ ras-record.h | 12 +++++++ ras-report.c | 71 +++++++++++++++++++++++++++++++++++++++++ ras-report.h | 2 ++ 8 files changed, 243 insertions(+)
ras-cxl-handler.c +81 -0
@@ -212,6 +212,14 @@ int ras_cxl_poison_event_handler(struct trace_seq *s,#define CXL_AER_UE_IDE_TX_ERR BIT(15)#define CXL_AER_UE_IDE_RX_ERR BIT(16) +#define CXL_AER_CE_CACHE_DATA_ECC BIT(0) +#define CXL_AER_CE_MEM_DATA_ECC BIT(1) +#define CXL_AER_CE_CRC_THRESH BIT(2) +#define CXL_AER_CE_RETRY_THRESH BIT(3) +#define CXL_AER_CE_CACHE_POISON BIT(4) +#define CXL_AER_CE_MEM_POISON BIT(5) +#define CXL_AER_CE_PHYS_LAYER_ERR BIT(6) +struct cxl_error_list {uint32_t bit;const char *error;
@@ -235,6 +243,16 @@ static const struct cxl_error_list cxl_aer_ue[] = { { .bit = CXL_AER_UE_IDE_RX_ERR, .error = "IDE Rx Error" }, }; +static const struct cxl_error_list cxl_aer_ce[] = { + { .bit =CXL_AER_CE_CACHE_DATA_ECC , .error ="Cache Data ECC Error" }, + { .bit =CXL_AER_CE_MEM_DATA_ECC , .error ="Memory Data ECC Error" }, + { .bit =CXL_AER_CE_CRC_THRESH , .error ="CRC Threshold Hit" }, + { .bit =CXL_AER_CE_RETRY_THRESH , .error ="Retry Threshold" }, + { .bit =CXL_AER_CE_CACHE_POISON , .error ="Received Cache Poison From Peer" }, + { .bit =CXL_AER_CE_MEM_POISON , .error ="Received Memory Poison From Peer" }, + { .bit =CXL_AER_CE_PHYS_LAYER_ERR , .error ="Received Error From Physical Layer" }, +}; +static int decode_cxl_error_status (struct trace_seq *s,uint32_t status,const struct cxl_error_list *cxl_error_list,uint8_t num_elems)
@@ -343,3 +361,66 @@ int ras_cxl_aer_ue_event_handler(struct trace_seq *s,return 0 ; } + +int ras_cxl_aer_ce_event_handler (struct trace_seq *s, +struct tep_record *record, +struct tep_event *event,void *context) +{ +int len; +unsigned long long val; +time_t now; +struct tm *tm; +struct ras_events *ras = context; +struct ras_cxl_aer_ce_event ev; + + now = record->ts / user_hz + ras->uptime_diff; + tm =localtime (&now); +if (tm) +strftime (ev.timestamp,sizeof (ev.timestamp), +"%Y-%m-%d %H:%M:%S %z" , tm); +else +strncpy (ev.timestamp,"1970-01-01 00:00:00 +0000" ,sizeof (ev.timestamp)); +if (trace_seq_printf (s,"%s " , ev.timestamp) <=0 ) +return -1 ; + + ev.memdev =tep_get_field_raw (s, event,"memdev" , + record, &len,1 ); +if (!ev.memdev) +return -1 ; +if (trace_seq_printf (s,"memdev:%s " , ev.memdev) <=0 ) +return -1 ; + + ev.host =tep_get_field_raw (s, event,"host" , + record, &len,1 ); +if (!ev.host) +return -1 ; +if (trace_seq_printf (s,"host:%s " , ev.host) <=0 ) +return -1 ; + +if (tep_get_field_val (s, event,"serial" , record, &val,1 ) <0 ) +return -1 ; + ev.serial = val; +if (trace_seq_printf (s,"serial:0x%llx " , (unsigned long long )ev.serial) <=0 ) +return -1 ; + +if (tep_get_field_val (s, event,"status" , record, &val,1 ) <0 ) +return -1 ; + ev.error_status = val; +if (trace_seq_printf (s,"error status:" ) <=0 ) +return -1 ; +if (decode_cxl_error_status (s, ev.error_status, + cxl_aer_ce,ARRAY_SIZE (cxl_aer_ce)) <0 ) +return -1 ; + +/* Insert data into the SGBD */ +#ifdef HAVE_SQLITE3 +ras_store_cxl_aer_ce_event (ras, &ev); +#endif + +#ifdef HAVE_ABRT_REPORT +/* Report event to ABRT */ +ras_report_cxl_aer_ce_event (ras, &ev); +#endif + +return 0 ; +}
ras-cxl-handler.h +4 -0
@@ -25,4 +25,8 @@ int ras_cxl_poison_event_handler(struct trace_seq *s,int ras_cxl_aer_ue_event_handler (struct trace_seq *s,struct tep_record *record,struct tep_event *event,void *context); + +int ras_cxl_aer_ce_event_handler (struct trace_seq *s, +struct tep_record *record, +struct tep_event *event,void *context);#endif
ras-events.c +9 -0
@@ -247,6 +247,7 @@ int toggle_ras_mc_event(int enable)#ifdef HAVE_CXL rc |=__toggle_ras_mc_event (ras,"cxl" ,"cxl_poison" , enable); rc |=__toggle_ras_mc_event (ras,"cxl" ,"cxl_aer_uncorrectable_error" , enable); + rc |=__toggle_ras_mc_event (ras,"cxl" ,"cxl_aer_correctable_error" , enable);#endif free_ras:
@@ -995,6 +996,14 @@ int handle_ras_events(int record_events) else log(ALL, LOG_ERR, "Can't get traces from %s:%s\n", "cxl", "cxl_aer_uncorrectable_error"); + + rc =add_event_handler (ras, pevent, page_size,"cxl" ,"cxl_aer_correctable_error" , + ras_cxl_aer_ce_event_handler,NULL ,CXL_AER_CE_EVENT ); +if (!rc) + num_events++; +else +log (ALL ,LOG_ERR ,"Can't get traces from %s:%s\n" , +"cxl" ,"cxl_aer_correctable_error" );#endif if (!num_events) {
ras-events.h +1 -0
@@ -41,6 +41,7 @@ enum {MF_EVENT ,CXL_POISON_EVENT ,CXL_AER_UE_EVENT , +CXL_AER_CE_EVENT , NR_EVENTS };
ras-record.c +63 -0
81 lines not on this page · raw message
ras-record.h +12 -0
@@ -144,6 +144,14 @@ struct ras_cxl_aer_ue_event {uint32_t *header_log; }; +struct ras_cxl_aer_ce_event { +char timestamp[64 ]; +const char *memdev; +const char *host; +uint64_t serial; +uint32_t error_status; +}; +struct ras_mc_event ;struct ras_aer_event ;struct ras_extlog_event ;
@@ -155,6 +163,7 @@ struct diskerror_event;struct ras_mf_event ;struct ras_cxl_poison_event ;struct ras_cxl_aer_ue_event ; +struct ras_cxl_aer_ce_event ;#ifdef HAVE_SQLITE3
@@ -190,6 +199,7 @@ struct sqlite3_priv {#ifdef HAVE_CXL sqlite3_stmt *stmt_cxl_poison_event;sqlite3_stmt *stmt_cxl_aer_ue_event; +sqlite3_stmt *stmt_cxl_aer_ce_event;#endif };
@@ -220,6 +230,7 @@ int ras_store_diskerror_event(struct ras_events *ras, struct diskerror_event *evint ras_store_mf_event (struct ras_events *ras,struct ras_mf_event *ev);int ras_store_cxl_poison_event (struct ras_events *ras,struct ras_cxl_poison_event *ev);int ras_store_cxl_aer_ue_event (struct ras_events *ras,struct ras_cxl_aer_ue_event *ev); +int ras_store_cxl_aer_ce_event (struct ras_events *ras,struct ras_cxl_aer_ce_event *ev);#else static inline int ras_mc_event_opendb (unsigned cpu,struct ras_events *ras) {return 0 ; };
@@ -235,6 +246,7 @@ static inline int ras_store_diskerror_event(struct ras_events *ras, struct diskestatic inline int ras_store_mf_event (struct ras_events *ras,struct ras_mf_event *ev) {return 0 ; };static inline int ras_store_cxl_poison_event (struct ras_events *ras,struct ras_cxl_poison_event *ev) {return 0 ; };static inline int ras_store_cxl_aer_ue_event (struct ras_events *ras,struct ras_cxl_aer_ue_event *ev) {return 0 ; }; +static inline int ras_store_cxl_aer_ce_event (struct ras_events *ras,struct ras_cxl_aer_ce_event *ev) {return 0 ; };#endif
ras-report.c +71 -0
86 lines not on this page · raw message
ras-report.h +2 -0
@@ -41,6 +41,7 @@ int ras_report_diskerror_event(struct ras_events *ras, struct diskerror_event *eint ras_report_mf_event (struct ras_events *ras,struct ras_mf_event *ev);int ras_report_cxl_poison_event (struct ras_events *ras,struct ras_cxl_poison_event *ev);int ras_report_cxl_aer_ue_event (struct ras_events *ras,struct ras_cxl_aer_ue_event *ev); +int ras_report_cxl_aer_ce_event (struct ras_events *ras,struct ras_cxl_aer_ce_event *ev);#else
@@ -54,6 +55,7 @@ static inline int ras_report_diskerror_event(struct ras_events *ras, struct diskstatic inline int ras_report_mf_event (struct ras_events *ras,struct ras_mf_event *ev) {return 0 ; };static inline int ras_report_cxl_poison_event (struct ras_events *ras,struct ras_cxl_poison_event *ev) {return 0 ; };static inline int ras_report_cxl_aer_ue_event (struct ras_events *ras,struct ras_cxl_aer_ue_event *ev) {return 0 ; }; +static inline int ras_report_cxl_aer_ce_event (struct ras_events *ras,struct ras_cxl_aer_ce_event *ev) {return 0 ; };#endif
Signature · 1 line
2.25.1
Hi All,
Pull request has submitted for this series.
https://github.com/mchehab/rasdaemon/pull/96
Thanks,
Shiju
-----Original Message-----
From: Shiju Jose <[email protected]>
Sent: 31 March 2023 14:44
To: [email protected]; [email protected]; [email protected]
Cc: Jonathan Cameron <[email protected]>; Linuxarm <[email protected]>; Shiju Jose <[email protected]>
Subject: [PATCH V6 0/4] rasdaemon: Add support for the CXL error events
From: Shiju Jose <[email protected]>
Log and record the following CXL error records reported through the kernel trace events. CXL poison errors, CXL AER uncorrectable errors and CXL AER correctable errors.
Shiju Jose (4):
rasdaemon: Move definition for BIT and BIT_ULL to a common file
rasdaemon: Add support for the CXL poison events
rasdaemon: Add support for the CXL AER uncorrectable errors
rasdaemon: Add support for the CXL AER correctable errors
Changes:
V5 -> V6
1. Following modification in the CXL poison due to changes in the kernel patches for the cxl_poison.
- length -> dpa_length
- add field trace_type
V4 -> V5
1. Add logging of device serial number for the CXL AER uncorrectable and CXL AER correctable errors.
2. Rebased.
3. Updated the patches description.
V3 -> V4
1. Modification for the changes in the kernel patches
a) https://lore.kernel.org/lkml/[email protected]/
b) https://lore.kernel.org/linux-cxl/[email protected]/T/#t
V2 -> V3
1. Fix for the comments from Dave Jiang.
RFC V1 -> V2
1. Rename uuid to region_uuid in the log and SQLite DB.
2. Rebase to the latest rasdaemon code.
3. Modify to match the name changes of interface structures and functions in the latest libtraceevent-dev, use in the rasdaemon.
Makefile.am | 7 +- configure.ac | 11 + ras-cxl-handler.c | 426 +++++++++++++++++++++++++++++++++++++ ras-cxl-handler.h | 32 +++ ras-events.c | 33 +++ ras-events.h | 3 + ras-non-standard-handler.h | 3 - ras-record.c | 215 +++++++++++++++++++ ras-record.h | 55 +++++ ras-report.c | 231 ++++++++++++++++++++ ras-report.h | 6 + 11 files changed, 1018 insertions(+), 4 deletions(-) create mode 100644 ras-cxl-handler.c create mode 100644 ras-cxl-handler.h
--
2.25.1