[PATCH] trace: trace_events: allow multiple modules

From: Andrei-Alexandru Tachici

Date: Mon Mar 02 2026 - 05:41:16 EST


Currently when multiple modules will be specified at boot
time in "kernel.trace_event=" only the last entry will
have trace events enabled.

Reconstruct through multiple setup calls the whole array
in bootup_event_buf in order to be parsed correctly by
early_enable_events().

Signed-off-by: Andrei-Alexandru Tachici <andrei-alexandru.tachici@xxxxxxxxxxxxxxxx>
---
Currently when multiple modules will be specified at boot
time in "kernel.trace_event=" only the last entry will
have trace events enabled.

Reconstruct through multiple setup calls the whole array
in bootup_event_buf in order to be parsed correctly by
early_enable_events().

Example bellow of a bootconfig:

kernel.trace_event = ":mod:rproc_qcom_common", ":mod:qrtr", ":mod:qcom_aoss"

Without the patch for the above only qcom_aoss would have
events enabled and debugging multiple modules that are
inserted at boot time would not be possible.
---
kernel/trace/trace_events.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 9928da636c9d..b07325e8b19a 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -4491,7 +4491,11 @@ static char bootup_event_buf[COMMAND_LINE_SIZE] __initdata;

static __init int setup_trace_event(char *str)
{
- strscpy(bootup_event_buf, str, COMMAND_LINE_SIZE);
+ if (bootup_event_buf[0] != '\0')
+ strlcat(bootup_event_buf, ",", COMMAND_LINE_SIZE);
+
+ strlcat(bootup_event_buf, str, COMMAND_LINE_SIZE);
+
trace_set_ring_buffer_expanded(NULL);
disable_tracing_selftest("running event tracing");


---
base-commit: a75cb869a8ccc88b0bc7a44e1597d9c7995c56e5
change-id: 20260227-trace-events-allow-multiple-modules-2253fb5531c6

Best regards,
--
Andrei-Alexandru Tachici <andrei-alexandru.tachici@xxxxxxxxxxxxxxxx>