From: Yonghong Song <yhs@fb.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>,
Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>, 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>, Hao Luo <haoluo@google.com>
Subject: Re: [RFC/PATCH 3/3] btf_encoder: Func generation fix
Date: Thu, 12 Nov 2020 17:00:59 -0800 [thread overview]
Message-ID: <7834ab75-6e08-9f95-4885-d65298011ad8@fb.com> (raw)
In-Reply-To: <CAEf4BzZhRPVf=qVU7vVrtVaJzvBmsWL3hHYySKczMrrO-1Xotw@mail.gmail.com>
On 11/12/20 4:30 PM, Andrii Nakryiko wrote:
> On Thu, Nov 12, 2020 at 4:19 PM Alexei Starovoitov
> <alexei.starovoitov@gmail.com> wrote:
>>
>> On Thu, Nov 12, 2020 at 4:08 PM Andrii Nakryiko
>> <andrii.nakryiko@gmail.com> wrote:
>>>
>>> So I looked at your vmlinux image. I think we should just keep
>>> everything mostly as it it right now (without changes in this patch),
>>> but add just two simple checks:
>>>
>>> 1. Skip if fn->declaration (ignore correctly marked func declarations)
>>> 2. Skip if DW_AT_inline: 1 (ignore inlined functions).
>>>
>>> I'd keep the named arguments check as is, I think it's helpful. 1)
>>> will skip stuff that's explicitly marked as declaration. 2) inline
>>> check will partially mitigate dropping of fn->external check (and we
>>> can't really attach to inlined functions).
>>
>> I thought DW_AT_inline is an indication that the function was marked "inline"
>> in C code. That doesn't mean that the function was actually inlined.
>> So I don't think pahole should check that bit.
>
> According to DWARF spec, there are 4 possible values:
>
> DW_INL_not_inlined = 0 Not declared inline nor inlined by
> the compiler
> DW_INL_inlined = 1 Not declared inline but inlined by
> the compiler
> DW_INL_declared_not_inlined = 2 Declared inline but not inlined by
> the compiler
> DW_INL_declared_inlined = 3 Declared inline and inlined by the compiler
>
> So DW_INL_inlined is supposed to be added to functions that are not
> marked inline, but were nevertheless inlined. I saw this for one of
> vfs_getattr entries in DWARF, which clearly is not marked inline.
I looked at llvm source code, llvm only tries to assign DW_INL_inlined
and also only at certain conditions. Not sure about gcc. Probably
similar. So this field is not reliable, esp. without it does not mean it
is not inlined.
>
> But also that DWARF entry had proper args with names, so it would work
> fine as well. I don't know, with DWARF it's always some guessing game.
> Let's leave DW_AT_inline alone for now.
>
> Important part is skipping declarations (when they are marked as
> such), though I'm not claiming it will solve the problem completely...
> :)
>
next prev parent reply other threads:[~2020-11-13 1:01 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-12 15:05 [RFC 0/3] btf_encoder: Fix functions BTF data generation Jiri Olsa
2020-11-12 15:05 ` [RFC/PATCH 1/3] btf_encoder: Generate also .init functions Jiri Olsa
2020-11-12 19:37 ` Andrii Nakryiko
2020-11-12 15:05 ` [RFC/PATCH 2/3] btf_encoder: Put function generation code to generate_func Jiri Olsa
2020-11-12 19:39 ` Andrii Nakryiko
2020-11-12 15:05 ` [RFC/PATCH 3/3] btf_encoder: Func generation fix Jiri Olsa
2020-11-12 19:54 ` Andrii Nakryiko
2020-11-12 21:14 ` Jiri Olsa
2020-11-13 0:08 ` Andrii Nakryiko
2020-11-13 0:18 ` Alexei Starovoitov
2020-11-13 0:30 ` Andrii Nakryiko
2020-11-13 1:00 ` Yonghong Song [this message]
2020-11-13 1:12 ` Andrii Nakryiko
2020-11-13 10:59 ` Jiri Olsa
2020-11-13 11:52 ` 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=7834ab75-6e08-9f95-4885-d65298011ad8@fb.com \
--to=yhs@fb.com \
--cc=acme@kernel.org \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii.nakryiko@gmail.com \
--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=jolsa@redhat.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