public inbox for dwarves@vger.kernel.org
 help / color / mirror / Atom feed
From: Alan Maguire <alan.maguire@oracle.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>,
	Clark Williams <williams@redhat.com>,
	Kate Carcia <kcarcia@redhat.com>,
	dwarves@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Matthias Schwarzott <zzam@gentoo.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>
Subject: Re: [PATCH 3/5] pahole: Honour exclusive BTF loading
Date: Tue, 19 Nov 2024 17:47:21 +0000	[thread overview]
Message-ID: <0ddffba9-eb26-456b-bfa6-68bf94e8b481@oracle.com> (raw)
In-Reply-To: <20241119134032.783215-4-acme@kernel.org>

On 19/11/2024 13:40, Arnaldo Carvalho de Melo wrote:
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> When we specify 'btf' and BTF info is available in the system, in the
> /sys/kernel/btf/vmlinux file, pahole will find it and use it to get the
> type information asked for:
> 
>   root@x1:~# perf trace -o /tmp/output -e openat pahole -F btf list_head ; tail -1 /tmp/output
>   struct list_head {
>   	struct list_head *         next;                 /*     0     8 */
>   	struct list_head *         prev;                 /*     8     8 */
> 
>   	/* size: 16, cachelines: 1, members: 2 */
>   	/* last cacheline: 16 bytes */
>   };
> 
>        1.579 ( 0.010 ms): pahole/764777 openat(dfd: CWD, filename: "/sys/kernel/btf/vmlinux", flags: RDONLY|CLOEXEC) = 3
>   root@x1:~#
> 
> But, if the system doesn't have BTF info, which we now can simulate by using an
> environment variable it is tryng DWARF after failing for BTF, which isn't what
> the user asked for having specified just btf in the -F pahole command line:
> 
>   root@x1:~# export PAHOLE_VMLINUX_BTF_FILENAME=non-existent
>   root@x1:~# perf trace -o /tmp/output -e openat,access pahole -F btf list_head ; tail -12 /tmp/output
>   struct list_head {
>   	struct list_head *         next;                 /*     0     8 */
>   	struct list_head *         prev;                 /*     8     8 */
> 
>   	/* size: 16, cachelines: 1, members: 2 */
>   	/* last cacheline: 16 bytes */
>   };
> 
>   1.643 ( 0.003 ms): pahole/765220 access(filename: "list_head", mode: R)      = -1 ENOENT (No such file or directory)
>   1.658 ( 0.002 ms): pahole/765220 access(filename: "non-existent", mode: R)   = -1 ENOENT (No such file or directory)
>   1.697 ( 0.018 ms): pahole/765220 openat(dfd: CWD, filename: "/sys/kernel/notes") = 3
>   1.801 ( 0.004 ms): pahole/765220 openat(dfd: CWD, filename: "vmlinux")       = -1 ENOENT (No such file or directory)
>   1.807 ( 0.005 ms): pahole/765220 openat(dfd: CWD, filename: "/boot/vmlinux") = -1 ENOENT (No such file or directory)
>   1.927 ( 0.005 ms): pahole/765220 openat(dfd: CWD, filename: "/usr/lib/debug/lib/modules/6.11.6-200.fc40.x86_64/vmlinux", flags: RDONLY|CLOEXEC) = 3
>   root@x1:~#
> 
> So honour the request and fails when just BTF is asked and no BTF file is
> found:
> 
>   # export PAHOLE_VMLINUX_BTF_FILENAME=non-existent
>   # pahole -F btf list_head
>   pahole: couldn't find any btf debug information on this system.
>   #
> 
> Reported-by: Matthias Schwarzott <zzam@gentoo.org>
> Cc: Alan Maguire <alan.maguire@oracle.com>
> Cc: Andrii Nakryiko <andrii@kernel.org>
> Cc: Eduard Zingerman <eddyz87@gmail.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Song Liu <song@kernel.org>
> Cc: Yonghong Song <yonghong.song@linux.dev>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

For the series (since some of my replies didn't reach the list, apologies)

Reviewed-by: Alan Maguire <alan.maguire@oracle.com>
Tested-by: Alan Maguire <alan.maguire@oracle.com>


  reply	other threads:[~2024-11-19 17:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-19 13:40 [PATCH 0/5] Fix segfaults related to missing BTF support Arnaldo Carvalho de Melo
2024-11-19 13:40 ` [PATCH 1/5] core: Add method to get the vmlinux BTF filename, allow overriding it via env var Arnaldo Carvalho de Melo
2024-11-19 13:40 ` [PATCH 2/5] tests default_vmlinux_btf: Introduce test for using BTF by default Arnaldo Carvalho de Melo
2024-11-19 13:40 ` [PATCH 3/5] pahole: Honour exclusive BTF loading Arnaldo Carvalho de Melo
2024-11-19 17:47   ` Alan Maguire [this message]
2024-11-19 20:18     ` Arnaldo Carvalho de Melo
2024-11-19 20:19     ` Arnaldo Carvalho de Melo
2024-11-19 22:04   ` Eduard Zingerman
2024-11-19 22:28     ` Alan Maguire
2024-11-19 22:33       ` Eduard Zingerman
2024-11-19 13:40 ` [PATCH 4/5] tests default_vmlinux_btf: Cover the no args segfault too Arnaldo Carvalho de Melo
2024-11-19 13:40 ` [PATCH 5/5] core, libctf: Check if constructor arguments are NULL before using them 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=0ddffba9-eb26-456b-bfa6-68bf94e8b481@oracle.com \
    --to=alan.maguire@oracle.com \
    --cc=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=andrii@kernel.org \
    --cc=dwarves@vger.kernel.org \
    --cc=eddyz87@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kcarcia@redhat.com \
    --cc=song@kernel.org \
    --cc=williams@redhat.com \
    --cc=yonghong.song@linux.dev \
    --cc=zzam@gentoo.org \
    /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