This patch series adds new BPF Static Keys API and implements it for X86. The first three patches are preparatory to make main changes simpler. The fourth patch adds kernel API which allows to pass a list of "static branches" to kernel. A static branch is JA instruction which can be patched runtime by setting controlling map, aka static key, value to zero/non-zero. The fifth patch adds arch support for static keys on x86. The sixth patch adds libbpf support for static keys, which is more user-friendly than just passing a list of branches. Finally, the seventh patch adds some self-tests. See the Plumbers talk [1] for more details on the design. Anton Protopopov (7): bpf: extract bpf_prog_bind_map logic into an inline helper bpf: rename and export a struct definition bpf: adjust functions offsets when patching progs bpf: implement BPF Static Keys support bpf: x86: implement static keys support libbpf: BPF Static Keys support selftests/bpf: Add tests for BPF Static Keys MAINTAINERS | 7 + arch/x86/net/bpf_jit_comp.c | 72 +++ include/linux/bpf.h | 34 ++ include/uapi/linux/bpf.h | 18 + kernel/bpf/Makefile | 2 + kernel/bpf/arraymap.c | 15 +- kernel/bpf/core.c | 9 + kernel/bpf/skey.c | 306 ++++++++++++ kernel/bpf/syscall.c | 100 ++-- kernel/bpf/verifier.c | 103 ++++- tools/include/uapi/linux/bpf.h | 18 + tools/lib/bpf/bpf.c | 5 +- tools/lib/bpf/bpf.h | 4 +- tools/lib/bpf/bpf_helpers.h | 64 +++ tools/lib/bpf/libbpf.c | 273 ++++++++++- tools/lib/bpf/libbpf_internal.h | 3 + tools/lib/bpf/linker.c | 8 +- .../bpf/prog_tests/bpf_static_keys.c | 436 ++++++++++++++++++ .../selftests/bpf/progs/bpf_static_keys.c | 120 +++++ 19 files changed, 1542 insertions(+), 55 deletions(-) create mode 100644 kernel/bpf/skey.c create mode 100644 tools/testing/selftests/bpf/prog_tests/bpf_static_keys.c create mode 100644 tools/testing/selftests/bpf/progs/bpf_static_keys.c -- 2.34.1