diff options
author | Andrii Nakryiko <andrii@kernel.org> | 2021-12-09 11:38:29 -0800 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2021-12-10 15:29:17 -0800 |
commit | 4cf23a3c6359556a1cca489cf2b901e2b904c4b0 (patch) | |
tree | 719f82d039a0ff13b1826f3eec1d155edc150ae7 /tools/lib/bpf/libbpf_probes.c | |
parent | samples/bpf: Remove unneeded variable (diff) | |
download | linux-dev-4cf23a3c6359556a1cca489cf2b901e2b904c4b0.tar.xz linux-dev-4cf23a3c6359556a1cca489cf2b901e2b904c4b0.zip |
libbpf: Fix bpf_prog_load() log_buf logic for log_level 0
To unify libbpf APIs behavior w.r.t. log_buf and log_level, fix
bpf_prog_load() to follow the same logic as bpf_btf_load() and
high-level bpf_object__load() API will follow in the subsequent patches:
- if log_level is 0 and non-NULL log_buf is provided by a user, attempt
load operation initially with no log_buf and log_level set;
- if successful, we are done, return new FD;
- on error, retry the load operation with log_level bumped to 1 and
log_buf set; this way verbose logging will be requested only when we
are sure that there is a failure, but will be fast in the
common/expected success case.
Of course, user can still specify log_level > 0 from the very beginning
to force log collection.
Suggested-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20211209193840.1248570-2-andrii@kernel.org
Diffstat (limited to '')
0 files changed, 0 insertions, 0 deletions