tracing: Updates for v7.1
cover tracing: Updates for v7.1
git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace/for-next
Head SHA1: 8053f49fed581c40fcc87fa54904f4fa473f46b7
Steven Rostedt (1):
tracing: Remove duplicate latency_fsnotify() stub
Wesley Atwell (2):
tracing: Append repeated boot-time tracing parameters
tracing: Preserve repeated trace_trigger boot parameters
----
kernel/trace/ftrace.c | 12 ++++++++---- kernel/trace/trace.c | 31 ++++++++++++++++++++++++++++++- kernel/trace/trace.h | 4 +++- kernel/trace/trace_events.c | 13 ++++++++++--- kernel/trace/trace_kprobe.c | 3 ++- kernel/trace/trace_snapshot.c | 3 +-- 6 files changed, 54 insertions(+), 12 deletions(-)
PATCH 1/3 tracing: Append repeated boot-time tracing parameters
From: Wesley Atwell <[email protected]>
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.
--- kernel/trace/ftrace.c | 12 ++++++++---- kernel/trace/trace.c | 31 ++++++++++++++++++++++++++++++- kernel/trace/trace.h | 2 ++ kernel/trace/trace_kprobe.c | 3 ++- 4 files changed, 42 insertions(+), 6 deletions(-)
kernel/trace/ftrace.c +8 -4
@@ -6841,7 +6841,8 @@ bool ftrace_filter_param __initdata;static int __init set_ftrace_notrace (char *str) { ftrace_filter_param = true; -strscpy (ftrace_notrace_buf, str,FTRACE_FILTER_SIZE ); +trace_append_boot_param (ftrace_notrace_buf, str,',' , +FTRACE_FILTER_SIZE );return 1 ; }__setup ("ftrace_notrace=" , set_ftrace_notrace);
@@ -6849,7 +6850,8 @@ __setup("ftrace_notrace=", set_ftrace_notrace);static int __init set_ftrace_filter (char *str) { ftrace_filter_param = true; -strscpy (ftrace_filter_buf, str,FTRACE_FILTER_SIZE ); +trace_append_boot_param (ftrace_filter_buf, str,',' , +FTRACE_FILTER_SIZE );return 1 ; }__setup ("ftrace_filter=" , set_ftrace_filter);
@@ -6861,14 +6863,16 @@ static int ftrace_graph_set_hash(struct ftrace_hash *hash, char *buffer);static int __init set_graph_function (char *str) { -strscpy (ftrace_graph_buf, str,FTRACE_FILTER_SIZE ); +trace_append_boot_param (ftrace_graph_buf, str,',' , +FTRACE_FILTER_SIZE );return 1 ; }__setup ("ftrace_graph_filter=" , set_graph_function);static int __init set_graph_notrace_function (char *str) { -strscpy (ftrace_graph_notrace_buf, str,FTRACE_FILTER_SIZE ); +trace_append_boot_param (ftrace_graph_notrace_buf, str,',' , +FTRACE_FILTER_SIZE );return 1 ; }__setup ("ftrace_graph_notrace=" , set_graph_notrace_function);
kernel/trace/trace.c +30 -1
@@ -221,6 +221,34 @@ static char *default_bootup_tracer;static char boot_instance_info[COMMAND_LINE_SIZE ]__initdata ;static int boot_instance_index; +/* +* Repeated boot parameters, including Bootconfig array expansions, need +* to stay in the delimiter form that the existing parser consumes. +*/ +void __init trace_append_boot_param (char *buf,const char *str,char sep, +int size) +{ +int len, needed, str_len; + +if (!*str) +return ; + + len =strlen (buf); + str_len =strlen (str); + needed = len + str_len +1 ; + +/* For continuation, account for the separator. */ +if (len) + needed++; +if (needed > size) +return ; + +if (len) + buf[len++] = sep; + +strscpy (buf + len, str, size - len); +} +static int __init set_cmdline_ftrace (char *str) {strscpy (bootup_tracer_buf, str,MAX_TRACER_SIZE );
@@ -290,7 +318,8 @@ static char trace_boot_options_buf[MAX_TRACER_SIZE] __initdata;static int __init set_trace_boot_options (char *str) { -strscpy (trace_boot_options_buf, str,MAX_TRACER_SIZE ); +trace_append_boot_param (trace_boot_options_buf, str,',' , +MAX_TRACER_SIZE );return 1 ; }__setup ("trace_options=" , set_trace_boot_options);
kernel/trace/trace.h +2 -0
@@ -905,6 +905,8 @@ extern int DYN_FTRACE_TEST_NAME(void);#define DYN_FTRACE_TEST_NAME2 trace_selftest_dynamic_test_func2extern int DYN_FTRACE_TEST_NAME2 (void ); +void __init trace_append_boot_param (char *buf,const char *str, +char sep,int size);extern void trace_set_ring_buffer_expanded (struct trace_array *tr);extern bool tracing_selftest_disabled;
kernel/trace/trace_kprobe.c +2 -1
@@ -31,7 +31,8 @@ static char kprobe_boot_events_buf[COMMAND_LINE_SIZE] __initdata;static int __init set_kprobe_boot_events (char *str) { -strscpy (kprobe_boot_events_buf, str,COMMAND_LINE_SIZE ); +trace_append_boot_param (kprobe_boot_events_buf, str,';' , +COMMAND_LINE_SIZE );disable_tracing_selftest ("running kprobe events" );return 1 ;
Signature · 1 line
2.51.0
PATCH 2/3 tracing: Preserve repeated trace_trigger boot parameters
In reply to Steven RostedtFrom: Wesley Atwell <[email protected]>
trace_trigger= tokenizes bootup_trigger_buf in place and stores pointers into that buffer for later trigger registration. Repeated trace_trigger= parameters overwrite the buffer contents from earlier calls, leaving only the last set of parsed event and trigger strings.
Keep each new trace_trigger= string at the end of bootup_trigger_buf and parse only the appended range. That preserves the earlier event and trigger strings while still letting repeated parameters queue additional boot-time triggers.
This also lets Bootconfig array values work naturally when they expand to repeated trace_trigger= entries.
Before this change, only the last trace_trigger= instance survived boot.
--- kernel/trace/trace_events.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
kernel/trace/trace_events.c +10 -3
@@ -3675,20 +3675,27 @@ static struct boot_triggers { } bootup_triggers[MAX_BOOT_TRIGGERS ];static char bootup_trigger_buf[COMMAND_LINE_SIZE ]; +static int boot_trigger_buf_len;static int nr_boot_triggers;static __init int setup_trace_triggers (char *str) {char *trigger;char *buf; +int len = boot_trigger_buf_len;int i; -strscpy (bootup_trigger_buf, str,COMMAND_LINE_SIZE ); +if (len >=COMMAND_LINE_SIZE ) +return 1 ; + +strscpy (bootup_trigger_buf + len, str,COMMAND_LINE_SIZE - len);trace_set_ring_buffer_expanded (NULL );disable_tracing_selftest ("running event triggers" ); - buf = bootup_trigger_buf; -for (i =0 ; i <MAX_BOOT_TRIGGERS ; i++) { + buf = bootup_trigger_buf + len; + boot_trigger_buf_len +=strlen (buf) +1 ; + +for (i = nr_boot_triggers; i <MAX_BOOT_TRIGGERS ; i++) { trigger =strsep (&buf,"," );if (!trigger)break ;
Signature · 1 line
2.51.0
PATCH 3/3 tracing: Remove duplicate latency_fsnotify() stub
In reply to Steven RostedtFrom: Steven Rostedt <[email protected]>
When the SNAPSHOT is defined but FSNOTIFY is not the latency_fsnotify() function is turned into a static inline stub. But this stub was defined in both trace.h and trace_snapshot.c causing a error in build when CONFIG_SNAPSHOT is defined but FSNOTIFY is not. The stub is not needed in trace_snapshot.c as it will be defined in trace.h, remove it from the C file.
--- kernel/trace/trace.h | 2 +- kernel/trace/trace_snapshot.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-)
kernel/trace/trace.h +1 -1
@@ -845,13 +845,13 @@ void update_max_tr_single(struct trace_array *tr,#if defined(CONFIG_TRACER_MAX_TRACE ) && defined(CONFIG_FSNOTIFY )# define LATENCY_FS_NOTIFY #endif +#endif /* CONFIG_TRACER_SNAPSHOT */ #ifdef LATENCY_FS_NOTIFY void latency_fsnotify (struct trace_array *tr);#else static inline void latency_fsnotify (struct trace_array *tr) { }#endif -#endif /* CONFIG_TRACER_SNAPSHOT */ #ifdef CONFIG_STACKTRACE void __trace_stack (struct trace_array *tr,unsigned int trace_ctx,int skip);
kernel/trace/trace_snapshot.c +1 -2
@@ -391,9 +391,8 @@ void latency_fsnotify(struct trace_array *tr)*/ irq_work_queue (&tr->fsnotify_irqwork); } -#else -static inline void latency_fsnotify (struct trace_array *tr) { }#endif /* LATENCY_FS_NOTIFY */ +static const struct file_operations tracing_max_lat_fops; void trace_create_maxlat_file(struct trace_array *tr,
Signature · 1 line
2.51.0