Re: [PATCH bpf-next v2 1/2] selftests/bpf: implement setting global variables in veristat

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 10, 2025 at 5:44 PM Eduard Zingerman <eddyz87@xxxxxxxxx> wrote:
>
> 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.
>

Yeah, it's a bit of a gotcha for sure, but especially for something
big like pyperf600 it does make a difference... I have a plan in mind
to speed this up with a bit more work on libbpf-side APIs
(bpf_object__prepare() API I mentioned in another thread a few days
ago), so we'll be able to get rid of this.

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





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux