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".
Showing the changes to include/uapi/linux (1 of 1 file). Show all
Unified · Split
| @@ -580,6 +580,8 @@ union bpf_attr { · 579 unmodified lines | |||
| 580 | * limited to five). | 580 | * limited to five). |
| 581 | * | 581 | * |
| 582 | * Each time the helper is called, it appends a line to the trace. | 582 | * Each time the helper is called, it appends a line to the trace. |
| 583 | * Lines are discarded while *\/sys/kernel/debug/tracing/trace* is | ||
| 584 | * open, use *\/sys/kernel/debug/tracing/trace_pipe* to avoid this. | ||
| 583 | * The format of the trace is customizable, and the exact output | 585 | * The format of the trace is customizable, and the exact output |
| 584 | * one will get depends on the options set in | 586 | * one will get depends on the options set in |
| 585 | * *\/sys/kernel/debug/tracing/trace_options* (see also the | 587 | * *\/sys/kernel/debug/tracing/trace_options* (see also the |