public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] [GIT PULL] tracing: A couple of fixes
@ 2014-04-17 23:42 Steven Rostedt
  2014-04-17 23:42 ` [PATCH 1/2] tracing: Do not try to recreated toplevel set_ftrace_* files Steven Rostedt
  2014-04-17 23:42 ` [PATCH 2/2] tracing/uprobes: Fix uprobe_cpu_buffer memory leak Steven Rostedt
  0 siblings, 2 replies; 4+ messages in thread
From: Steven Rostedt @ 2014-04-17 23:42 UTC (permalink / raw)
  To: linux-kernel; +Cc: Linus Torvalds, Ingo Molnar, Andrew Morton


Linus,

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(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] tracing: Do not try to recreated toplevel set_ftrace_* files
  2014-04-17 23:42 [PATCH 0/2] [GIT PULL] tracing: A couple of fixes Steven Rostedt
@ 2014-04-17 23:42 ` Steven Rostedt
  2014-04-18 10:01   ` Borislav Petkov
  2014-04-17 23:42 ` [PATCH 2/2] tracing/uprobes: Fix uprobe_cpu_buffer memory leak Steven Rostedt
  1 sibling, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2014-04-17 23:42 UTC (permalink / raw)
  To: linux-kernel; +Cc: Linus Torvalds, Ingo Molnar, Andrew Morton, Borislav Petkov

[-- Attachment #1: 0001-tracing-Do-not-try-to-recreated-toplevel-set_ftrace_.patch --]
[-- Type: text/plain, Size: 1852 bytes --]

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

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.

Reported-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace_functions.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
index 5b781d2..ffd5635 100644
--- a/kernel/trace/trace_functions.c
+++ b/kernel/trace/trace_functions.c
@@ -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);
 
-- 
1.8.5.3



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] tracing/uprobes: Fix uprobe_cpu_buffer memory leak
  2014-04-17 23:42 [PATCH 0/2] [GIT PULL] tracing: A couple of fixes Steven Rostedt
  2014-04-17 23:42 ` [PATCH 1/2] tracing: Do not try to recreated toplevel set_ftrace_* files Steven Rostedt
@ 2014-04-17 23:42 ` Steven Rostedt
  1 sibling, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2014-04-17 23:42 UTC (permalink / raw)
  To: linux-kernel
  Cc: Linus Torvalds, Ingo Molnar, Andrew Morton, stable, Namhyung Kim,
	zhangwei(Jovi)

[-- Attachment #1: 0002-tracing-uprobes-Fix-uprobe_cpu_buffer-memory-leak.patch --]
[-- Type: text/plain, Size: 1020 bytes --]

From: "zhangwei(Jovi)" <jovi.zhangwei@huawei.com>

Forgot to free uprobe_cpu_buffer percpu page in uprobe_buffer_disable().

Link: http://lkml.kernel.org/p/534F8B3F.1090407@huawei.com

Cc: stable@vger.kernel.org # v3.14+
Acked-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: zhangwei(Jovi) <jovi.zhangwei@huawei.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace_uprobe.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index 930e514..c082a74 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -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;
 	}
-- 
1.8.5.3



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] tracing: Do not try to recreated toplevel set_ftrace_* files
  2014-04-17 23:42 ` [PATCH 1/2] tracing: Do not try to recreated toplevel set_ftrace_* files Steven Rostedt
@ 2014-04-18 10:01   ` Borislav Petkov
  0 siblings, 0 replies; 4+ messages in thread
From: Borislav Petkov @ 2014-04-18 10:01 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-kernel, Linus Torvalds, Ingo Molnar, Andrew Morton

On Thu, Apr 17, 2014 at 07:42:57PM -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
> 
> 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.
> 
> Reported-by: Borislav Petkov <bp@alien8.de>
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

Tested-by: Borislav Petkov <bp@suse.de>

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-04-18 10:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-17 23:42 [PATCH 0/2] [GIT PULL] tracing: A couple of fixes Steven Rostedt
2014-04-17 23:42 ` [PATCH 1/2] tracing: Do not try to recreated toplevel set_ftrace_* files Steven Rostedt
2014-04-18 10:01   ` Borislav Petkov
2014-04-17 23:42 ` [PATCH 2/2] tracing/uprobes: Fix uprobe_cpu_buffer memory leak Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox