libbpf: Make kernel feature probing lazy
authorAndrii Nakryiko <andriin@fb.com>
Tue, 18 Aug 2020 21:33:51 +0000 (14:33 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 19 Aug 2020 00:16:15 +0000 (17:16 -0700)
commit47b6cb4d0add454859f386337e6079e01ac7db8f
treeb7c2e6477cdb0fca2e552933bde58fef27bfbd68
parent8d708236058601f1b08b0ca2a1cd9fff28034416
libbpf: Make kernel feature probing lazy

Turn libbpf's kernel feature probing into lazily-performed checks. This allows
to skip performing unnecessary feature checks, if a given BPF application
doesn't rely on a particular kernel feature. As we grow number of feature
probes, libbpf might perform less unnecessary syscalls and scale better with
number of feature probes long-term.

By decoupling feature checks from bpf_object, it's also possible to perform
feature probing from libbpf static helpers and low-level APIs, if necessary.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200818213356.2629020-3-andriin@fb.com
tools/lib/bpf/libbpf.c