tracing: A couple of fixes
Subsystems (2)
Steven Rostedt
maintainerLinus,
This contains two fixes.
The first is to remove a duplication of creating debugfs files that already exist and causes an error report to be printed due to the failure of the second creation.
The second is a memory leak fix that was introduced in 3.14.
Please pull the latest trace-fixes-v3.15-rc1 tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
trace-fixes-v3.15-rc1
Tag SHA1: cda50faf0eace20c60940638a550ecd5e9eac4c1 Head SHA1: 6ea6215fe394e320468589d9bba464a48f6d823a
Steven Rostedt (Red Hat) (1):
tracing: Do not try to recreated toplevel set_ftrace_* files
zhangwei(Jovi) (1):
tracing/uprobes: Fix uprobe_cpu_buffer memory leak
----
kernel/trace/trace_functions.c | 16 ++++++++++------ kernel/trace/trace_uprobe.c | 6 ++++++ 2 files changed, 16 insertions(+), 6 deletions(-)
Steven Rostedt
maintainerPATCH 1/2 tracing: Do not try to recreated toplevel set_ftrace_* files
From: "Steven Rostedt (Red Hat)" <[email protected]>
With the restructing of the function tracer working with instances, the "top level" buffer is a bit special, as the function tracing is mapped to the same set of filters. This is done by using a "global_ops" descriptor and having the "set_ftrace_filter" and "set_ftrace_notrace" map to it.
When an instance is created, it creates the same files but its for the local instance and not the global_ops.
The issues is that the local instance creation shares some code with the global instance one and we end up trying to create th top level "set_ftrace_*" files twice, and on boot up, we get an error like this:
Could not create debugfs 'set_ftrace_filter' entry Could not create debugfs 'set_ftrace_notrace' entry
The reason they failed to be created was because they were created twice, and the second time gives this error as you can not create the same file twice.
--- kernel/trace/trace_functions.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
kernel/trace/trace_functions.c +10 -6
@@ -58,12 +58,16 @@ int ftrace_create_function_files(struct trace_array *tr, {int ret; -/* The top level array uses the "global_ops". */ -if (!(tr->flags &TRACE_ARRAY_FL_GLOBAL )) { - ret =allocate_ftrace_ops (tr); -if (ret) -return ret; - } +/* +* The top level array uses the "global_ops", and the files are +* created on boot up. +*/ +if (tr->flags &TRACE_ARRAY_FL_GLOBAL ) +return 0 ; + + ret =allocate_ftrace_ops (tr); +if (ret) +return ret;ftrace_create_filter_files (tr->ops, parent);
Signature · 1 line
1.8.5.3
Re: [PATCH 1/2] tracing: Do not try to recreated toplevel set_ftrace_* files
Quoted 17 lines · Steven Rostedt
From: "Steven Rostedt (Red Hat)" <[email protected]>
With the restructing of the function tracer working with instances, the "top level" buffer is a bit special, as the function tracing is mapped to the same set of filters. This is done by using a "
global_ops" descriptor and having the "set_ftrace_filter" and "set_ftrace_notrace" map to it.When an instance is created, it creates the same files but its for the local instance and not the
global_ops.The issues is that the local instance creation shares some code with the global instance one and we end up trying to create th top level "set_ftrace_*" files twice, and on boot up, we get an error like this:
Could not create debugfs '
set_ftrace_filter' entry Could not create debugfs 'set_ftrace_notrace' entry
Quoted 6 lines
The reason they failed to be created was because they were created twice, and the second time gives this error as you can not create the same file twice.
Reported-by Borislav Petkov <[email protected]>Signed-off-by Steven Rostedt <[email protected]>
Signature · 5 lines
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--Steven Rostedt
maintainerPATCH 2/2 tracing/uprobes: Fix uprobe_cpu_buffer memory leak
In reply to Steven RostedtFrom: "zhangwei(Jovi)" <[email protected]>
Forgot to free uprobe_cpu_buffer percpu page in uprobe_buffer_disable().
--- kernel/trace/trace_uprobe.c | 6 ++++++ 1 file changed, 6 insertions(+)
kernel/trace/trace_uprobe.c +6 -0
@@ -732,9 +732,15 @@ static int uprobe_buffer_enable(void)static void uprobe_buffer_disable (void ) { +int cpu; +BUG_ON (!mutex_is_locked (&event_mutex));if (--uprobe_buffer_refcnt ==0 ) { +for_each_possible_cpu (cpu) +free_page ((unsigned long )per_cpu_ptr (uprobe_cpu_buffer, + cpu)->buf); +free_percpu (uprobe_cpu_buffer); uprobe_cpu_buffer =NULL ; }
Signature · 1 line
1.8.5.3