BPF Archive on lore.kernel.org
 help / color / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Andrii Nakryiko <andriin@fb.com>, bpf <bpf@vger.kernel.org>,
	Network Development <netdev@vger.kernel.org>,
	Alexei Starovoitov <ast@fb.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Kernel Team <kernel-team@fb.com>,
	Anton Protopopov <a.s.protopopov@gmail.com>
Subject: Re: [PATCH bpf-next 0/3] Strip away modifiers from BPF skeleton global variables
Date: Wed, 1 Jul 2020 11:15:24 -0700
Message-ID: <CAEf4BzYqmNvhZ5ZkEHJsBRZYiMR5Muvn0QFCzV+XJek8jML4jw@mail.gmail.com> (raw)
In-Reply-To: <20200701163650.qoxr5xgjmz5mpzgn@ast-mbp.dhcp.thefacebook.com>

On Wed, Jul 1, 2020 at 9:36 AM Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
>
> On Wed, Jul 01, 2020 at 09:08:45AM -0700, Andrii Nakryiko wrote:
> > On Wed, Jul 1, 2020 at 8:02 AM Alexei Starovoitov
> > <alexei.starovoitov@gmail.com> wrote:
> > >
> > > On Tue, Jun 30, 2020 at 11:46 PM Andrii Nakryiko <andriin@fb.com> wrote:
> > > >
> > > > Fix bpftool logic of stripping away const/volatile modifiers for all global
> > > > variables during BPF skeleton generation. See patch #1 for details on when
> > > > existing logic breaks and why it's important. Support special .strip_mods=true
> > > > mode in btf_dump. Add selftests validating that everything works as expected.
> > >
> > > Why bother with the flag?
> >
> > You mean btf_dump should do this always? That's a bit too invasive a
> > change, I don't like it.
> >
> > > It looks like bugfix to me.
> >
> > It can be considered a bug fix for bpftool's skeleton generation, but
> > it depends on non-trivial changes in libbpf, which are not bug fix per
> > se, so should probably better go through bpf-next.
>
> I'm not following.
> Without tweaking opts and introducing new flag the actual fix is only
> two hunks in patch 1:

Right, but from the btf_dump point of view this is not a bug fix, its
current behavior is correct and precise. So this change is a change in
behavior and not universally correct for all the possible use cases.
So I can't just make it always strip modifiers, it's changing
generated output. It has to be an optional feature.


>
> @@ -1045,6 +1050,10 @@ static void btf_dump_emit_type_decl(struct btf_dump *d, __u32 id,
>
>         stack_start = d->decl_stack_cnt;
>         for (;;) {
> +               t = btf__type_by_id(d->btf, id);
> +               if (btf_is_mod(t))
> +                       goto skip_mod;
> +
>                 err = btf_dump_push_decl_stack_id(d, id);
>                 if (err < 0) {
>                         /*
> @@ -1056,12 +1065,11 @@ static void btf_dump_emit_type_decl(struct btf_dump *d, __u32 id,
>                         d->decl_stack_cnt = stack_start;
>                         return;
>                 }
> -
> +skip_mod:
>                 /* VOID */
>                 if (id == 0)
>                         break;
>
> -               t = btf__type_by_id(d->btf, id);
>

      reply index

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-01  6:45 Andrii Nakryiko
2020-07-01  6:45 ` [PATCH bpf-next 1/3] libbpf: support stripping modifiers for btf_dump Andrii Nakryiko
2020-07-01  6:45 ` [PATCH bpf-next 2/3] selftests/bpf: add selftest testin btf_dump's mod-stripping output Andrii Nakryiko
2020-07-01  6:47   ` Andrii Nakryiko
2020-07-01  6:45 ` [PATCH bpf-next 2/3] selftests/bpf: add selftest validating " Andrii Nakryiko
2020-07-01  6:45 ` [PATCH bpf-next 3/3] tools/bpftool: strip away modifiers from global variables Andrii Nakryiko
2020-07-01 15:01 ` [PATCH bpf-next 0/3] Strip away modifiers from BPF skeleton " Alexei Starovoitov
2020-07-01 16:08   ` Andrii Nakryiko
2020-07-01 16:36     ` Alexei Starovoitov
2020-07-01 18:15       ` 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=CAEf4BzYqmNvhZ5ZkEHJsBRZYiMR5Muvn0QFCzV+XJek8jML4jw@mail.gmail.com \
    --to=andrii.nakryiko@gmail.com \
    --cc=a.s.protopopov@gmail.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andriin@fb.com \
    --cc=ast@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.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

BPF Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/bpf/0 bpf/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 bpf bpf/ https://lore.kernel.org/bpf \
		bpf@vger.kernel.org
	public-inbox-index bpf

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.bpf


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git