From 2f13964b436912ef1b22ba8b946ad1355159c13d Mon Sep 17 00:00:00 2001 From: Valentin Schneider Date: Wed, 2 Sep 2026 14:39:34 +0200 Subject: [PATCH] rtla: Make struct trace_events double linked The events list is currently a single linked list. New events are prepended to the list, making them the new head. This makes it easy to fetch the last-defined event when handling trigger and filter options on the cmdline, as they apply to the last-defined event, but means the events are then processed in LIFO order with regards to the command line order. To prepare for processing the events in the user-defined order, make the events list double linked. Signed-off-by: Valentin Schneider Link: https://lore.kernel.org/r/20260902123942.695822-6-vschneid@redhat.com [ capital letter in commit message ] Signed-off-by: Tomas Glozar --- tools/tracing/rtla/src/cli_p.h | 4 +++- tools/tracing/rtla/src/trace.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/tracing/rtla/src/cli_p.h b/tools/tracing/rtla/src/cli_p.h index f2dd7c610093..7e3a713f97c6 100644 --- a/tools/tracing/rtla/src/cli_p.h +++ b/tools/tracing/rtla/src/cli_p.h @@ -394,8 +394,10 @@ static int opt_event_cb(const struct option *opt, const char *arg, int unset) if (!tevent) fatal("Error alloc trace event"); - if (*events) + if (*events) { tevent->next = *events; + (*events)->prev = tevent; + } *events = tevent; return 0; diff --git a/tools/tracing/rtla/src/trace.h b/tools/tracing/rtla/src/trace.h index 715a3616fe45..94e4510db2d1 100644 --- a/tools/tracing/rtla/src/trace.h +++ b/tools/tracing/rtla/src/trace.h @@ -4,6 +4,7 @@ struct trace_events { struct trace_events *next; + struct trace_events *prev; char *system; char *event; char *filter;