Skip to contentSkip to conversation

tracing: fixes

GIT PULL In review Steven Rostedt 4 participants 8 messages Jun 7, 2011 – Jun 8, 2011

Subsystems (2)
lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

Ingo,

Please pull the latest tip/perf/urgent-2 tree, which can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
tip/perf/urgent-2

GuoWen Li (1):
ftrace: Fix possible undefined return code

Steven Rostedt (2):
kprobes/trace: Fix kprobe selftest for gcc 4.6
ftrace: Revert 8ab2b7efd ftrace: Remove unnecessary disabling of irqs

----

 kernel/trace/ftrace.c       |    9 ++++++++-
 kernel/trace/trace_kprobe.c |    8 ++++++--
 2 files changed, 14 insertions(+), 3 deletions(-)
author maintainer
#1 lore raw

PATCH v2 1/3 ftrace: Fix possible undefined return code

From: GuoWen Li <[email protected]>

kernel/trace/ftrace.c: In function 'ftrace_regex_write.clone.15':
kernel/trace/ftrace.c:2743:6: warning: 'ret' may be used uninitialized in this function

---
 kernel/trace/ftrace.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/trace/ftrace.c +1 -1
index 1ee417f..204b3eb 100644
@@ -2740,7 +2740,7 @@ static int ftrace_process_regex(struct ftrace_hash *hash,
 {
 	char *func, *command, *next = buff;
 	struct ftrace_func_command *p;
-	int ret;
+	int ret = -EINVAL;
 
 	func = strsep(&next, ":");
 
Signature · 1 line
1.7.4.4
author maintainer
#2 lore raw

PATCH v2 2/3 kprobes/trace: Fix kprobe selftest for gcc 4.6

In reply to Steven Rostedt

From: Steven Rostedt <[email protected]>

With gcc 4.6, the self test kprobe function:

kprobe_trace_selftest_target()

is optimized such that kallsyms does not list it. The kprobes test uses this function to insert a probe and test it. But it will fail the test if the function is not listed in kallsyms.

Adding a __used annotation keeps the symbol in the kallsyms table.

---
 kernel/trace/trace_kprobe.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
kernel/trace/trace_kprobe.c +6 -2
index f925c45..27d13b3 100644
@@ -1870,8 +1870,12 @@ fs_initcall(init_kprobe_trace);
 
 #ifdef CONFIG_FTRACE_STARTUP_TEST
 
-static int kprobe_trace_selftest_target(int a1, int a2, int a3,
-					int a4, int a5, int a6)
+/*
+ * The "__used" keeps gcc from removing the function symbol
+ * from the kallsyms table.
+ */
+static __used int kprobe_trace_selftest_target(int a1, int a2, int a3,
+					       int a4, int a5, int a6)
 {
 	return a1 + a2 + a3 + a4 + a5 + a6;
 }
Signature · 1 line
1.7.4.4
Acked-by on v2 2/3
#3 lore raw

Re: [PATCH 2/3 v2] kprobes/trace: Fix kprobe selftest for gcc 4.6

Quoted 11 lines · Steven Rostedt

From: Steven Rostedt <[email protected]>

With gcc 4.6, the self test kprobe function:

kprobe_trace_selftest_target()

is optimized such that kallsyms does not list it. The kprobes test uses this function to insert a probe and test it. But it will fail the test if the function is not listed in kallsyms.

Adding a __used annotation keeps the symbol in the kallsyms table.

Thanks Steven and David,

That's good to me!

Quoted 27 lines
---
 kernel/trace/trace_kprobe.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
kernel/trace/trace_kprobe.c +6 -2
index f925c45..27d13b3 100644
@@ -1870,8 +1870,12 @@ fs_initcall(init_kprobe_trace);
 
 #ifdef CONFIG_FTRACE_STARTUP_TEST
 
-static int kprobe_trace_selftest_target(int a1, int a2, int a3,
-					int a4, int a5, int a6)
+/*
+ * The "__used" keeps gcc from removing the function symbol
+ * from the kallsyms table.
+ */
+static __used int kprobe_trace_selftest_target(int a1, int a2, int a3,
+					       int a4, int a5, int a6)
 {
 	return a1 + a2 + a3 + a4 + a5 + a6;
 }
Signature · 4 lines
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: [email protected]
author maintainer
#4 lore raw

PATCH v2 3/3 ftrace: Revert 8ab2b7efd ftrace: Remove unnecessary disabling of

In reply to Steven Rostedt

From: Steven Rostedt <[email protected]>

Revert the commit that removed the disabling of interrupts around the initial modifying of mcount callers to nops, and update the comment.

The original comment was outdated and stated that the interrupts were being disabled to prevent kstop machine, which was required with the old ftrace daemon, but was no longer the case.

What the comment failed to mention was that interrupts needed to be disabled to keep interrupts from preempting the modifying of the code and then executing the code that was partially modified.

Revert the commit and update the comment.

---
 kernel/trace/ftrace.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
kernel/trace/ftrace.c +7 -0
index 204b3eb..908038f 100644
@@ -3330,6 +3330,7 @@ static int ftrace_process_locs(struct module *mod,
 {
 	unsigned long *p;
 	unsigned long addr;
+	unsigned long flags;
 
 	mutex_lock(&ftrace_lock);
 	p = start;
@@ -3346,7 +3347,13 @@ static int ftrace_process_locs(struct module *mod,
 		ftrace_record_ip(addr);
 	}
 
+	/*
+	 * Disable interrupts to prevent interrupts from executing
+	 * code that is being modified.
+	 */
+	local_irq_save(flags);
 	ftrace_update_code(mod);
+	local_irq_restore(flags);
 	mutex_unlock(&ftrace_lock);
 
 	return 0;
Signature · 1 line
1.7.4.4
#5 lore raw

Re: [PATCH 3/3 v2] ftrace: Revert 8ab2b7efd ftrace: Remove unnecessary disabling of

Quoted 50 lines · Steven Rostedt

From: Steven Rostedt <[email protected]>

Revert the commit that removed the disabling of interrupts around the initial modifying of mcount callers to nops, and update the comment.

The original comment was outdated and stated that the interrupts were being disabled to prevent kstop machine, which was required with the old ftrace daemon, but was no longer the case.

What the comment failed to mention was that interrupts needed to be disabled to keep interrupts from preempting the modifying of the code and then executing the code that was partially modified.

Revert the commit and update the comment.

---
 kernel/trace/ftrace.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
kernel/trace/ftrace.c +7 -0
index 204b3eb..908038f 100644
@@ -3330,6 +3330,7 @@ static int ftrace_process_locs(struct module *mod,
 {
 	unsigned long *p;
 	unsigned long addr;
+	unsigned long flags;
 
 	mutex_lock(&ftrace_lock);
 	p = start;
@@ -3346,7 +3347,13 @@ static int ftrace_process_locs(struct module *mod,
 		ftrace_record_ip(addr);
 	}
 
+	/*
+	 * Disable interrupts to prevent interrupts from executing
+	 * code that is being modified.
+	 */
+	local_irq_save(flags);
 	ftrace_update_code(mod);
+	local_irq_restore(flags);
 	mutex_unlock(&ftrace_lock);
 
 	return 0;
Signature · 1 line
1.7.4.4

ACK as before.

Rich.

Signature · 4 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
author maintainer
#6 lore raw

Re: [PATCH 3/3 v2] ftrace: Revert 8ab2b7efd ftrace: Remove unnecessary disabling of

Quoted 5 lines · Richard W.M. Jones
Quoted 1 line · Steven Rostedt

1.7.4.4

ACK as before.

I added your tested by, but never added your Acked-by. Sorry :-p

-- Steve

#7 lore raw
In reply to Steven Rostedt
Quoted 11 lines · Steven Rostedt

Ingo,

Please pull the latest tip/perf/urgent-2 tree, which can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
tip/perf/urgent-2

GuoWen Li (1):
ftrace: Fix possible undefined return code

Quoted 8 lines

Steven Rostedt (2):
kprobes/trace: Fix kprobe selftest for gcc 4.6
ftrace: Revert 8ab2b7efd ftrace: Remove unnecessary disabling of irqs

----

 kernel/trace/ftrace.c       |    9 ++++++++-
 kernel/trace/trace_kprobe.c |    8 ++++++--
 2 files changed, 14 insertions(+), 3 deletions(-)

Pulled, thanks a lot Steve!

Thanks,

Ingo