tracing: Last three patches (hopefully) before my pull request
Subsystems (4)
Steven Rostedt
maintainercover tracing: Last three patches (hopefully) before my pull request
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
for-next
Head SHA1: 37f9e8b51dbe7f69d9f80aec98f1514f0cd4085e
Masami Hiramatsu (1):
bootconfig: Fix to find the initargs correctly
Muchun Song (1):
kprobes: Fix compiler warning for !CONFIG_KPROBES_ON_FTRACE
Steven Rostedt (VMware) (1):
tracing: Use trace_sched_process_free() instead of exit() for pid tracing
----
init/main.c | 14 ++++++++------ kernel/kprobes.c | 17 ++++++++++++++--- kernel/trace/ftrace.c | 4 ++-- kernel/trace/trace_events.c | 4 ++-- 4 files changed, 26 insertions(+), 13 deletions(-)
Steven Rostedt
maintainerPATCH 1/3 bootconfig: Fix to find the initargs correctly
From: Masami Hiramatsu <[email protected]>
Since the parse_args() stops parsing at '--', bootconfig_params() will never get the '--' as param and initargs_found never be true. In the result, if we pass some init arguments via the bootconfig, those are always appended to the kernel command line with '--' even if the kernel command line already has '--'.
To fix this correctly, check the return value of parse_args() and set initargs_found true if the return value is not an error but a valid address.
--- init/main.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
init/main.c +8 -6
@@ -387,8 +387,6 @@ static int __init bootconfig_params(char *param, char *val, {if (strcmp (param,"bootconfig" ) ==0 ) { bootconfig_found = true; - }else if (strcmp (param,"--" ) ==0 ) { - initargs_found = true; }return 0 ; }
@@ -399,19 +397,23 @@ static void __init setup_boot_config(const char *cmdline)const char *msg;int pos;u32 size, csum; -char *data, *copy; +char *data, *copy, *err;int ret;/* Cut out the bootconfig data even if we have no bootconfig option */ data =get_boot_config_from_initrd (&size, &csum);strlcpy (tmp_cmdline, boot_command_line,COMMAND_LINE_SIZE ); -parse_args ("bootconfig" , tmp_cmdline,NULL ,0 ,0 ,0 ,NULL , - bootconfig_params); + err =parse_args ("bootconfig" , tmp_cmdline,NULL ,0 ,0 ,0 ,NULL , + bootconfig_params); -if (!bootconfig_found) +if (IS_ERR (err) || !bootconfig_found)return ; +/* parse_args() stops at '--' and returns an address */ +if (err) + initargs_found = true; +if (!data) {pr_err ("'bootconfig' found on command line, but no bootconfig found\n" );return ;
Signature · 1 line
2.26.2
Steven Rostedt
maintainerPATCH 2/3 tracing: Use trace_sched_process_free() instead of exit() for pid tracing
In reply to Steven RostedtFrom: "Steven Rostedt (VMware)" <[email protected]>
On exit, if a process is preempted after the trace_sched_process_exit() tracepoint but before the process is done exiting, then when it gets scheduled in, the function tracers will not filter it properly against the function tracing pid filters.
That is because the function tracing pid filters hooks to the sched_process_exit() tracepoint to remove the exiting task's pid from the filter list. Because the filtering happens at the sched_switch tracepoint, when the exiting task schedules back in to finish up the exit, it will no longer be in the function pid filtering tables.
This was noticeable in the notrace self tests on a preemptable kernel, as the tests would fail as it exits and preempted after being taken off the notrace filter table and on scheduling back in it would not be in the notrace list, and then the ending of the exit function would trace. The test detected this and would fail.
--- kernel/trace/ftrace.c | 4 ++-- kernel/trace/trace_events.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
kernel/trace/ftrace.c +2 -2
@@ -6985,12 +6985,12 @@ void ftrace_pid_follow_fork(struct trace_array *tr, bool enable)if (enable) {register_trace_sched_process_fork (ftrace_pid_follow_sched_process_fork, tr); -register_trace_sched_process_exit (ftrace_pid_follow_sched_process_exit, +register_trace_sched_process_free (ftrace_pid_follow_sched_process_exit, tr); }else {unregister_trace_sched_process_fork (ftrace_pid_follow_sched_process_fork, tr); -unregister_trace_sched_process_exit (ftrace_pid_follow_sched_process_exit, +unregister_trace_sched_process_free (ftrace_pid_follow_sched_process_exit, tr); } }
kernel/trace/trace_events.c +2 -2
@@ -538,12 +538,12 @@ void trace_event_follow_fork(struct trace_array *tr, bool enable)if (enable) {register_trace_prio_sched_process_fork (event_filter_pid_sched_process_fork, tr,INT_MIN ); -register_trace_prio_sched_process_exit (event_filter_pid_sched_process_exit, +register_trace_prio_sched_process_free (event_filter_pid_sched_process_exit, tr,INT_MAX ); }else {unregister_trace_sched_process_fork (event_filter_pid_sched_process_fork, tr); -unregister_trace_sched_process_exit (event_filter_pid_sched_process_exit, +unregister_trace_sched_process_free (event_filter_pid_sched_process_exit, tr); } }
Signature · 1 line
2.26.2
Steven Rostedt
maintainerPATCH 3/3 kprobes: Fix compiler warning for !CONFIG_KPROBES_ON_FTRACE
In reply to Steven RostedtFrom: Muchun Song <[email protected]>
Fix compiler warning(as show below) for !CONFIG_KPROBES_ON_FTRACE.
kernel/kprobes.c: In function 'kill_kprobe':kernel/kprobes.c:1116:33: warning: statement with no effect [-Wunused-value]
1116 | #define disarm_kprobe_ftrace(p) (-ENODEV)
| ^kernel/kprobes.c:2154:3: note: in expansion of macro 'disarm_kprobe_ftrace'
2154 | disarm_kprobe_ftrace(p);
--- kernel/kprobes.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
kernel/kprobes.c +14 -3
@@ -1079,9 +1079,20 @@ static int disarm_kprobe_ftrace(struct kprobe *p) ipmodify ? &kprobe_ipmodify_enabled : &kprobe_ftrace_enabled); }#else /* !CONFIG_KPROBES_ON_FTRACE */ -#define prepare_kprobe (p) arch_prepare_kprobe(p) -#define arm_kprobe_ftrace (p) (-ENODEV) -#define disarm_kprobe_ftrace (p) (-ENODEV) +static inline int prepare_kprobe (struct kprobe *p) +{ +return arch_prepare_kprobe (p); +} + +static inline int arm_kprobe_ftrace (struct kprobe *p) +{ +return -ENODEV ; +} + +static inline int disarm_kprobe_ftrace (struct kprobe *p) +{ +return -ENODEV ; +}#endif /* Arm a kprobe with text_mutex */
Signature · 1 line
2.26.2