File rasdaemon-skip-doesn-t-exist-event.patch of Package rasdaemon
From: Ruidong Tian <tianruidong@linux.alibaba.com>
Subject: rasdaemon: skip doesn't exist event
References: jsc#1241567
Patch-Mainline:
Git-commit: 3615602544e47240ddb5784342ed51ea14213ca9
When compiling rasdaemon with the --enable-all configuration flag,
the system may detect unsupported hardware events - for instance,
ARM-specific events on x86 architectures. This causes the program
to enter a busy-wait loop in the wait_access function. A better
approach would be to explicitly skip these architecture-mismatched
events during initialization.
Signed-off-by: Ruidong Tian <tianruidong@linux.alibaba.com>
Signed-off-by: <trenn@suse.de>
diff --git a/ras-events.c b/ras-events.c
index c7ee801..46ae519 100644
--- a/ras-events.c
+++ b/ras-events.c
@@ -821,6 +821,18 @@ static int select_tracing_timestamp(struct ras_events *ras)
return 0;
}
+static bool check_event_exist(struct ras_events *ras, char *group, char *event)
+{
+ char fname[MAX_PATH + 256];
+
+ snprintf(fname, sizeof(fname), "%s/tracing/events/%s/%s",
+ ras->debugfs, group, event);
+ if (access(fname, F_OK) == 0)
+ return true;
+
+ return false;
+}
+
#define EVENT_DISABLED 1
static int add_event_handler(struct ras_events *ras, struct tep_handle *pevent,
@@ -832,6 +844,12 @@ static int add_event_handler(struct ras_events *ras, struct tep_handle *pevent,
char *page, fname[MAX_PATH + 1];
struct tep_event_filter *filter = NULL;
+ if (!check_event_exist(ras, group, event)) {
+ log(ALL, LOG_WARNING, "%s:%s event not exist\n",
+ group, event);
+ return -EINVAL;
+ }
+
snprintf(fname, sizeof(fname), "events/%s/%s/format", group, event);
fd = open_trace(ras, fname, O_RDONLY);