Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pahole: Honour exclusive BTF loading
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 <[email protected]> Reviewed-by: Alan Maguire <[email protected]> Tested-by: Alan Maguire <[email protected]> Cc: Andrii Nakryiko <[email protected]> Cc: Eduard Zingerman <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Song Liu <[email protected]> Cc: Yonghong Song <[email protected]> Link: https://lore.kernel.org/all/ZzzyvMO0jYLMQCVa@x1 Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
- Loading branch information