Skip to contentSkip to conversation

perf/tracing: Fix regression of perf losing kprobe events

GIT PULL Steven Rostedt 3 participants 3 messages Jun 11, 2010 Tracing

lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

Ingo,

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

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

Steven Rostedt (1):
perf/tracing: Fix regression of perf losing kprobe events

----

 kernel/trace/trace_event_perf.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---------------------------
commit a8fb2608053547bc3152ea61a5ec7cdfce5d942c
Author: Steven Rostedt <[email protected]>
Date:   Thu Jun 10 14:53:16 2010 -0400

perf/tracing: Fix regression of perf losing kprobe events

With the addition of the code to shrink the kernel tracepoint infrastructure, we lost kprobes being traced by perf. The reason is that I tested if the "tp_event->class->perf_probe" existed before enabling it. This prevents "ftrace only" events (like the function trace events) from being enabled by perf.

Unfortunately, kprobe events do not use perf_probe. This causes kprobes to be missed by perf. To fix this, we add the test to see if "tp_event->class->reg" exists as well as perf_probe.

Normal trace events have only "perf_probe" but no "reg" function, and kprobes and syscalls have the "reg" but no "perf_probe". The ftrace unique events do not have either, so this is a valid test. If a kprobe or syscall is not to be probed by perf, the "reg" function is called anyway, and will return a failure and prevent perf from probing it.

kernel/trace/trace_event_perf.c +3 -1
index e6f6588..8a2b73f 100644
@@ -96,7 +96,9 @@ int perf_trace_init(struct perf_event *p_event)
 	mutex_lock(&event_mutex);
 	list_for_each_entry(tp_event, &ftrace_events, list) {
 		if (tp_event->event.type == event_id &&
-		    tp_event->class && tp_event->class->perf_probe &&
+		    tp_event->class &&
+		    (tp_event->class->perf_probe ||
+		     tp_event->class->reg) &&
 		    try_module_get(tp_event->mod)) {
 			ret = perf_trace_event_init(tp_event, p_event);
 			break;
#1 lore raw
Quoted 38 lines · Steven Rostedt

Ingo,

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

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

Steven Rostedt (1):
perf/tracing: Fix regression of perf losing kprobe events

----

 kernel/trace/trace_event_perf.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---------------------------
commit a8fb2608053547bc3152ea61a5ec7cdfce5d942c
Author: Steven Rostedt <[email protected]>
Date:   Thu Jun 10 14:53:16 2010 -0400

perf/tracing: Fix regression of perf losing kprobe events

With the addition of the code to shrink the kernel tracepoint infrastructure, we lost kprobes being traced by perf. The reason is that I tested if the "tp_event->class->perf_probe" existed before enabling it. This prevents "ftrace only" events (like the function trace events) from being enabled by perf.

Unfortunately, kprobe events do not use perf_probe. This causes kprobes to be missed by perf. To fix this, we add the test to see if "tp_event->class->reg" exists as well as perf_probe.

Normal trace events have only "perf_probe" but no "reg" function, and kprobes and syscalls have the "reg" but no "perf_probe". The ftrace unique events do not have either, so this is a valid test. If a kprobe or syscall is not to be probed by perf, the "reg" function is called anyway, and will return a failure and prevent perf from probing it.

Quoted 4 lines

Thank you for fixing,

Quoted 20 lines
kernel/trace/trace_event_perf.c +3 -1
index e6f6588..8a2b73f 100644
@@ -96,7 +96,9 @@ int perf_trace_init(struct perf_event *p_event)
 	mutex_lock(&event_mutex);
 	list_for_each_entry(tp_event, &ftrace_events, list) {
 		if (tp_event->event.type == event_id &&
-		    tp_event->class && tp_event->class->perf_probe &&
+		    tp_event->class &&
+		    (tp_event->class->perf_probe ||
+		     tp_event->class->reg) &&
 		    try_module_get(tp_event->mod)) {
 			ret = perf_trace_event_init(tp_event, p_event);
 			break;
#2 lore raw
In reply to Steven Rostedt
Quoted 8 lines · Steven Rostedt

Ingo,

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

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

Quoted 6 lines

Steven Rostedt (1):
perf/tracing: Fix regression of perf losing kprobe events

----

 kernel/trace/trace_event_perf.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Pulled, thanks Steve!

Ingo