rasdaemon: ras-events: Adapt to kernel v6.19 memory-failure trace event directory change
PATCH 1/1 rasdaemon: ras-events: Adapt to kernel v6.19 memory-failure trace event directory change
Kernel v6.19 moves memory_failure_event from the "ras" trace event group to a separate "memory_failure" group, as the event's TRACE_SYSTEM changed from "ras" to "memory_failure". This changes the tracefs path from events/ras/memory_failure_event to events/memory_failure/memory_failure_event.
Add get_memory_failure_group_name() to dynamically detect which path exists, ensuring backward compatibility with older kernels that still use the "ras" group.
kernel commit:
https://lore.kernel.org/all/[email protected]/
--- ras-events.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-)
ras-events.c +21 -3
@@ -66,6 +66,20 @@ static const struct event_trigger event_triggers[] = {#endif }; +#ifdef HAVE_MEMORY_FAILURE +static const char *get_memory_failure_group_name (struct ras_events *ras) +{ +char fname[MAX_PATH +1 ]; + +snprintf (fname,sizeof (fname),"%s/events/memory_failure/memory_failure_event" , + ras->tracing); +if (access (fname,F_OK ) ==0 ) +return "memory_failure" ; + +return "ras" ;/* fallback to old path */ +} +#endif +static int get_mountdir_by_type (char *mount_type,char *tracing_dir,size_t len) {FILE *fp;
@@ -325,7 +339,9 @@ int toggle_ras_mc_event(int enable)#endif #ifdef HAVE_MEMORY_FAILURE - rc |=__toggle_ras_mc_event (ras,"ras" ,"memory_failure_event" , enable); +const char *group =get_memory_failure_group_name (ras); + + rc |=__toggle_ras_mc_event (ras, group,"memory_failure_event" , enable);#endif #ifdef HAVE_CXL
@@ -1166,13 +1182,15 @@ int handle_ras_events(int record_events, int enable_ipmitool)#endif #ifdef HAVE_MEMORY_FAILURE - rc =add_event_handler (ras, pevent, page_size,"ras" ,"memory_failure_event" , +const char *group =get_memory_failure_group_name (ras); + + rc =add_event_handler (ras, pevent, page_size, group,"memory_failure_event" , ras_memory_failure_event_handler,NULL ,MF_EVENT );if (!rc) num_events++;else if (rc !=EVENT_DISABLED )log (ALL ,LOG_ERR ,"Can't get traces from %s:%s\n" , -"ras" ,"memory_failure_event" ); + group,"memory_failure_event" );#endif #ifdef HAVE_CXL
Signature · 1 line
2.33.0
Quoted 6 lines · Junhao He
Kernel v6.19 moves
memory_failure_eventfrom the "ras" trace event group to a separate "memory_failure" group, as the event'sTRACE_SYSTEMchanged from "ras" to "memory_failure". This changes the tracefs path from events/ras/memory_failure_event to events/memory_failure/memory_failure_event.
Quoted 6 lines
Add
get_memory_failure_group_name()to dynamically detect which path exists, ensuring backward compatibility with older kernels that still use the "ras" group.kernel commit:
https://lore.kernel.org/all/[email protected]/
Can this patch solve your problem?