bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	dwarves@vger.kernel.org, bpf <bpf@vger.kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andriin@fb.com>, Yonghong Song <yhs@fb.com>,
	Hao Luo <haoluo@google.com>, "Frank Ch. Eigler" <fche@redhat.com>,
	Mark Wielaard <mjw@redhat.com>
Subject: Re: [PATCH 3/3] btf_encoder: Change functions check due to broken dwarf
Date: Thu, 5 Nov 2020 23:56:17 +0100	[thread overview]
Message-ID: <20201105225617.GB4112111@krava> (raw)
In-Reply-To: <CAEf4BzZaUyY0TA_Gq559ojEeT2mHtdc3aUbvB9Q_4u0pZ+WiWQ@mail.gmail.com>

On Thu, Nov 05, 2020 at 11:52:35AM -0800, Andrii Nakryiko wrote:

SNIP

> > +        * Let's got through all collected functions and filter
> > +        * out those that are not in ftrace and init code.
> > +        */
> > +       for (i = 0; i < functions_cnt; i++) {
> > +               struct elf_function *func = &functions[i];
> > +
> > +               /*
> > +                * Do not enable .init section functions,
> > +                * but keep .init.bpf.preserve_type functions.
> > +                */
> > +               if (is_init(ms, func->addr) && !is_bpf_init(ms, func->addr))
> > +                       continue;
> > +
> > +               /* Make sure function is within ftrace addresses. */
> > +               if (bsearch(&func->addr, addrs, count, sizeof(addrs[0]), addrs_cmp)) {
> > +                       /*
> > +                        * We iterate over sorted array, so we can easily skip
> > +                        * not valid item and move following valid field into
> > +                        * its place, and still keep the 'new' array sorted.
> > +                        */
> > +                       if (i != functions_valid)
> > +                               functions[functions_valid] = functions[i];
> > +                       functions_valid++;
> > +               }
> > +       }
> 
> can we re-assign function_cnt = functions_valid here? and
> functions_valid could be just a local temporary variable?

good idea, should be simpler.. will change

and ack to all naming changes above ;-)

thanks,
jirka

> 
> > +
> > +       free(addrs);
> > +       return 0;
> > +}
> > +
> 
> [...]
> 


  reply	other threads:[~2020-11-05 22:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-04 21:59 [PATCHv3 0/3] pahole/kernel: Workaround dwarf bug for function encoding Jiri Olsa
2020-11-04 21:59 ` [PATCH 1/3] bpf: Move iterator functions into special init section Jiri Olsa
2020-11-05  1:01   ` Song Liu
2020-11-04 21:59 ` [PATCH 2/3] btf_encoder: Move find_all_percpu_vars in generic collect_symbols Jiri Olsa
2020-11-05 19:34   ` Andrii Nakryiko
2020-11-04 21:59 ` [PATCH 3/3] btf_encoder: Change functions check due to broken dwarf Jiri Olsa
2020-11-05 19:52   ` Andrii Nakryiko
2020-11-05 22:56     ` Jiri Olsa [this message]
2020-11-06 22:25 [PATCHv4 0/3] pahole/kernel: Workaround dwarf bug for function encoding Jiri Olsa
2020-11-06 22:25 ` [PATCH 3/3] btf_encoder: Change functions check due to broken dwarf Jiri Olsa
2020-11-11 19:59   ` Andrii Nakryiko
2020-11-11 20:19     ` Jiri Olsa
2020-11-11 20:26       ` Andrii Nakryiko
2020-11-11 20:49         ` Jiri Olsa
2020-11-11 20:31       ` Jiri Olsa
2020-11-11 20:36         ` Andrii Nakryiko
2020-11-12  0:36           ` Arnaldo Carvalho de Melo

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=20201105225617.GB4112111@krava \
    --to=jolsa@redhat.com \
    --cc=acme@kernel.org \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andriin@fb.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=dwarves@vger.kernel.org \
    --cc=fche@redhat.com \
    --cc=haoluo@google.com \
    --cc=jolsa@kernel.org \
    --cc=mjw@redhat.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 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).