]> git.baikalelectronics.ru Git - kernel.git/commit
bpftool: Probe for bounded loop support
authorPaul Chaignon <paul@isovalent.com>
Tue, 4 Jan 2022 17:59:57 +0000 (18:59 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 5 Jan 2022 12:31:40 +0000 (13:31 +0100)
commit149c690bb5dbd3f351a56933a39b02a572a7fdfa
treef722f5d8116e423f73b95c2ccfe2b4e9ba5c903a
parent83e5721e09928137cfac8ec0b4c43e164d9052c7
bpftool: Probe for bounded loop support

This patch introduces a new probe to check whether the verifier supports
bounded loops as introduced in commit f07a3d2cf663 ("bpf: introduce
bounded loops"). This patch will allow BPF users such as Cilium to probe
for loop support on startup and only unconditionally unroll loops on
older kernels.

The results are displayed as part of the miscellaneous section, as shown
below.

  $ bpftool feature probe | grep loops
  Bounded loop support is available
  $ bpftool feature probe macro | grep LOOPS
  #define HAVE_BOUNDED_LOOPS
  $ bpftool feature probe -j | jq .misc
  {
    "have_large_insn_limit": true,
    "have_bounded_loops": true
  }

Signed-off-by: Paul Chaignon <paul@isovalent.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Quentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/bpf/f7807c0b27d79f48e71de7b5a99c680ca4bd0151.1641314075.git.paul@isovalent.com
tools/bpf/bpftool/feature.c