dwarves.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Jiri Olsa <jolsa@kernel.org>
Cc: 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: [RFC 0/3] pahole: Workaround dwarf bug for function encoding
Date: Tue, 27 Oct 2020 16:13:46 -0700	[thread overview]
Message-ID: <CAEf4Bzav_WF3duq4JYmaPvyUXdREkXJMPAb+ASUxAxq_mqXd5Q@mail.gmail.com> (raw)
In-Reply-To: <20201026223617.2868431-1-jolsa@kernel.org>

On Mon, Oct 26, 2020 at 5:07 PM Jiri Olsa <jolsa@kernel.org> wrote:
>
> hi,
> because of gcc bug [1] we can no longer rely on DW_AT_declaration
> attribute to filter out declarations and end up with just
> one copy of the function in the BTF data.
>
> It seems this bug is not easy to fix, but regardless if the
> it's coming soon, it's probably good idea not to depend so
> much only on dwarf data and make some extra checks.
>
> Thus for function encoding we are now doing following checks:
>   - argument names are defined for the function
>   - there's symbol and address defined for the function
>   - function is generated only once
>
> These checks ensure that we encode function with defined
> symbol/address and argument names.
>
> I marked this post as RFC, because with this workaround in
> place we are also encoding assembly functions, which were
> not present when using the previous gcc version.
>
> Full functions diff to previous gcc working version:
>
>   http://people.redhat.com/~jolsa/functions.diff.txt
>
> I'm not sure this does not break some rule for functions in
> BTF data, becuse those assembly functions are not attachable
> by bpf trampolines, so I don't think there's any use for them.

What will happen if we do try to attach to those assembly functions?
Will there be some corruption or crash, or will it just fail and
return error cleanly? What we actually want in BTF is all the
functions that are attachable through BPF trampoline, which is all the
functions that ftrace subsystem can attach to, right? So how does
ftrace system know what can or cannot be attached to?

>
> thoughts?
> jirka
>
>
> [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97060
> ---
> Jiri Olsa (3):
>       btf_encoder: Move find_all_percpu_vars in generic config function
>       btf_encoder: Change functions check due to broken dwarf
>       btf_encoder: Include static functions to BTF data
>
>  btf_encoder.c | 221 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------
>  elf_symtab.h  |   8 +++++
>  2 files changed, 170 insertions(+), 59 deletions(-)
>

  parent reply	other threads:[~2020-10-28  1:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-26 22:36 [RFC 0/3] pahole: Workaround dwarf bug for function encoding Jiri Olsa
2020-10-26 22:36 ` [PATCH 1/3] btf_encoder: Move find_all_percpu_vars in generic config function Jiri Olsa
2020-10-27 23:12   ` Andrii Nakryiko
2020-10-27 23:54     ` Hao Luo
2020-10-28 15:51     ` Jiri Olsa
2020-10-26 22:36 ` [PATCH 2/3] btf_encoder: Change functions check due to broken dwarf Jiri Olsa
2020-10-27 23:20   ` Andrii Nakryiko
2020-10-28 15:50     ` Jiri Olsa
2020-10-26 22:36 ` [PATCH 3/3] btf_encoder: Include static functions to BTF data Jiri Olsa
2020-10-27 23:21   ` Andrii Nakryiko
2020-10-28 15:53     ` Jiri Olsa
2020-10-27 23:13 ` Andrii Nakryiko [this message]
2020-10-28 15:49   ` [RFC 0/3] pahole: Workaround dwarf bug for function encoding 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=CAEf4Bzav_WF3duq4JYmaPvyUXdREkXJMPAb+ASUxAxq_mqXd5Q@mail.gmail.com \
    --to=andrii.nakryiko@gmail.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 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).