bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Alexei Starovoitov <ast@kernel.org>, davem@davemloft.net
Cc: x86@kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org,
	kernel-team@fb.com
Subject: Re: [PATCH v4 bpf-next 00/20] Introduce BPF trampoline
Date: Sat, 16 Nov 2019 01:01:11 +0100	[thread overview]
Message-ID: <04793b36-6a71-92cf-76f0-a4863300b35c@iogearbox.net> (raw)
In-Reply-To: <20191114185720.1641606-1-ast@kernel.org>

On 11/14/19 7:57 PM, Alexei Starovoitov wrote:
> Introduce BPF trampoline that works as a bridge between kernel functions, BPF
> programs and other BPF programs.
> 
> The first use case is fentry/fexit BPF programs that are roughly equivalent to
> kprobe/kretprobe. Unlike k[ret]probe there is practically zero overhead to call
> a set of BPF programs before or after kernel function.
> 
> The second use case is heavily influenced by pain points in XDP development.
> BPF trampoline allows attaching similar fentry/fexit BPF program to any
> networking BPF program. It's now possible to see packets on input and output of
> any XDP, TC, lwt, cgroup programs without disturbing them. This greatly helps
> BPF-based network troubleshooting.
> 
> The third use case of BPF trampoline will be explored in the follow up patches.
> The BPF trampoline will be used to dynamicly link BPF programs. It's more
> generic mechanism than array and link list of programs used in tracing,
> networking, cgroups. In many cases it can be used as a replacement for
> bpf_tail_call-based program chaining. See [1] for long term design discussion.
> 
> v3->v4:
> - Included Peter's
>    "86/alternatives: Teach text_poke_bp() to emulate instructions" as a first patch.
>    If it changes between now and merge window, I'll rebease to newer version.
>    The patch is necessary to do s/text_poke/text_poke_bp/ in patch 3 to fix the race.
> - In patch 4 fixed bpf_trampoline creation race spotted by Andrii.
> - Added patch 15 that annotates prog->kern bpf context types. It made patches 16
>    and 17 cleaner and more generic.
> - Addressed Andrii's feedback in other patches.
> 
> v2->v3:
> - Addressed Song's and Andrii's comments
> - Fixed few minor bugs discovered while testing
> - Added one more libbpf patch
> 
> v1->v2:
> - Addressed Andrii's comments
> - Added more test for fentry/fexit to kernel functions. Including stress test
>    for maximum number of progs per trampoline.
> - Fixed a race btf_resolve_helper_id()
> - Added a patch to compare BTF types of functions arguments with actual types.
> - Added support for attaching BPF program to another BPF program via trampoline
> - Converted to use text_poke() API. That's the only viable mechanism to
>    implement BPF-to-BPF attach. BPF-to-kernel attach can be refactored to use
>    register_ftrace_direct() whenever it's available.
> 
> [1]
> https://lore.kernel.org/bpf/20191112025112.bhzmrrh2pr76ssnh@ast-mbp.dhcp.thefacebook.com/
> 
> Alexei Starovoitov (19):
>    bpf: refactor x86 JIT into helpers
>    bpf: Add bpf_arch_text_poke() helper
>    bpf: Introduce BPF trampoline
>    libbpf: Introduce btf__find_by_name_kind()
>    libbpf: Add support to attach to fentry/fexit tracing progs
>    selftest/bpf: Simple test for fentry/fexit
>    bpf: Add kernel test functions for fentry testing
>    selftests/bpf: Add test for BPF trampoline
>    selftests/bpf: Add fexit tests for BPF trampoline
>    selftests/bpf: Add combined fentry/fexit test
>    selftests/bpf: Add stress test for maximum number of progs
>    bpf: Reserve space for BPF trampoline in BPF programs
>    bpf: Fix race in btf_resolve_helper_id()
>    bpf: Annotate context types
>    bpf: Compare BTF types of functions arguments with actual types
>    bpf: Support attaching tracing BPF program to other BPF programs
>    libbpf: Add support for attaching BPF programs to other BPF programs
>    selftests/bpf: Extend test_pkt_access test
>    selftests/bpf: Add a test for attaching BPF prog to another BPF prog
>      and subprog

Applied, thanks!

      parent reply	other threads:[~2019-11-16  0:01 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-14 18:57 [PATCH v4 bpf-next 00/20] Introduce BPF trampoline Alexei Starovoitov
2019-11-14 18:57 ` [PATCH v4 bpf-next 01/20] x86/alternatives: Teach text_poke_bp() to emulate instructions Alexei Starovoitov
2019-11-14 18:57 ` [PATCH v4 bpf-next 02/20] bpf: refactor x86 JIT into helpers Alexei Starovoitov
2019-11-14 18:57 ` [PATCH v4 bpf-next 03/20] bpf: Add bpf_arch_text_poke() helper Alexei Starovoitov
2019-11-15 22:18   ` Andrii Nakryiko
2019-11-14 18:57 ` [PATCH v4 bpf-next 04/20] bpf: Introduce BPF trampoline Alexei Starovoitov
2019-11-14 18:57 ` [PATCH v4 bpf-next 05/20] libbpf: Introduce btf__find_by_name_kind() Alexei Starovoitov
2019-11-14 18:57 ` [PATCH v4 bpf-next 06/20] libbpf: Add support to attach to fentry/fexit tracing progs Alexei Starovoitov
2019-11-14 18:57 ` [PATCH v4 bpf-next 07/20] selftest/bpf: Simple test for fentry/fexit Alexei Starovoitov
2019-11-14 18:57 ` [PATCH v4 bpf-next 08/20] bpf: Add kernel test functions for fentry testing Alexei Starovoitov
2019-11-14 18:57 ` [PATCH v4 bpf-next 09/20] selftests/bpf: Add test for BPF trampoline Alexei Starovoitov
2019-11-14 18:57 ` [PATCH v4 bpf-next 10/20] selftests/bpf: Add fexit tests " Alexei Starovoitov
2019-11-14 18:57 ` [PATCH v4 bpf-next 11/20] selftests/bpf: Add combined fentry/fexit test Alexei Starovoitov
2019-11-14 18:57 ` [PATCH v4 bpf-next 12/20] selftests/bpf: Add stress test for maximum number of progs Alexei Starovoitov
2019-11-14 18:57 ` [PATCH v4 bpf-next 13/20] bpf: Reserve space for BPF trampoline in BPF programs Alexei Starovoitov
2019-11-14 18:57 ` [PATCH v4 bpf-next 14/20] bpf: Fix race in btf_resolve_helper_id() Alexei Starovoitov
2019-11-14 18:57 ` [PATCH v4 bpf-next 15/20] bpf: Annotate context types Alexei Starovoitov
2019-11-14 22:55   ` Song Liu
2019-11-14 23:01     ` Alexei Starovoitov
2019-11-14 23:19       ` Song Liu
2019-11-14 23:23   ` Song Liu
2019-11-14 18:57 ` [PATCH v4 bpf-next 16/20] bpf: Compare BTF types of functions arguments with actual types Alexei Starovoitov
2019-11-14 18:57 ` [PATCH v4 bpf-next 17/20] bpf: Support attaching tracing BPF program to other BPF programs Alexei Starovoitov
2019-11-14 23:30   ` Song Liu
2019-11-14 18:57 ` [PATCH v4 bpf-next 18/20] libbpf: Add support for attaching BPF programs " Alexei Starovoitov
2019-11-14 23:39   ` Song Liu
2019-11-14 18:57 ` [PATCH v4 bpf-next 19/20] selftests/bpf: Extend test_pkt_access test Alexei Starovoitov
2019-11-14 18:57 ` [PATCH v4 bpf-next 20/20] selftests/bpf: Add a test for attaching BPF prog to another BPF prog and subprog Alexei Starovoitov
2019-11-16  0:01 ` Daniel Borkmann [this message]

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=04793b36-6a71-92cf-76f0-a4863300b35c@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=davem@davemloft.net \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=x86@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).