bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Alexei Starovoitov <ast@fb.com>
Cc: Andrii Nakryiko <andriin@fb.com>,
	"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"daniel@iogearbox.net" <daniel@iogearbox.net>,
	Kernel Team <Kernel-team@fb.com>,
	Quentin Monnet <quentin.monnet@netronome.com>
Subject: Re: [PATCH bpf-next 3/3] libbpf: auto-generate list of BPF helper definitions
Date: Sat, 5 Oct 2019 19:29:43 -0700	[thread overview]
Message-ID: <CAEf4Bzb1XF0HpJoW1d4Wa-bQu72fXtH181vi7GpDm5hVKNVgxw@mail.gmail.com> (raw)
In-Reply-To: <c621f33f-4c17-f96f-e2f5-625d452f3df3@fb.com>

On Sat, Oct 5, 2019 at 6:01 PM Alexei Starovoitov <ast@fb.com> wrote:
>
> On 10/5/19 11:24 AM, Andrii Nakryiko wrote:
> > On Sat, Oct 5, 2019 at 10:10 AM Alexei Starovoitov <ast@fb.com> wrote:
> >>
> >> On 10/5/19 12:59 AM, Andrii Nakryiko wrote:
> >>> Get rid of list of BPF helpers in bpf_helpers.h (irony...) and
> >>> auto-generate it into bpf_helpers_defs.h, which is now included from
> >>> bpf_helpers.h.
> >>>
> >>> Suggested-by: Alexei Starovoitov<ast@fb.com>
> >>> Signed-off-by: Andrii Nakryiko<andriin@fb.com>
> >>> ---
> >>>    tools/lib/bpf/Makefile           |    8 +-
> >>>    tools/lib/bpf/bpf_helpers.h      |  264 +--
> >>>    tools/lib/bpf/bpf_helpers_defs.h | 2677 ++++++++++++++++++++++++++++++
> >>>    3 files changed, 2685 insertions(+), 264 deletions(-)
> >>>    create mode 100644 tools/lib/bpf/bpf_helpers_defs.h
> >>
> >> Approach looks good to me.
> >> imo that's better than messing with macros.
> >>
> >> Using bpf_helpers_doc.py as part of build will help man pages too.
> >> I think we were sloppy documenting helpers, since only Quentin
> >> was running that script regularly.
> >
> > Yep, I agree, I had to fix few things, as well as (char *) vs (void *)
> > vs (__u8 *) differences were causing some extra warnings.
> > Please check the list of type translations whether they make sense.
>
> yes. These conversions make sense.

cool, thanks for checking!

> Only one sk_buff->__sk_buff won't work for too long.
> Once my btf vmlinux stuff lands both structs will be possible.

I guess it will have to be sk_buff -> void conversion then, but we'll
do it later.

>
> >>
> >> Only question is what is the reason to commit generated .h into git?
> >
> > So originally I didn't want to depend on system UAPI headers during
> > Github build. But now I recalled that we do have latest UAPI synced
> > into Github's include/ subdir, so that's not an obstacle really. We'll
> > just need to re-license bpf_helpers_doc.py (I don't think Quentin will
> > mind) and start syncing it to Github (not a big deal at all).
>
> github sync script can run make, grab generated .h,
> and check it in into github.

Haven't considered that. That will work as well, a bit more work for
me on sync script side, but that's ok.

>
> >
> > There is still a benefit in having it checked in: easy to spot if
> > script does something wrong and double-check the changes (after
> > initial big commit, of course).
> >
> > If you think that's not reason enough, let me know and I can drop it in v2.
>
> I don't remember too many cases when generated files were committed.
> My preference to keep it out of kernel git.
> github/libbpf is a pure mirror. That .h can be committed there.
> The whole thing is automatic, so we don't need to move .py
> into github too.
>

Yeah, makes sense, will submit v2 w/ bpf_helpers_defs.h added to .gitignore

      reply	other threads:[~2019-10-06  2:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-05  7:59 [PATCH bpf-next 0/3] Auto-generate list of BPF helpers Andrii Nakryiko
2019-10-05  7:59 ` [PATCH bpf-next 1/3] uapi/bpf: fix helper docs Andrii Nakryiko
2019-10-05  7:59 ` [PATCH bpf-next 2/3] scripts/bpf: teach bpf_helpers_doc.py to dump BPF helper definitions Andrii Nakryiko
     [not found] ` <20191005075921.3310139-4-andriin@fb.com>
2019-10-05 17:10   ` [PATCH bpf-next 3/3] libbpf: auto-generate list of " Alexei Starovoitov
2019-10-05 18:24     ` Andrii Nakryiko
2019-10-06  1:01       ` Alexei Starovoitov
2019-10-06  2:29         ` Andrii Nakryiko [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=CAEf4Bzb1XF0HpJoW1d4Wa-bQu72fXtH181vi7GpDm5hVKNVgxw@mail.gmail.com \
    --to=andrii.nakryiko@gmail.com \
    --cc=Kernel-team@fb.com \
    --cc=andriin@fb.com \
    --cc=ast@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=netdev@vger.kernel.org \
    --cc=quentin.monnet@netronome.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 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).