]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
bpf: clarify when bpf_trace_printk discards lines
authorPeter Wu <peter@lekensteyn.nl>
Tue, 20 Aug 2019 23:08:59 +0000 (00:08 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 21 Aug 2019 17:17:25 +0000 (10:17 -0700)
I opened /sys/kernel/tracing/trace once and kept reading from it.
bpf_trace_printk somehow did not seem to work, no entries were appended
to that trace file. It turns out that tracing is disabled when that file
is open. Save the next person some time and document this.

The trace file is described in Documentation/trace/ftrace.rst, however
the implication "tracing is disabled" did not immediate translate to
"bpf_trace_printk silently discards entries".

Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/uapi/linux/bpf.h

index 267544e140bea3a06f19ec5c3a73d0d90369d26e..b5889257cc334fbd639bbd9d0e4547fdc7259097 100644 (file)
@@ -580,6 +580,8 @@ union bpf_attr {
  *             limited to five).
  *
  *             Each time the helper is called, it appends a line to the trace.
+ *             Lines are discarded while *\/sys/kernel/debug/tracing/trace* is
+ *             open, use *\/sys/kernel/debug/tracing/trace_pipe* to avoid this.
  *             The format of the trace is customizable, and the exact output
  *             one will get depends on the options set in
  *             *\/sys/kernel/debug/tracing/trace_options* (see also the