-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
linux-kernel: Enable BTF #127922
linux-kernel: Enable BTF #127922
Conversation
@ofborg build linux_xanmod |
@ofborg test latestKernel.login kernel-latest |
Please target staging, this causes a ton of rebuilds which most users won't directly benefit from any time soon. |
How should I do that? Just change the target branch in github's ui? |
I'm not sure that works. For me I do:
You may or may not fiddle with GH's UI as well, not sure. |
No, don't do that. That way you'd try to merge staging into master and ping pretty much all codeowners. Just change the base (or target) branch in the GH UI. You only need to rebase if there's a merge conflict between your branch and staging; after you changed the target branch that is. |
Done, and no conflicts! |
Hi, what else needs to be done for this PR to get approvals and get merged? Having BTF info in the kernel is very useful for software packages that make use of eBPF and for eBPF development. |
If someone resolves the conflict and pings me I will merge this. |
BTF is a new, lightweight debug information format tailored specifically for the needs of eBPF, allowing eBPF programs to be portable across various kernel versions, configurations and distributions. This is used by bpftrace and lots of new eBPF-based tooling to avoid a dependency on LLVM on the host. BTF debug information is enabled on all major distributions: Fedora 31+, RHEL 8.2+, Ubuntu 20.10, Debian 11 and ArchLinux all have enabled it. Enabling BTF debug information requires adding two new dependencies to the kernel build: Python3 and pahole. Those will be used to generate the BTF debugging information.
Well, that shux. It works on my machine, and I tested kernel 5.10 and 5.12 (EDIT: 5.13 since latest staging removed 5.12). To test, I use a flake.nix system that looks like this:
and then just run @Mic92 Could you provide the full logs so I can figure out what went wrong? Those warnings in the last 10 lines all seem "normal" to me, and not hard errors. The actual problem is probably burried in the logs. |
I think it's only |
zlib needs to be in |
With this PR error build kernel:
|
@Izorkin your error looks like you run out of disk-space. Make sure $TMPDIR is not pointing to a tmpfs. |
This is untested but according to NixOS#127922 (comment) zlib is only used in the host build, which breaks cross-compilation if not present.
@lopsided98 see #139710 |
This is untested but according to #127922 (comment) zlib is only used in the host build, which breaks cross-compilation if not present.
I checked this variant yesterday - error build. There is enough free space on
|
This is untested but according to NixOS#127922 (comment) zlib is only used in the host build, which breaks cross-compilation if not present.
The error message clearly indicates no space left errors though:
Notice that if TMPDIR can also point to |
Checked it out. The build uses all 16GB of memory. |
Maybe but don't build it on tmpfs than. |
I don't think we should be enabling these by default. People who want it can set |
Those should definitely be enabled by default, as they enable eBPF CO-RE functionality: https://facebookmicrosites.github.io/bpf/blog/2020/02/19/bpf-portability-and-co-re.html This is very important for a bunch of bpf-based tools. It's enabled by default on many distribs, like Fedora, Ubuntu and ArchLinux for this reason. |
This ballooned the size of zfs.ko.xz ten-fold for me, from 881K to 9.4M. Other modules from ZFS are also affected, and the combined size increase means my initramfs no longer fits on my boot partition. But it didn't increase the size of Linux itself at all, so presumably there's some change we can make to the ZFS package to fix this? I do agree it makes sense for this to be enabled by default. |
Kernel without btf:
Kernel with btf
So it's a 14% increase for the kernel image. Not sure where the 10x increase for zfs comes from. |
Motivation for this change
BTF is a new, lightweight debug information format tailored specifically
for the needs of eBPF, allowing eBPF programs to be portable across
various kernel versions, configurations and distributions. This is used
by bpftrace and lots of new eBPF-based tooling to avoid a dependency
on LLVM on the host.
BTF debug information is enabled on all major distributions: Fedora 31+,
RHEL 8.2+, Ubuntu 20.10, Debian 11 and ArchLinux all have enabled it.
Enabling BTF debug information requires adding two new dependencies to
the kernel build: Python3 and pahole. Those will be used to generate the
BTF debugging information.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)