From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Alan Maguire <alan.maguire@oracle.com>
Cc: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>,
Jiri Olsa <olsajiri@gmail.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Yonghong Song <yhs@fb.com>,
dwarves@vger.kernel.org, bpf@vger.kernel.org,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [RESEND] BTF is not generated for gcc-built kernel with the latest pahole
Date: Tue, 1 Aug 2023 18:45:49 -0300 [thread overview]
Message-ID: <ZMl9DaOadsdMi36c@kernel.org> (raw)
In-Reply-To: <bba3b423-8e38-ade3-7ce7-23b1be454d1f@oracle.com>
Em Tue, Aug 01, 2023 at 06:36:49PM +0100, Alan Maguire escreveu:
> On 01/08/2023 02:01, Masami Hiramatsu (Google) wrote:
> > On Mon, 31 Jul 2023 16:45:24 +0100
> > Alan Maguire <alan.maguire@oracle.com> wrote:
> >
> >> On 27/07/2023 02:51, Masami Hiramatsu (Google) wrote:
> >>> On Thu, 27 Jul 2023 09:38:14 +0900
> >>> Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:
> >>>
> >>>>> Yep, BPF generation is more selective about what it emits in 1.25 to
> >>>>> avoid cases where a kernel function signature is ambiguous (multiple
> >>>>> functions of the same name with different signatures) or where it has
> >>>>> unexpected register use. You can observe this via pahole's --verbose
> >>>>> option (a lot of outut is emitted):
> >>>>>
> >>>>> In a built kernel directory (where unstripped vmlinux is present):
> >>>>> $ PAHOLE_FLAGS=$(./scripts/pahole_flags)
> >>>>> $ PAHOLE=/usr/local/bin/pahole
> >>>>> $ pahole --verbose -J $PAHOLE_FLAGS vmlinux > /tmp/pahole.out
> >>>>
> >>>> So this will generate BTF from vmlinux DWARF info.
> >>>>
> >>>>> If you want to investigate why a function has been left out, look for
> >>>>> "skipping" verbose output like this:
> >>>>>
> >>>>> skipping addition of 'access_error'(access_error) due to multiple
> >>>>> inconsistent function prototypes
> >>>>> skipping addition of
> >>>>> 'acpi_ex_convert_to_object_type_string'(acpi_ex_convert_to_object_type_string.isra.0)
> >>>>> due to unexpected register used for parameter
> >>>>
> >>>> Ah, that's nice. Let me try.
> >>>
> >>> $ pahole --version
> >>> v1.23
> >>>
> >>
> >> shouldn't this be v1.25? Is it possible pahole is picking up the wrong
> >> libdwarves? what does "ldd pahole" say?
> >
> > Here it is.
> > $ ldd pahole
> > linux-vdso.so.1 (0x00007ffd6b1e2000)
> > libdwarves_reorganize.so.1 => /opt/local/pahole/libdwarves_reorganize.so.1 (0x00007f1ddaad9000)
> > libdwarves.so.1 => /opt/local/pahole/libdwarves.so.1 (0x00007f1ddaa72000)
> > libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1dda82a000)
> > libdw.so.1 => /usr/local/lib/x86_64-linux-gnu/libdw.so.1 (0x00007f1dda78c000)
> > libelf.so.1 => /usr/local/lib/x86_64-linux-gnu/libelf.so.1 (0x00007f1dda771000)
> > libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f1dda753000)
> > /lib64/ld-linux-x86-64.so.2 (0x00007f1ddaaef000)
> > libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f1dda74e000)
> > liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f1dda723000)
> > libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f1dda71e000)
> >
> > Maybe libdwarvers is not related, I could build pahole v1.23 and v1.22 without
> > sync the submodule.
> >
> > I also confirmed the same issue on Ubuntu 22.04's combination, which
> > update pahole from v1.22 to v1.25 recently. (but gcc is still v11.3)
> >
> > gcc-11.3 | clang-16.0
> > ---------------------------+----------------
> > v1.22 OK OK
> > (ubuntu)
> > v1.22 OK OK
> > (local)
> > v1.23 NG OK
> > (local)
> > v1.24 NG -
> > (local)
> > v1.25 NG -
> > (ubuntu)
> > v1.25 NG OK
> > (local)
> >
> > So, as far as I checked, there is something wrong between v1.22 and v1.23
> > which is also related to gcc-11.3.
> >
>
> One thing that is notable about gcc 11 is that I believe it's the first
> gcc release to emit DWARF5 by default. I wonder if it's possible that
> the kernel emitted DWARF5, but pahole was built with libraries that
> didn't support it yet? Not sure how that fits with the fact that
To check that please tweak:
⬢[acme@toolbox perf-tools-next]$ grep DWARF ../build/v6.2-rc5+/.config
CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
# CONFIG_DEBUG_INFO_DWARF4 is not set
# CONFIG_DEBUG_INFO_DWARF5 is not set
⬢[acme@toolbox perf-tools-next]$
i.e. disable CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT and enable
CONFIG_DEBUG_INFO_DWARF4.
- Arnaldo
> pahole v1.22 works though. If you have a chance, it might be worth
> experimenting with your kernel .config to specify DWARF4 to see if
> that makes a difference.
>
> You can check DWARF version associated with CUs with
>
> readelf --debug-dump=info vmlinux |grep -A 2 'Compilation Unit'
next prev parent reply other threads:[~2023-08-01 21:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-26 1:25 [RESEND] BTF is not generated for gcc-built kernel with the latest pahole Masami Hiramatsu
2023-07-26 10:04 ` Jiri Olsa
2023-07-26 11:07 ` Masami Hiramatsu
2023-07-26 14:46 ` Alan Maguire
2023-07-27 0:38 ` Masami Hiramatsu
2023-07-27 1:51 ` Masami Hiramatsu
2023-07-31 15:45 ` Alan Maguire
2023-08-01 1:01 ` Masami Hiramatsu
2023-08-01 17:36 ` Alan Maguire
[not found] ` <CA+JHD93Liq95RvfChifmnE7E9mKR42_W7rtpqgY9KAgYyGTZwQ@mail.gmail.com>
2023-08-01 18:28 ` Fwd: " Arnaldo Carvalho de Melo
2023-08-02 8:02 ` Masami Hiramatsu
2023-08-01 21:45 ` Arnaldo Carvalho de Melo [this message]
2023-08-02 14:29 ` Masami Hiramatsu
2023-07-27 13:10 ` 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=ZMl9DaOadsdMi36c@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=alan.maguire@oracle.com \
--cc=bpf@vger.kernel.org \
--cc=dwarves@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=olsajiri@gmail.com \
--cc=rostedt@goodmis.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 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.