Skip to content

Commit 77b44d1

Browse files
Masami HiramatsuIngo Molnar
authored andcommitted
tracing/kprobes: Rename Kprobe-tracer to kprobe-event
Rename Kprobes-based event tracer to kprobes-based tracing event (kprobe-event), since it is not a tracer but an extensible tracing event interface. This also changes CONFIG_KPROBE_TRACER to CONFIG_KPROBE_EVENT and sets it y by default. Signed-off-by: Masami Hiramatsu <[email protected]> Acked-by: Frederic Weisbecker <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Jim Keniston <[email protected]> Cc: Ananth N Mavinakayanahalli <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Frank Ch. Eigler <[email protected]> Cc: Jason Baron <[email protected]> Cc: K.Prasad <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Srikar Dronamraju <[email protected]> LKML-Reference: <20091104001247.3454.14131.stgit@harusame> Signed-off-by: Ingo Molnar <[email protected]>
1 parent 91365bb commit 77b44d1

File tree

4 files changed

+31
-30
lines changed

4 files changed

+31
-30
lines changed

Documentation/trace/kprobetrace.txt

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
1-
Kprobe-based Event Tracer
2-
=========================
1+
Kprobe-based Event Tracing
2+
==========================
33

44
Documentation is written by Masami Hiramatsu
55

66

77
Overview
88
--------
9-
This tracer is similar to the events tracer which is based on Tracepoint
10-
infrastructure. Instead of Tracepoint, this tracer is based on kprobes(kprobe
11-
and kretprobe). It probes anywhere where kprobes can probe(this means, all
12-
functions body except for __kprobes functions).
9+
These events are similar to tracepoint based events. Instead of Tracepoint,
10+
this is based on kprobes (kprobe and kretprobe). So it can probe wherever
11+
kprobes can probe (this means, all functions body except for __kprobes
12+
functions). Unlike the Tracepoint based event, this can be added and removed
13+
dynamically, on the fly.
1314

14-
Unlike the function tracer, this tracer can probe instructions inside of
15-
kernel functions. It allows you to check which instruction has been executed.
15+
To enable this feature, build your kernel with CONFIG_KPROBE_TRACING=y.
1616

17-
Unlike the Tracepoint based events tracer, this tracer can add and remove
18-
probe points on the fly.
19-
20-
Similar to the events tracer, this tracer doesn't need to be activated via
21-
current_tracer, instead of that, just set probe points via
22-
/sys/kernel/debug/tracing/kprobe_events. And you can set filters on each
23-
probe events via /sys/kernel/debug/tracing/events/kprobes/<EVENT>/filter.
17+
Similar to the events tracer, this doesn't need to be activated via
18+
current_tracer. Instead of that, add probe points via
19+
/sys/kernel/debug/tracing/kprobe_events, and enable it via
20+
/sys/kernel/debug/tracing/events/kprobes/<EVENT>/enabled.
2421

2522

2623
Synopsis of kprobe_events
@@ -55,9 +52,9 @@ Per-Probe Event Filtering
5552
-------------------------
5653
Per-probe event filtering feature allows you to set different filter on each
5754
probe and gives you what arguments will be shown in trace buffer. If an event
58-
name is specified right after 'p:' or 'r:' in kprobe_events, the tracer adds
59-
an event under tracing/events/kprobes/<EVENT>, at the directory you can see
60-
'id', 'enabled', 'format' and 'filter'.
55+
name is specified right after 'p:' or 'r:' in kprobe_events, it adds an event
56+
under tracing/events/kprobes/<EVENT>, at the directory you can see 'id',
57+
'enabled', 'format' and 'filter'.
6158

6259
enabled:
6360
You can enable/disable the probe by writing 1 or 0 on it.
@@ -71,6 +68,7 @@ filter:
7168
id:
7269
This shows the id of this probe event.
7370

71+
7472
Event Profiling
7573
---------------
7674
You can check the total number of probe hits and probe miss-hits via

kernel/trace/Kconfig

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -428,17 +428,22 @@ config BLK_DEV_IO_TRACE
428428

429429
If unsure, say N.
430430

431-
config KPROBE_TRACER
431+
config KPROBE_EVENT
432432
depends on KPROBES
433433
depends on X86
434-
bool "Trace kprobes"
434+
bool "Enable kprobes-based dynamic events"
435435
select TRACING
436-
select GENERIC_TRACER
436+
default y
437437
help
438-
This tracer probes everywhere where kprobes can probe it, and
439-
records various registers and memories specified by user.
440-
This also allows you to trace kprobe probe points as a dynamic
441-
defined events. It provides per-probe event filtering interface.
438+
This allows the user to add tracing events (similar to tracepoints) on the fly
439+
via the ftrace interface. See Documentation/trace/kprobetrace.txt
440+
for more details.
441+
442+
Those events can be inserted wherever kprobes can probe, and record
443+
various register and memory values.
444+
445+
This option is also required by perf-probe subcommand of perf tools. If
446+
you want to use perf tools, this option is strongly recommended.
442447

443448
config DYNAMIC_FTRACE
444449
bool "enable/disable ftrace tracepoints dynamically"

kernel/trace/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ obj-$(CONFIG_EVENT_TRACING) += trace_export.o
5353
obj-$(CONFIG_FTRACE_SYSCALLS) += trace_syscalls.o
5454
obj-$(CONFIG_EVENT_PROFILE) += trace_event_profile.o
5555
obj-$(CONFIG_EVENT_TRACING) += trace_events_filter.o
56-
obj-$(CONFIG_KPROBE_TRACER) += trace_kprobe.o
56+
obj-$(CONFIG_KPROBE_EVENT) += trace_kprobe.o
5757
obj-$(CONFIG_EVENT_TRACING) += power-traces.o
5858

5959
libftrace-y := ftrace.o

kernel/trace/trace_kprobe.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* kprobe based kernel tracer
2+
* Kprobes-based tracing events
33
*
44
* Created by Masami Hiramatsu <[email protected]>
55
*
@@ -57,8 +57,6 @@ const char *reserved_field_names[] = {
5757
FIELD_STRING_FUNC,
5858
};
5959

60-
/* currently, trace_kprobe only supports X86. */
61-
6260
struct fetch_func {
6361
unsigned long (*func)(struct pt_regs *, void *);
6462
void *data;
@@ -191,7 +189,7 @@ static __kprobes void free_indirect_fetch_data(struct indirect_fetch_data *data)
191189
}
192190

193191
/**
194-
* Kprobe tracer core functions
192+
* Kprobe event core functions
195193
*/
196194

197195
struct probe_arg {

0 commit comments

Comments
 (0)