-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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: disable DEBUG_INFO_BTF by default #141284
Conversation
It made the ZFS module balloon in size and probably shouldn't be enabled on production kernels to begin with. Fixes NixOS#140851
@Atemu I think this should contain some study of prior art. What do other distros do here? E.g. Gentoo (check the distkernels), Arch, Debian, OpenSUSE. |
Afaik NixOS would be the only one not to enable BTF. Ubuntu, arch and fedora have it. Have not checked the other. |
Also what is the size increase afterwards? Also ZFS is used on systems with a lot of storage, so a few mb won't really matter. |
BTF should be kept IMO, but there's probably some other configs that we've forgotten to set which could reduce the size, maybe we could test them out before disabling BTF? Keeping BTF by default is the way to go, it's not a "debug only" feature. |
fedora config available here https://src.fedoraproject.org/rpms/kernel//blob/rawhide/f/kernel-x86_64-fedora.config |
Some quick googling took me to this patch series that demonstrates some Kconfig that reduces overall sizes when using BTF. We should experiment with them. https://patches.linaro.org/patch/318424/ |
I wouldn't care about MiBs on my main partition but, on my 512MiB boot partition, I'm a bit stingy about 9MiB extra in every initrd. By disabling BTF, initrd size is back to normal AFAICT. I would absolutely not mind having this feature enabled by default if the other distros do so aswell. My main issue is that it bloats every ZFS user's /boot/ by multiple MiB unnecessarily. |
Maybe we should ask zfs upstream why btf blows up their module. |
I'd prefer if we disabled it for the time being though. |
I wonder if we can strip it somehow from the zfs module without breaking it. |
Opened up openzfs/zfs#12635 |
Yeah, I think it's worth using this PR as an opportunity to figure this out rather than blanket disabling again and breaking applications and workflows. Does every module balloon in size or just ZFS? What happens if we disable |
It looks like the zfs module also contains debug_info i.e. debug symbols now. Is this a change from what we had before? |
edit: for some reason it still gives me a 15M |
pre-btf
post-btf
|
That doesn't seem to be a valid option. |
You need to drop the
|
You can try it yourself, it's not an option we can set. |
I took this from my current nixos kernel:
Is it possible that this option is only available in |
I don't mean the resulting config.gz, I mean the options we are able to set in common-config.nix. I tried setting it in 5.10 and 5.14. |
One other consequence of |
NixOS would then be one of the only distros to not support BTF, which would make using and packaging bpf-based tools really annoying (especially as the ecosystem is moving further towards BPF CO-RE, which requires btf), as it'd require the users to do their own kernel builds instead of relying on the kernel in the nix binary cache. On the other hand, if you're doing a local build of the kernel, you can trivially turn the option off in your own configuration.nix. |
While the process of turning the option off is fairly straightforward, figuring out what to turn off when starting with "zfs module is too large to fit into my
Local builds don't necessarily happen because of changes to the derivation. Testing changes to |
Also, specifically for the ZFS problem, we should probably experiment with setting EDIT: Actually, the flag doesn't exist on previous versions because module BTF support doesn't exist in 5.10 and below. Given that large zfs also happens on 5.10, I guess the flag wouldn't actually help. |
Stripping debug symbols seems to solve the size issue without having to disable btf: #141942 |
The builddir of kernel I just built does indeed take ~19GiB apparent and ~10GiB lz4'd which is quite a lot. You can just put that in /var/tmp instead though, or, since you're compiling your own kernel anyways, set btf=no. |
Motivation for this change
linux: disable DEBUG_INFO_BTF by default
It made the ZFS module balloon in size and probably shouldn't be enabled on
production kernels to begin with.
Fixes #140851
Merge this so that it ends up in the same eval as #141112 to avoid unnecessary rebuilds.
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)