diff options
author | Jiri Olsa <jolsa@kernel.org> | 2024-04-10 17:09:52 +0300 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2024-04-12 19:25:21 +0300 |
commit | 4d4992ff587604455e8843a0e76dce0b99175319 (patch) | |
tree | b6bc29b0220753ef4eaa63910d935df69e0373cd /scripts | |
parent | 23cc4fe44f1df5ccce088a7c9398f96794047c2a (diff) | |
download | linux-4d4992ff587604455e8843a0e76dce0b99175319.tar.xz |
selftests/bpf: Add read_trace_pipe_iter function
We have two printk tests reading trace_pipe in non blocking way,
with the very same code. Moving that in new read_trace_pipe_iter
function.
Current read_trace_pipe is used from samples/bpf and needs to
do blocking read and printf of the trace_pipe data, using new
read_trace_pipe_iter to implement that.
Both printk tests do early checks for the number of found messages
and can bail earlier, but I did not find any speed difference w/o
that condition, so I did not complicate the change more for that.
Some of the samples/bpf programs use read_trace_pipe function,
so I kept that interface untouched. I did not see any issues with
affected samples/bpf programs other than there's slight change in
read_trace_pipe output. The current code uses puts that adds new
line after the printed string, so we would occasionally see extra
new line. With this patch we read output per lines, so there's no
need to use puts and we can use just printf instead without extra
new line.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/bpf/20240410140952.292261-1-jolsa@kernel.org
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions