From: Jiri Olsa <jolsa@redhat.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>,
dwarves@vger.kernel.org, bpf@vger.kernel.org,
Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andriin@fb.com>, Yonghong Song <yhs@fb.com>,
Hao Luo <haoluo@google.com>
Subject: Re: [PATCH 2/2] btf_encoder: Fix function generation
Date: Fri, 13 Nov 2020 19:11:32 +0100 [thread overview]
Message-ID: <20201113181132.GB842058@krava> (raw)
In-Reply-To: <20201113172832.GA446420@kernel.org>
On Fri, Nov 13, 2020 at 02:28:32PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Fri, Nov 13, 2020 at 04:12:22PM +0100, Jiri Olsa escreveu:
> > Current conditions for picking up function records break
> > BTF data on some gcc versions.
> >
> > Some function records can appear with no arguments but with
> > declaration tag set, so moving the 'fn->declaration' in front
> > of other checks.
> >
> > Then checking if argument names are present and finally checking
> > ftrace filter if it's present. If ftrace filter is not available,
> > using the external tag to filter out non external functions.
>
> Humm has_arg_names() will return true for a:
>
> void foo(void)
>
> function, which I think is right, but can't this function appear
> multiple times in different CUs and we end up with the same function
> multiple times in the BTF info?
so declarations should be filtered by the fn->declaration
check, if gcc has it ;-)
and if it goes through, the should_generate_function sets/checks
flag if the function was already generated
jirka
>
> - Arnaldo
>
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> > btf_encoder.c | 24 ++++++++++--------------
> > 1 file changed, 10 insertions(+), 14 deletions(-)
> >
> > diff --git a/btf_encoder.c b/btf_encoder.c
> > index d531651b1e9e..de471bc754b1 100644
> > --- a/btf_encoder.c
> > +++ b/btf_encoder.c
> > @@ -612,25 +612,21 @@ int cu__encode_btf(struct cu *cu, int verbose, bool force,
> > const char *name;
> >
> > /*
> > - * The functions_cnt != 0 means we parsed all necessary
> > - * kernel symbols and we are using ftrace location filter
> > - * for functions. If it's not available keep the current
> > - * dwarf declaration check.
> > + * Skip functions that:
> > + * - are marked as declarations
> > + * - do not have full argument names
> > + * - are not in ftrace list (if it's available)
> > + * - are not external (in case ftrace filter is not available)
> > */
> > + if (fn->declaration)
> > + continue;
> > + if (!has_arg_names(cu, &fn->proto))
> > + continue;
> > if (functions_cnt) {
> > - /*
> > - * We check following conditions:
> > - * - argument names are defined
> > - * - there's symbol and address defined for the function
> > - * - function address belongs to ftrace locations
> > - * - function is generated only once
> > - */
> > - if (!has_arg_names(cu, &fn->proto))
> > - continue;
> > if (!should_generate_function(btfe, function__name(fn, cu)))
> > continue;
> > } else {
> > - if (fn->declaration || !fn->external)
> > + if (!fn->external)
> > continue;
> > }
> >
> > --
> > 2.26.2
> >
>
> --
>
> - Arnaldo
>
next prev parent reply other threads:[~2020-11-13 18:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-13 15:12 [PATCHv2 0/2] btf_encoder: Fix functions BTF data generation Jiri Olsa
2020-11-13 15:12 ` [PATCH 1/2] btf_encoder: Generate also .init functions Jiri Olsa
2020-11-13 15:12 ` [PATCH 2/2] btf_encoder: Fix function generation Jiri Olsa
2020-11-13 17:28 ` Arnaldo Carvalho de Melo
2020-11-13 18:11 ` Jiri Olsa [this message]
2020-11-13 20:56 ` Andrii Nakryiko
2020-11-13 21:29 ` Jiri Olsa
2020-11-13 21:43 ` Andrii Nakryiko
2020-11-16 13:50 ` Arnaldo Carvalho de Melo
2020-11-16 18:21 ` Jiri Olsa
2020-11-16 19:15 ` Arnaldo Carvalho de Melo
2020-11-16 19:22 ` Arnaldo Carvalho de Melo
2020-11-16 19:40 ` Jiri Olsa
2020-11-16 19:44 ` Arnaldo Carvalho de Melo
2020-11-14 22:38 [PATCHv3 0/2] btf_encoder: Fix functions BTF data generation Jiri Olsa
2020-11-14 22:38 ` [PATCH 2/2] btf_encoder: Fix function generation Jiri Olsa
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=20201113181132.GB842058@krava \
--to=jolsa@redhat.com \
--cc=acme@kernel.org \
--cc=andriin@fb.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=dwarves@vger.kernel.org \
--cc=haoluo@google.com \
--cc=jolsa@kernel.org \
--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).