From: Anton Protopopov <aspsk@isovalent.com>
To: Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Jiri Olsa <jolsa@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Stanislav Fomichev <sdf@google.com>,
Yonghong Song <yonghong.song@linux.dev>,
Eduard Zingerman <eddyz87@gmail.com>,
Quentin Monnet <quentin@isovalent.com>,
bpf@vger.kernel.org
Cc: Anton Protopopov <aspsk@isovalent.com>
Subject: [PATCH v1 bpf-next 0/9] BPF static branches
Date: Fri, 2 Feb 2024 16:28:04 +0000 [thread overview]
Message-ID: <20240202162813.4184616-1-aspsk@isovalent.com> (raw)
This series adds support for mapping between xlated and original
instructions offsets, mapping between xlated and jitted instructions
offsets (x86), support for two new BPF instruction JA[SRC=1]
(goto[l]_or_nop) and JA[SRC=3] (nop_or_goto[l]), and a new syscall to
configure the jitted values of such instructions.
This a follow up to the previous attempt to add static keys support
(see [1], [2]) which implements lower-level functionality than what
was proposed before.
The first patch .
The second patch adds xlated -> original mapping.
The third patch adds .
The fourth patch adds support for new instructions.
And the fifth patch adds support for new syscall.
The following patches are included:
Patch 1 is a formal bug fix
Patch 2 adds the xlated -> original mapping
Patch 3 adds the xlated -> jitted mapping
Patch 4 adds tests for instructions mappings
Patch 5 adds bpftool support for printing new instructions
Patch 6 add support for an extended JA instruction
Patch 7 add support for kernel/bpftool to display new instructions
Patch 8 adds a new BPF_STATIC_BRANCH_UPDATE syscall
Patch 9 adds tests for the new ja* instructions and the new syscall
Altogether this provides enough functionality to dynamically patch
programs and support simple static keys.
rfc -> v1:
- converted to v1 based on the feedback (there was none)
- bpftool support was added to dump new instructions
- self-tests were added
- minor fixes & checkpatch warnings
[1] https://lpc.events/event/17/contributions/1608/attachments/1278/2578/bpf-static-keys.pdf
[2] https://lore.kernel.org/bpf/20231206141030.1478753-1-aspsk@isovalent.com/
[3] https://github.com/llvm/llvm-project/pull/75110
Anton Protopopov (9):
bpf: fix potential error return
bpf: keep track of and expose xlated insn offsets
bpf: expose how xlated insns map to jitted insns
selftests/bpf: Add tests for instructions mappings
bpftool: dump new fields of bpf prog info
bpf: add support for an extended JA instruction
bpf: Add kernel/bpftool asm support for new instructions
bpf: add BPF_STATIC_BRANCH_UPDATE syscall
selftests/bpf: Add tests for new ja* instructions
arch/x86/net/bpf_jit_comp.c | 73 ++++-
include/linux/bpf.h | 11 +
include/linux/bpf_verifier.h | 1 -
include/linux/filter.h | 1 +
include/uapi/linux/bpf.h | 26 ++
kernel/bpf/core.c | 67 ++++-
kernel/bpf/disasm.c | 33 ++-
kernel/bpf/syscall.c | 115 ++++++++
kernel/bpf/verifier.c | 58 +++-
tools/bpf/bpftool/prog.c | 14 +
tools/bpf/bpftool/xlated_dumper.c | 18 ++
tools/bpf/bpftool/xlated_dumper.h | 2 +
tools/include/uapi/linux/bpf.h | 26 ++
.../bpf/prog_tests/bpf_insns_mappings.c | 156 ++++++++++
.../bpf/prog_tests/bpf_static_branches.c | 269 ++++++++++++++++++
.../selftests/bpf/progs/bpf_insns_mappings.c | 155 ++++++++++
16 files changed, 1002 insertions(+), 23 deletions(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/bpf_insns_mappings.c
create mode 100644 tools/testing/selftests/bpf/prog_tests/bpf_static_branches.c
create mode 100644 tools/testing/selftests/bpf/progs/bpf_insns_mappings.c
--
2.34.1
next reply other threads:[~2024-02-02 16:34 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-02 16:28 Anton Protopopov [this message]
2024-02-02 16:28 ` [PATCH v1 bpf-next 1/9] bpf: fix potential error return Anton Protopopov
2024-02-02 16:28 ` [PATCH v1 bpf-next 2/9] bpf: keep track of and expose xlated insn offsets Anton Protopopov
2024-02-02 16:28 ` [PATCH v1 bpf-next 3/9] bpf: expose how xlated insns map to jitted insns Anton Protopopov
2024-02-06 1:09 ` Alexei Starovoitov
2024-02-06 10:02 ` Anton Protopopov
2024-02-07 2:26 ` Alexei Starovoitov
2024-02-08 11:05 ` Anton Protopopov
2024-02-15 6:48 ` Alexei Starovoitov
2024-02-16 13:57 ` Anton Protopopov
2024-02-21 1:09 ` Alexei Starovoitov
2024-03-06 10:44 ` Anton Protopopov
2024-03-14 1:56 ` Alexei Starovoitov
2024-03-14 9:03 ` Anton Protopopov
2024-03-14 17:07 ` Alexei Starovoitov
2024-03-14 20:06 ` Andrii Nakryiko
2024-03-14 21:41 ` Alexei Starovoitov
2024-03-15 13:11 ` Anton Protopopov
2024-03-15 16:32 ` Andrii Nakryiko
2024-03-15 17:22 ` Alexei Starovoitov
2024-03-15 17:29 ` Andrii Nakryiko
2024-03-28 16:37 ` Anton Protopopov
2024-03-29 22:44 ` Andrii Nakryiko
2024-04-01 9:47 ` Anton Protopopov
2024-02-02 16:28 ` [PATCH v1 bpf-next 4/9] selftests/bpf: Add tests for instructions mappings Anton Protopopov
2024-02-02 16:28 ` [PATCH v1 bpf-next 5/9] bpftool: dump new fields of bpf prog info Anton Protopopov
2024-02-02 16:28 ` [PATCH v1 bpf-next 6/9] bpf: add support for an extended JA instruction Anton Protopopov
2024-02-02 16:28 ` [PATCH v1 bpf-next 7/9] bpf: Add kernel/bpftool asm support for new instructions Anton Protopopov
2024-02-02 16:28 ` [PATCH v1 bpf-next 8/9] bpf: add BPF_STATIC_BRANCH_UPDATE syscall Anton Protopopov
2024-02-02 16:28 ` [PATCH v1 bpf-next 9/9] selftests/bpf: Add tests for new ja* instructions Anton Protopopov
2024-02-02 22:39 ` [PATCH v1 bpf-next 0/9] BPF static branches Andrii Nakryiko
2024-02-04 16:05 ` Anton Protopopov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240202162813.4184616-1-aspsk@isovalent.com \
--to=aspsk@isovalent.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=jolsa@kernel.org \
--cc=martin.lau@linux.dev \
--cc=quentin@isovalent.com \
--cc=sdf@google.com \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox