]> 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)
commit96bd156ff27b85203a4867c6aa828c525f9e3cb2
treef722f5d8116e423f73b95c2ccfe2b4e9ba5c903a
parentee0e1deec32d145e8348741c7da1855c0ca12871
bpftool: Probe for bounded loop support

This patch introduces a new probe to check whether the verifier supports
bounded loops as introduced in commit 72e7382d8197 ("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