[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 3 Mar 2020 08:24:07 -0800
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Toke Høiland-Jørgensen <toke@...hat.com>
Cc: Andrey Ignatov <rdna@...com>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
Andrii Nakryiko <andriin@...com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Jesper Dangaard Brouer <brouer@...hat.com>,
John Fastabend <john.fastabend@...il.com>,
Lorenz Bauer <lmb@...udflare.com>,
Network Development <netdev@...r.kernel.org>,
bpf <bpf@...r.kernel.org>, Takshak Chahande <ctakshak@...com>
Subject: Re: [PATCH RFC] Userspace library for handling multiple XDP programs
on an interface
On Tue, Mar 3, 2020 at 1:50 AM Toke Høiland-Jørgensen <toke@...hat.com> wrote:
>
> This is the reason why I think the 'link' between the main program and
> the replacement program is in the "wrong direction". Instead I want to
> introduce a new attachment API that can be used instead of
> bpf_raw_tracepoint_open() - something like:
>
> prog_fd = sys_bpf(BPF_PROG_LOAD, ...); // dispatcher
> func_fd = sys_bpf(BPF_PROG_LOAD, ...); // replacement func
> err = sys_bpf(BPF_PROG_REPLACE_FUNC, prog_fd, btf_id, func_fd); // does *not* return an fd
>
> When using this, the kernel will flip the direction of the reference
> between BPF programs, so it goes main_prog -> replacement_prog. And
> instead of getting an fd back, this will make the replacement prog share
> its lifecycle with the main program, so that when the main program is
> released, so is the replacement (absent other references, of course).
> There could be an explicit 'release' command as well, of course, and a
> way to list all replacements on a program.
Nack to such api.
We hit this opposite direction issue with xdp and tc in the past.
Not going to repeat the same mistake again.
Powered by blists - more mailing lists