BPF List
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>,
	Mykyta Yatsenko <mykyta.yatsenko5@gmail.com>
Cc: bpf@vger.kernel.org, ast@kernel.org, andrii@kernel.org,
	daniel@iogearbox.net, 	kafai@meta.com, kernel-team@meta.com,
	Mykyta Yatsenko <yatsenko@meta.com>
Subject: Re: [PATCH bpf-next v2 1/2] selftests/bpf: implement setting global variables in veristat
Date: Mon, 10 Feb 2025 17:44:41 -0800	[thread overview]
Message-ID: <fba26c0939c3de14527774cd3d466b2f7ca33192.camel@gmail.com> (raw)
In-Reply-To: <CAEf4BzYVWSogUYk8pEPGs0N4eNb5fcXtmFMLkicokmqHPpbZCg@mail.gmail.com>

On Mon, 2025-02-10 at 17:13 -0800, Andrii Nakryiko wrote:

[...]

> > @@ -1334,17 +1634,6 @@ static int process_obj(const char *filename)
> > 
> >         env.files_processed++;
> > 
> > -       bpf_object__for_each_program(prog, obj) {
> > -               prog_cnt++;
> > -       }
> > -
> > -       if (prog_cnt == 1) {
> > -               prog = bpf_object__next_program(obj, NULL);
> > -               bpf_program__set_autoload(prog, true);
> > -               process_prog(filename, obj, prog);
> > -               goto cleanup;
> > -       }
> > -
> 
> I think this was an optimization to avoid a heavy-weight ELF parsing
> twice, why would we want to remove it?..
> 
> pw-bot: cr

The v1 of this patch missed the case that globals have to be set in
both cases, when prog_cnt == 1 and prog_cnt != 1. I remember making
same mistake when debugging something unrelated. Hence I suggested
removing this special case.

> >         bpf_object__for_each_program(prog, obj) {
> >                 const char *prog_name = bpf_program__name(prog);
> > 


  reply	other threads:[~2025-02-11  1:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-10 13:51 [PATCH bpf-next v2 0/2] selftests/bpf: implement setting global variables in veristat Mykyta Yatsenko
2025-02-10 13:51 ` [PATCH bpf-next v2 1/2] " Mykyta Yatsenko
2025-02-11  1:13   ` Andrii Nakryiko
2025-02-11  1:44     ` Eduard Zingerman [this message]
2025-02-11 20:55       ` Andrii Nakryiko
2025-02-11 15:00     ` Mykyta Yatsenko
2025-02-11 20:53       ` Andrii Nakryiko
2025-02-11  1:24   ` Eduard Zingerman
2025-02-11 15:07     ` Mykyta Yatsenko
2025-02-10 13:51 ` [PATCH bpf-next v2 2/2] selftests/bpf: introduce veristat test Mykyta Yatsenko
2025-02-11  3:01   ` Eduard Zingerman
2025-02-11 15:09     ` Mykyta Yatsenko

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=fba26c0939c3de14527774cd3d466b2f7ca33192.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kafai@meta.com \
    --cc=kernel-team@meta.com \
    --cc=mykyta.yatsenko5@gmail.com \
    --cc=yatsenko@meta.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