All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: "Toke Høiland-Jørgensen" <toke@redhat.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>,
	Stanislav Fomichev <sdf@google.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Song Liu <song@kernel.org>, Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>, bpf <bpf@vger.kernel.org>,
	David Vernet <void@manifault.com>,
	Jesper Dangaard Brouer <brouer@redhat.com>
Subject: Re: [RFC PATCH v2] Documentation/bpf: Add a description of "stable kfuncs"
Date: Wed, 25 Jan 2023 21:34:41 -0800	[thread overview]
Message-ID: <CAADnVQ+q3uq6ex7NHZmP=x9rfsLCydE=97=V=cBcbO8yS0eySg@mail.gmail.com> (raw)
In-Reply-To: <875ycvo1im.fsf@toke.dk>

On Tue, Jan 24, 2023 at 5:18 PM Toke Høiland-Jørgensen <toke@redhat.com> wrote:
>
> Alexei Starovoitov <alexei.starovoitov@gmail.com> writes:
>
> > The bpf developers adding new kfunc should assume that it's stable and proceed
> > to use it in bpf progs and production applications.
>
> "Assume all kfuncs are stable" is fine by me, but that is emphatically
> not what we have been saying thus far, quite the opposite...
>
> > The bpf maintainers will keep this stability promise. They obviously will not
> > reap it out of the kernel on the whim, but they will nuke it if this kfunc
> > will be in the way of the kernel innovation.
>
> ...and it is contradicted by this last bit. I mean "it's stable, but
> we'll remove it if it's in the way" is not, well, stable.

Schrodinger's kfuncs :)

> [...]
>
> > bpf developers and users should assume that all kfuncs are stable and use them.
> > When somebody comes to argue that a particular kfunc needs to change
> > the developer who added that kfunc better to be around to argue that the kfunc is
> > perfect the way it is. If developer is gone the maintainers will make a call.
> > It's a self regulating system.
> > kfuncs will be stable if developers/users are around.
> > Yet the maintainers will have a freedom to change if absolutely necessary.
>
> This assumes users (i.e., BPF program authors) are around during the
> development phase, which they are generally not. Except for the users
> who are also BPF devs, but that's a minority (if not now, hopefully in
> the future). So I really think we need to document some expectations
> here.
>
> For instance, what happens if we change a kfunc, and a user shows up
> during the -rc phase saying it broke their application? Are we going to
> revert that change?

It depends.
Obviously we're not going to change/remove/deprecate kfuncs unless
there is a need to do so.
And when we do we will consider all users.

> > Back to deprecation...
> > I think KF_DEPRECATED is a good idea.
> > When kfunc will be auto emitted into vmlinux.h (or whatever other file)
> > or shipped in libbpf header we can emit
> > __attribute__((deprecated("reason", "replacement")));
> > to that header file (so it's seen during bpf prog build) and
> > start dmesg warn on them in the verifier.
> > Kernel splats do get noticed. The users would have to act quickly.
>
> So how about documenting that bit? Something like:
>
> "We promise that kfuncs will not be removed without going through a
> deprecation phase. The length of the deprecation will be proportional to
> how long that kfunc has existed in the kernel, but will be no shorter
> than XX kernel releases." ?

That's not something we can promise.
Take conntrack kfuncs. If netfilter folks decide to sunset
conntrack tomorrow we won't be standing in their way.

On the other side the dynptr kfuncs are going to stay as-is for
foreseeable future because they don't rely on other kernel
subsystems to do the job.
Both cases may still change if users themselves
(after using it in prod) come back with reasons to change it.

In the past the kernel devs were dictating the helper uapi to
users and users had no option, but to shut up and use what's available.
Now they will be able to use new apis and request changes.
At that point it will be a set of users X vs a set of users Y.
If ten users say that this kfunc sucks while one user
wants to keep it as-is we will introduce another kfunc and
will start deprecating the one that lost the vote.
The deprecation time window will depend on case by case
considering maintenance cost, etc.

> > As far as KF_STABLE... I think it hurts the system in the long run.
> > The developer can argue at one point in time that kfunc has to be KF_STABLE.
> > The patch will be applied, but the developer is off the hook and can disappear.
> > The maintainers would have to argue on behalf of the developer
> > and keep maintaining it? The maintainers won't have a signal whether
> > kfunc is still useful after initial KF_STABLE patch.
>
> Doing the above wrt deprecation without having an explicit stable tag
> would be OK with me.
>
> > I think it's more important to decide how we document kfuncs and
> > how equivalent of bpf_helper_defs.h can be done.
>
> I agree we (also) need to do this. As well as have some support for
> querying for them from userspace on a running kernel (for CO-RE
> purposes).

Of course. That has been brought up many times.
Just do it. Whoever has time to do it.

  reply	other threads:[~2023-01-26  5:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-17 21:27 [RFC PATCH v2] Documentation/bpf: Add a description of "stable kfuncs" Toke Høiland-Jørgensen
2023-01-17 21:53 ` Stanislav Fomichev
2023-01-17 22:03   ` Toke Høiland-Jørgensen
2023-01-17 22:20     ` Stanislav Fomichev
2023-01-17 23:19       ` Alexei Starovoitov
2023-01-18  2:00         ` Stanislav Fomichev
2023-01-18 10:48           ` Daniel Borkmann
2023-01-18 16:53             ` David Vernet
2023-01-19  4:32             ` Alexei Starovoitov
2023-01-24 17:17               ` Andrii Nakryiko
2023-01-24 19:54                 ` Andrii Nakryiko
2023-01-25  1:18               ` Toke Høiland-Jørgensen
2023-01-26  5:34                 ` Alexei Starovoitov [this message]
2023-01-27 17:50                   ` Toke Høiland-Jørgensen
2023-01-18 15:53 ` David Vernet

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='CAADnVQ+q3uq6ex7NHZmP=x9rfsLCydE=97=V=cBcbO8yS0eySg@mail.gmail.com' \
    --to=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=brouer@redhat.com \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=sdf@google.com \
    --cc=song@kernel.org \
    --cc=toke@redhat.com \
    --cc=void@manifault.com \
    --cc=yhs@fb.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.