From: Junhao He <hejunhao3@h-partners.com>
To: <linux-edac@vger.kernel.org>, <mchehab+huawei@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <tony.luck@intel.com>,
<shijujose2008@gmail.com>, <xueshuai@linux.alibaba.com>,
<tanxiaofei@huawei.com>, <xieyuanbin1@huawei.com>,
<linuxarm@huawei.com>, <hejunhao3@h-partners.com>
Subject: [PATCH] rasdaemon: ras-events: Adapt to kernel v6.19 memory-failure trace event directory change
Date: Thu, 27 Aug 2026 12:06:41 +0800 [thread overview]
Message-ID: <20260827040641.25143-1-hejunhao3@h-partners.com> (raw)
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/20251119095943.67125-1-xieyuanbin1@huawei.com/
Signed-off-by: Junhao He <hejunhao3@h-partners.com>
---
ras-events.c | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/ras-events.c b/ras-events.c
index ab2dd51..229ea93 100644
--- a/ras-events.c
+++ b/ras-events.c
@@ -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
--
2.33.0
next reply other threads:[~2026-08-27 4:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 4:06 Junhao He [this message]
2026-08-27 9:17 ` [PATCH] rasdaemon: ras-events: Adapt to kernel v6.19 memory-failure trace event directory change Xie Yuanbin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260827040641.25143-1-hejunhao3@h-partners.com \
--to=hejunhao3@h-partners.com \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=mchehab+huawei@kernel.org \
--cc=shijujose2008@gmail.com \
--cc=tanxiaofei@huawei.com \
--cc=tony.luck@intel.com \
--cc=xieyuanbin1@huawei.com \
--cc=xueshuai@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox