From: Jiri Olsa <jolsa@redhat.com>
To: Jiri Olsa <jolsa@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@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>, "Frank Ch. Eigler" <fche@redhat.com>,
Mark Wielaard <mjw@redhat.com>
Subject: Re: [PATCH 2/2] btf_encoder: Change functions check due to broken dwarf
Date: Mon, 2 Nov 2020 23:56:58 +0100 [thread overview]
Message-ID: <20201102225658.GD3597846@krava> (raw)
In-Reply-To: <20201102215908.GC3597846@krava>
On Mon, Nov 02, 2020 at 10:59:08PM +0100, Jiri Olsa wrote:
> On Sat, Oct 31, 2020 at 11:31:31PM +0100, Jiri Olsa wrote:
> > We need to generate just single BTF instance for the
> > function, while DWARF data contains multiple instances
> > of DW_TAG_subprogram tag.
> >
> > Unfortunately we can no longer rely on DW_AT_declaration
> > tag (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97060)
> >
> > Instead we apply following checks:
> > - argument names are defined for the function
> > - there's symbol and address defined for the function
> > - function is generated only once
> >
> > Also because we want to follow kernel's ftrace traceable
> > functions, this patchset is adding extra check that the
> > function is one of the ftrace's functions.
> >
> > All ftrace functions addresses are stored in vmlinux
> > binary within symbols:
> > __start_mcount_loc
> > __stop_mcount_loc
>
> hum, for some reason this does not pass through bpf internal
> functions like bpf_iter_bpf_map.. I learned it hard way ;-)
> will check
so it gets filtered out because it's __init function
I'll check if the fix below catches all internal functions,
but I guess we should do something more robust
jirka
---
diff --git a/btf_encoder.c b/btf_encoder.c
index 0a378aa92142..3cd94280c35b 100644
--- a/btf_encoder.c
+++ b/btf_encoder.c
@@ -143,7 +143,8 @@ static int filter_functions(struct btf_elf *btfe, struct mcount_symbols *ms)
/* Do not enable .init section functions. */
if (init_filter &&
func->addr >= ms->init_begin &&
- func->addr < ms->init_end)
+ func->addr < ms->init_end &&
+ strncmp("bpf_", func->name, 4))
continue;
/* Make sure function is within mcount addresses. */
next prev parent reply other threads:[~2020-11-02 22:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-31 22:31 [PATCHv2 0/2] pahole: Workaround dwarf bug for function encoding Jiri Olsa
2020-10-31 22:31 ` [PATCH 1/2] btf_encoder: Move find_all_percpu_vars in generic collect_symbols Jiri Olsa
2020-11-02 18:29 ` Hao Luo
2020-11-03 17:31 ` Arnaldo Carvalho de Melo
2020-10-31 22:31 ` [PATCH 2/2] btf_encoder: Change functions check due to broken dwarf Jiri Olsa
2020-11-02 21:59 ` Jiri Olsa
2020-11-02 22:56 ` Jiri Olsa [this message]
2020-11-03 18:58 ` Andrii Nakryiko
2020-11-03 19:05 ` Jiri Olsa
2020-11-03 19:23 ` Andrii Nakryiko
2020-11-03 19:34 ` Jiri Olsa
2020-11-03 20:27 ` Yonghong Song
2020-11-03 23:18 ` Jiri Olsa
2020-11-03 18:55 ` Andrii Nakryiko
2020-11-03 23:22 ` 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=20201102225658.GD3597846@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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.