mbox series

[bpf-next,0/2] Support disabling auto-loading of BPF programs

Message ID 20200625232629.3444003-1-andriin@fb.com
Headers show
Series Support disabling auto-loading of BPF programs | expand

Message

Andrii Nakryiko June 25, 2020, 11:26 p.m. UTC
Add ability to turn off default auto-loading of each BPF program by libbpf on
BPF object load. This is the feature that allows BPF applications to have
optional functionality, which is only excercised on kernel that support
necessary features, while falling back to reduced/less performant
functionality, if kernel is outdated.

Andrii Nakryiko (2):
  libbpf: support disabling auto-loading BPF programs
  selftests/bpf: test auto-load disabling logic for BPF programs

 tools/lib/bpf/libbpf.c                        | 48 +++++++++++++++----
 tools/lib/bpf/libbpf.h                        |  2 +
 tools/lib/bpf/libbpf.map                      |  2 +
 .../selftests/bpf/prog_tests/autoload.c       | 41 ++++++++++++++++
 .../selftests/bpf/progs/test_autoload.c       | 40 ++++++++++++++++
 5 files changed, 125 insertions(+), 8 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/autoload.c
 create mode 100644 tools/testing/selftests/bpf/progs/test_autoload.c

Comments

Martin KaFai Lau June 26, 2020, 8:11 p.m. UTC | #1
On Thu, Jun 25, 2020 at 04:26:27PM -0700, Andrii Nakryiko wrote:
> Add ability to turn off default auto-loading of each BPF program by libbpf on
> BPF object load. This is the feature that allows BPF applications to have
> optional functionality, which is only excercised on kernel that support
> necessary features, while falling back to reduced/less performant
> functionality, if kernel is outdated.
Acked-by: Martin KaFai Lau <kafai@fb.com>
Alexei Starovoitov June 28, 2020, 5:15 p.m. UTC | #2
On Fri, Jun 26, 2020 at 1:16 PM Martin KaFai Lau <kafai@fb.com> wrote:
>
> On Thu, Jun 25, 2020 at 04:26:27PM -0700, Andrii Nakryiko wrote:
> > Add ability to turn off default auto-loading of each BPF program by libbpf on
> > BPF object load. This is the feature that allows BPF applications to have
> > optional functionality, which is only excercised on kernel that support
> > necessary features, while falling back to reduced/less performant
> > functionality, if kernel is outdated.
> Acked-by: Martin KaFai Lau <kafai@fb.com>

Applied. Thanks