summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2021-12-10 02:40:34 +0300
committerAndrii Nakryiko <andrii@kernel.org>2021-12-11 02:35:14 +0300
commitbd6b3b355af59af1f8c417c269a46be26a1dc87b (patch)
tree0e92aea9d74a32c822d7232e3293fb51a1cc4e87 /lib
parentac55b3f00c323cf09d59a191e14bcf39b691078c (diff)
parentb59e4ce8bcaab6445f4a0d37a96ca8953caaf5cf (diff)
downloadlinux-bd6b3b355af59af1f8c417c269a46be26a1dc87b.tar.xz
Merge branch 'Enhance and rework logging controls in libbpf'
Andrii Nakryiko says: ==================== Add new open options and per-program setters to control BTF and program loading log verboseness and allow providing custom log buffers to capture logs of interest. Note how custom log_buf and log_level are orthogonal, which matches previous (alas less customizable) behavior of libbpf, even though it sort of worked by accident: if someone specified log_level = 1 in bpf_object__load_xattr(), first attempt to load any BPF program resulted in wasted bpf() syscall with -EINVAL due to !!log_buf != !!log_level. Then on retry libbpf would allocated log_buffer and try again, after which prog loading would succeed and libbpf would print verbose program loading log through its print callback. This behavior is now documented and made more efficient, not wasting unnecessary syscall. But additionally, log_level can be controlled globally on a per-bpf_object level through bpf_object_open_opts, as well as on a per-program basis with bpf_program__set_log_buf() and bpf_program__set_log_level() APIs. Now that we have a more future-proof way to set log_level, deprecate bpf_object__load_xattr(). v2->v3: - added log_buf selftests for bpf_prog_load() and bpf_btf_load(); - fix !log_buf in bpf_prog_load (John); - fix log_level==0 in bpf_btf_load (thanks selftest!); v1->v2: - fix log_level == 0 handling of bpf_prog_load, add as patch #1 (Alexei); - add comments explaining log_buf_size overflow prevention (Alexei). ==================== Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions