Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tracing: Append repeated boot-time tracing parameters

Some tracing boot parameters already accept delimited value lists, but
their __setup() handlers keep only the last instance seen at boot.
Make repeated instances append to the same boot-time buffer in the
format each parser already consumes.

Use a shared trace_append_boot_param() helper for the ftrace filters,
trace_options, and kprobe_event boot parameters.

This also lets Bootconfig array values work naturally when they expand
to repeated param=value entries.

Before this change, only the last instance from each repeated
parameter survived boot.

Link: https://patch.msgid.link/20260330181103.1851230-1-atwellwea@gmail.com
Signed-off-by: Wesley Atwell <atwellwea@gmail.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

authored by

Wesley Atwell and committed by
Steven Rostedt (Google)
842b74e5 e197453e

+42 -6
+8 -4
kernel/trace/ftrace.c
··· 6841 6841 static int __init set_ftrace_notrace(char *str) 6842 6842 { 6843 6843 ftrace_filter_param = true; 6844 - strscpy(ftrace_notrace_buf, str, FTRACE_FILTER_SIZE); 6844 + trace_append_boot_param(ftrace_notrace_buf, str, ',', 6845 + FTRACE_FILTER_SIZE); 6845 6846 return 1; 6846 6847 } 6847 6848 __setup("ftrace_notrace=", set_ftrace_notrace); ··· 6850 6849 static int __init set_ftrace_filter(char *str) 6851 6850 { 6852 6851 ftrace_filter_param = true; 6853 - strscpy(ftrace_filter_buf, str, FTRACE_FILTER_SIZE); 6852 + trace_append_boot_param(ftrace_filter_buf, str, ',', 6853 + FTRACE_FILTER_SIZE); 6854 6854 return 1; 6855 6855 } 6856 6856 __setup("ftrace_filter=", set_ftrace_filter); ··· 6863 6861 6864 6862 static int __init set_graph_function(char *str) 6865 6863 { 6866 - strscpy(ftrace_graph_buf, str, FTRACE_FILTER_SIZE); 6864 + trace_append_boot_param(ftrace_graph_buf, str, ',', 6865 + FTRACE_FILTER_SIZE); 6867 6866 return 1; 6868 6867 } 6869 6868 __setup("ftrace_graph_filter=", set_graph_function); 6870 6869 6871 6870 static int __init set_graph_notrace_function(char *str) 6872 6871 { 6873 - strscpy(ftrace_graph_notrace_buf, str, FTRACE_FILTER_SIZE); 6872 + trace_append_boot_param(ftrace_graph_notrace_buf, str, ',', 6873 + FTRACE_FILTER_SIZE); 6874 6874 return 1; 6875 6875 } 6876 6876 __setup("ftrace_graph_notrace=", set_graph_notrace_function);
+30 -1
kernel/trace/trace.c
··· 221 221 static char boot_instance_info[COMMAND_LINE_SIZE] __initdata; 222 222 static int boot_instance_index; 223 223 224 + /* 225 + * Repeated boot parameters, including Bootconfig array expansions, need 226 + * to stay in the delimiter form that the existing parser consumes. 227 + */ 228 + void __init trace_append_boot_param(char *buf, const char *str, char sep, 229 + int size) 230 + { 231 + int len, needed, str_len; 232 + 233 + if (!*str) 234 + return; 235 + 236 + len = strlen(buf); 237 + str_len = strlen(str); 238 + needed = len + str_len + 1; 239 + 240 + /* For continuation, account for the separator. */ 241 + if (len) 242 + needed++; 243 + if (needed > size) 244 + return; 245 + 246 + if (len) 247 + buf[len++] = sep; 248 + 249 + strscpy(buf + len, str, size - len); 250 + } 251 + 224 252 static int __init set_cmdline_ftrace(char *str) 225 253 { 226 254 strscpy(bootup_tracer_buf, str, MAX_TRACER_SIZE); ··· 318 290 319 291 static int __init set_trace_boot_options(char *str) 320 292 { 321 - strscpy(trace_boot_options_buf, str, MAX_TRACER_SIZE); 293 + trace_append_boot_param(trace_boot_options_buf, str, ',', 294 + MAX_TRACER_SIZE); 322 295 return 1; 323 296 } 324 297 __setup("trace_options=", set_trace_boot_options);
+2
kernel/trace/trace.h
··· 905 905 #define DYN_FTRACE_TEST_NAME2 trace_selftest_dynamic_test_func2 906 906 extern int DYN_FTRACE_TEST_NAME2(void); 907 907 908 + void __init trace_append_boot_param(char *buf, const char *str, 909 + char sep, int size); 908 910 extern void trace_set_ring_buffer_expanded(struct trace_array *tr); 909 911 extern bool tracing_selftest_disabled; 910 912
+2 -1
kernel/trace/trace_kprobe.c
··· 31 31 32 32 static int __init set_kprobe_boot_events(char *str) 33 33 { 34 - strscpy(kprobe_boot_events_buf, str, COMMAND_LINE_SIZE); 34 + trace_append_boot_param(kprobe_boot_events_buf, str, ';', 35 + COMMAND_LINE_SIZE); 35 36 disable_tracing_selftest("running kprobe events"); 36 37 37 38 return 1;