linux/Documentation/trace
Alban Crequy 696ced4fb1 tracing/kprobes: expose maxactive for kretprobe in kprobe_events
When a kretprobe is installed on a kernel function, there is a maximum
limit of how many calls in parallel it can catch (aka "maxactive"). A
kernel module could call register_kretprobe() and initialize maxactive
(see example in samples/kprobes/kretprobe_example.c).

But that is not exposed to userspace and it is currently not possible to
choose maxactive when writing to /sys/kernel/debug/tracing/kprobe_events

The default maxactive can be as low as 1 on single-core with a
non-preemptive kernel. This is too low and we need to increase it not
only for recursive functions, but for functions that sleep or resched.

This patch updates the format of the command that can be written to
kprobe_events so that maxactive can be optionally specified.

I need this for a bpf program attached to the kretprobe of
inet_csk_accept, which can sleep for a long time.

This patch includes a basic selftest:

> # ./ftracetest -v  test.d/kprobe/
> === Ftrace unit tests ===
> [1] Kprobe dynamic event - adding and removing	[PASS]
> [2] Kprobe dynamic event - busy event check	[PASS]
> [3] Kprobe dynamic event with arguments	[PASS]
> [4] Kprobes event arguments with types	[PASS]
> [5] Kprobe dynamic event with function tracer	[PASS]
> [6] Kretprobe dynamic event with arguments	[PASS]
> [7] Kretprobe dynamic event with maxactive	[PASS]
>
> # of passed:  7
> # of failed:  0
> # of unresolved:  0
> # of untested:  0
> # of unsupported:  0
> # of xfailed:  0
> # of undefined(test bug):  0

BugLink: https://github.com/iovisor/bcc/issues/1072
Link: http://lkml.kernel.org/r/1491215782-15490-1-git-send-email-alban@kinvolk.io

Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Alban Crequy <alban@kinvolk.io>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-04 10:32:03 -04:00
..
postprocess trace-vmscan-postprocess: sync with tracepoints updates 2017-02-22 16:41:29 -08:00
coresight.txt coresight: stm: adding driver for CoreSight STM component 2016-05-03 14:59:30 -07:00
events-kmem.txt
events-msr.txt x86, tracing, perf: Add trace point for MSR accesses 2015-12-06 12:56:10 +01:00
events-nmi.txt x86: Add NMI duration tracepoints 2013-06-23 11:52:58 +02:00
events-power.txt PM / QoS: Rename device resume latency QoS items 2014-02-11 00:35:23 +01:00
events.txt ftrace: Support full glob matching 2016-11-14 16:42:58 -05:00
ftrace-design.txt ftrace: Add return address pointer to ftrace_ret_stack 2016-08-24 12:15:14 +02:00
ftrace.txt This release has a few updates: 2016-12-15 13:49:34 -08:00
function-graph-fold.vim
hwlat_detector.txt tracing: Have hwlat trace migrate across tracing_cpumask CPUs 2016-09-02 12:47:54 -04:00
intel_th.txt intel_th: Document debug host mode 2016-11-18 17:11:35 +02:00
kprobetrace.txt tracing/kprobes: expose maxactive for kretprobe in kprobe_events 2017-04-04 10:32:03 -04:00
mmiotrace.txt
ring-buffer-design.txt doc: fix double words 2014-03-21 13:16:58 +01:00
stm.txt stm class: Document stm_source channel assignment 2016-11-18 17:06:34 +02:00
tracepoint-analysis.txt
tracepoints.txt tracing: Add trace_<tracepoint>_enabled() function 2014-05-07 12:10:51 -04:00
uprobetracer.txt perf/core: Rename CONFIG_[UK]PROBE_EVENT to CONFIG_[UK]PROBE_EVENTS 2017-03-01 10:26:39 +01:00