From: "Toke Høiland-Jørgensen" <email@example.com> To: Edward Cree <firstname.lastname@example.org>, John Fastabend <email@example.com>, Alexei Starovoitov <firstname.lastname@example.org> Cc: Daniel Borkmann <email@example.com>, Alexei Starovoitov <firstname.lastname@example.org>, Martin KaFai Lau <email@example.com>, Song Liu <firstname.lastname@example.org>, Yonghong Song <email@example.com>, Marek Majkowski <firstname.lastname@example.org>, Lorenz Bauer <email@example.com>, Alan Maguire <firstname.lastname@example.org>, Jesper Dangaard Brouer <email@example.com>, David Miller <firstname.lastname@example.org>, email@example.com, firstname.lastname@example.org Subject: Re: [PATCH bpf-next v3 1/5] bpf: Support chain calling multiple BPF programs after each other Date: Thu, 17 Oct 2019 14:11:50 +0200 [thread overview] Message-ID: <email@example.com> (raw) In-Reply-To: <firstname.lastname@example.org> Edward Cree <email@example.com> writes: > On 15/10/2019 17:42, Toke Høiland-Jørgensen wrote: >> Edward Cree <firstname.lastname@example.org> writes: >>> On 14/10/2019 19:48, Toke Høiland-Jørgensen wrote: >>>> So that will end up with a single monolithic BPF program being loaded >>>> (from the kernel PoV), right? That won't do; we want to be able to go >>>> back to the component programs, and manipulate them as separate kernel >>>> objects. >>> Why's that? (Since it also applies to the static-linking PoC I'm >>> putting together.) What do you gain by having the components be >>> kernel-visible? >> Because then userspace will have to keep state to be able to answer >> questions like "show me the list of programs that are currently loaded >> (and their call chain)", or do operations like "insert this program into >> the call chain at position X". > Userspace keeps state for stuff all the time. We call them "daemons" ;) > Now you might have arguments for why putting a given piece of state in > userspace is a bad idea — there's a reason why not everything is a > microkernel — but those arguments need to be made. > >> We already keep all this state in the kernel, > The kernel keeps the state of "current (monolithic) BPF program loaded > (against each hook)". Prior to this patch series, the kernel does > *not* keep any state on what that BPF program was made of (except in > the sense of BTF debuginfos, which a linker could combine appropriately). > > So if we _don't_ add your chained-programs functionality into the kernel, > and then _do_ implement userspace linking, then there isn't any > duplicated functionality or even duplicated state — the userland state > is "what are my components and what's the linker invocation that glues > them together", the kernel state is "here is one monolithic BPF blob, > along with a BTF blob to debug it". The kernel knows nothing of the > former, and userspace doesn't store (but knows how to recreate) the > latter. I think there's a conceptual disconnect here in how we view what an XDP program is. In my mind, an XDP program is a stand-alone entity tied to a particular application; not a library function that can just be inserted into another program. Thus, what you're proposing sounds to me like the equivalent of saying "we don't want to do process management in the kernel; the init process should just link in all the programs userspace wants to run". Which is technically possible; but that doesn't make it a good idea. Setting aside that for a moment; the reason I don't think this belongs in userspace is that putting it there would carry a complexity cost that is higher than having it in the kernel. Specifically, if we do implement an 'xdpd' daemon to handle all this, that would mean that we: - Introduce a new, separate code base that we'll have to write, support and manage updates to. - Add a new dependency to using XDP (now you not only need the kernel and libraries, you'll also need the daemon). - Have to duplicate or wrap functionality currently found in the kernel; at least: - Keeping track of which XDP programs are loaded and attached to each interface (as well as the "new state" of their attachment order). - Some kind of interface with the verifier; if an app does xdpd_rpc_load(prog), how is the verifier result going to get back to the caller? - Have to deal with state synchronisation issues (how does xdpd handle kernel state changing from underneath it?). While these are issues that are (probably) all solvable, I think the cost of solving them is far higher than putting the support into the kernel. Which is why I think kernel support is the best solution :) -Toke
next prev parent reply other threads:[~2019-10-17 12:11 UTC|newest] Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-10-07 17:20 [PATCH bpf-next v3 0/5] xdp: Support multiple programs on a single interface through chain calls Toke Høiland-Jørgensen 2019-10-07 17:20 ` [PATCH bpf-next v3 1/5] bpf: Support chain calling multiple BPF programs after each other Toke Høiland-Jørgensen 2019-10-07 20:42 ` Alexei Starovoitov 2019-10-08 8:07 ` Toke Høiland-Jørgensen 2019-10-09 1:51 ` Alexei Starovoitov 2019-10-09 8:03 ` Toke Høiland-Jørgensen 2019-10-10 4:41 ` Alexei Starovoitov 2019-10-14 12:35 ` Toke Høiland-Jørgensen 2019-10-14 17:08 ` John Fastabend 2019-10-14 18:48 ` Toke Høiland-Jørgensen 2019-10-15 16:30 ` Edward Cree 2019-10-15 16:42 ` Toke Høiland-Jørgensen 2019-10-15 18:33 ` Edward Cree 2019-10-17 12:11 ` Toke Høiland-Jørgensen [this message] 2019-10-22 17:27 ` Edward Cree 2019-10-22 18:07 ` Toke Høiland-Jørgensen 2019-11-12 2:51 ` static and dynamic linking. Was: [PATCH bpf-next v3 1/5] bpf: Support chain calling multiple BPF Alexei Starovoitov 2019-11-12 16:20 ` Toke Høiland-Jørgensen 2019-11-12 19:52 ` Alexei Starovoitov 2019-11-12 21:25 ` Edward Cree 2019-11-12 23:18 ` Alexei Starovoitov 2019-11-13 18:30 ` Edward Cree 2019-11-13 18:51 ` Andrii Nakryiko 2019-11-15 2:13 ` Alexei Starovoitov 2019-11-15 16:56 ` John Fastabend 2019-11-12 23:25 ` John Fastabend 2019-11-13 0:21 ` Alexei Starovoitov 2019-11-13 5:33 ` John Fastabend 2019-11-15 1:50 ` Alexei Starovoitov 2019-11-15 16:39 ` John Fastabend 2019-11-14 15:41 ` Toke Høiland-Jørgensen 2019-11-12 16:32 ` Edward Cree 2019-11-15 11:48 ` Lorenz Bauer 2019-11-15 23:02 ` Alexei Starovoitov 2019-11-18 13:29 ` Lorenz Bauer 2019-10-21 23:51 ` [PATCH bpf-next v3 1/5] bpf: Support chain calling multiple BPF programs after each other Edward Cree 2019-10-16 2:28 ` Alexei Starovoitov 2019-10-16 8:27 ` Jesper Dangaard Brouer 2019-10-16 10:35 ` Daniel Borkmann 2019-10-16 11:16 ` Toke Høiland-Jørgensen 2019-10-16 13:51 ` Toke Høiland-Jørgensen 2019-10-19 20:09 ` bpf indirect calls Alexei Starovoitov 2019-10-20 10:58 ` Toke Høiland-Jørgensen 2019-10-25 16:30 ` Alexei Starovoitov 2019-10-27 12:15 ` Toke Høiland-Jørgensen 2019-10-09 10:19 ` [PATCH bpf-next v3 1/5] bpf: Support chain calling multiple BPF programs after each other Jesper Dangaard Brouer 2019-10-09 17:57 ` Alexei Starovoitov 2019-10-07 17:20 ` [PATCH bpf-next v3 2/5] bpf: Add support for setting chain call sequence for programs Toke Høiland-Jørgensen 2019-10-07 20:38 ` Daniel Borkmann 2019-10-08 8:09 ` Toke Høiland-Jørgensen 2019-10-07 17:20 ` [PATCH bpf-next v3 3/5] tools: Update bpf.h header for program chain calls Toke Høiland-Jørgensen 2019-10-07 17:20 ` [PATCH bpf-next v3 4/5] libbpf: Add syscall wrappers for BPF_PROG_CHAIN_* commands Toke Høiland-Jørgensen 2019-10-07 17:20 ` [PATCH bpf-next v3 5/5] selftests: Add tests for XDP chain calls Toke Høiland-Jørgensen 2019-10-07 18:58 ` [PATCH bpf-next v3 0/5] xdp: Support multiple programs on a single interface through " John Fastabend 2019-10-08 8:42 ` Toke Høiland-Jørgensen
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 \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --subject='Re: [PATCH bpf-next v3 1/5] bpf: Support chain calling multiple BPF programs after each other' \ /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
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).