Skip to content
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

Kernel 6.6: error initializing '/usr/lib/bpftune//route_table_tuner.so #81

Open
ptr1337 opened this issue Oct 30, 2023 · 10 comments
Open

Comments

@ptr1337
Copy link

ptr1337 commented Oct 30, 2023

Starting with the 6.6 Kernel I get following in journalctl/systemctl status:

Okt 30 21:37:21 ptr1337-cachyos systemd[1]: Started BPF-based auto-tuning of system parameters.
Okt 30 21:37:21 ptr1337-cachyos bpftune[5015]: bpftune works fully
Okt 30 21:37:21 ptr1337-cachyos bpftune[5015]: bpftune supports per-netns policy (via netns cookie)
Okt 30 21:37:22 ptr1337-cachyos bpftune[5015]: could not load skeleton: No such process
Okt 30 21:37:22 ptr1337-cachyos bpftune[5015]: error initializing '/usr/lib/bpftune//route_table_tuner.so: No such process

This is not reproduceable with 6.5.

@alan-maguire
Copy link
Member

Thanks for the report! I'll dig into this more in a few days

@Suyash1989
Copy link

Suyash1989 commented Nov 9, 2023

Nov 9 15:01:09 lab03 bpftune[38931]: bpftune works, but no BPF Type Format information (BTF) is available. This means kernel data structure offsets may not match those at compile-time, and tuners may not operate as expected. This mode of operation is unsupported, and failures are expected, so be warned.
Nov 9 15:01:09 lab03 bpftune[38931]: bpftune supports per-netns policy (via netns cookie)
Nov 9 15:01:09 lab03 bpftune[38931]: could not load skeleton: Kernel verifier blocks program loading
Nov 9 15:01:09 lab03 bpftune[38931]: error initializing '/usr/lib64/bpftune//tcp_conn_tuner.so: Unknown error 4007
Nov 9 15:01:20 lab03 bpftune[38931]: Scenario 'need to increase TCP buffer size(s)' occurred for tunable 'net.ipv4.tcp_rmem' in global ns. Need to increase buffer size(s) to maximize throughput
Nov 9 15:01:20 lab03 bpftune[38931]: Due to need to increase max buffer size to maximize throughput change net.ipv4.tcp_rmem(min default max) from (0 0 0) -> (0 0 0)

The error occurs with Kernel 5.14 on RHEL 9.2

@alan-maguire
Copy link
Member

Starting with the 6.6 Kernel I get following in journalctl/systemctl status:

Okt 30 21:37:21 ptr1337-cachyos systemd[1]: Started BPF-based auto-tuning of system parameters.
Okt 30 21:37:21 ptr1337-cachyos bpftune[5015]: bpftune works fully
Okt 30 21:37:21 ptr1337-cachyos bpftune[5015]: bpftune supports per-netns policy (via netns cookie)
Okt 30 21:37:22 ptr1337-cachyos bpftune[5015]: could not load skeleton: No such process
Okt 30 21:37:22 ptr1337-cachyos bpftune[5015]: error initializing '/usr/lib/bpftune//route_table_tuner.so: No such process

This is not reproduceable with 6.5.

I reproduced this; looks like the root cause is fib6_age () is not present in kallsyms/BTF; since it is a static function I suspect it is being inlined. As it is needed for the route_table_tuner, the failure to load is the right thing; however it'd be good if the failure mode was a bit more informative.

@alan-maguire
Copy link
Member

Nov 9 15:01:09 lab03 bpftune[38931]: bpftune works, but no BPF Type Format information (BTF) is available. This means kernel data structure offsets may not match those at compile-time, and tuners may not operate as expected. This mode of operation is unsupported, and failures are expected, so be warned. Nov 9 15:01:09 lab03 bpftune[38931]: bpftune supports per-netns policy (via netns cookie) Nov 9 15:01:09 lab03 bpftune[38931]: could not load skeleton: Kernel verifier blocks program loading Nov 9 15:01:09 lab03 bpftune[38931]: error initializing '/usr/lib64/bpftune//tcp_conn_tuner.so: Unknown error 4007 Nov 9 15:01:20 lab03 bpftune[38931]: Scenario 'need to increase TCP buffer size(s)' occurred for tunable 'net.ipv4.tcp_rmem' in global ns. Need to increase buffer size(s) to maximize throughput Nov 9 15:01:20 lab03 bpftune[38931]: Due to need to increase max buffer size to maximize throughput change net.ipv4.tcp_rmem(min default max) from (0 0 0) -> (0 0 0)

The error occurs with Kernel 5.14 on RHEL 9.2

looks like you don't have BTF; in that case we can't be sure the offsets we use are correct, so we can get unexpected behaviour as described in the log;

"3 bpftune[38931]: bpftune works, but no BPF Type Format information (BTF) is available. This means kernel data structure offsets may not match those at compile-time, and tuners may not operate as expected. This mode of operation is unsupported, and failures are expected, so be warned."

Can you confirm /sys/kernel/btf/vmlinux is absent?

In this case it looks like the offsets of the tcp memory values are wrong, and can't be fixed since we have no BTF, hence we get 0 values.

@Suyash1989
Copy link

[root@lab03 btf]# ls /sys/kernel/btf/ | grep vmlinux
vmlinux

I do have the file, so then can we say the offsets used are incorrect?

@alan-maguire
Copy link
Member

[root@lab03 btf]# ls /sys/kernel/btf/ | grep vmlinux vmlinux

I do have the file, so then can we say the offsets used are incorrect?

Yeah, it looks like the BTF can't be read by bpftune. This usually happens when the tools used to create the kernel BTF are newer than those being used to read it - in that case the BTF cannot be parsed. If you can find a more up-to-date libbpf to build with that may help.

@0xAlcibiades
Copy link

0xAlcibiades commented Dec 26, 2023

Seeing the same thing on ubuntu hwe edge kernel 6.5.0-14-generic

Dec 26 21:52:58 subtle-bobcat bpftune[1158877]: bpftune works, but no BPF Type Format information (BTF) is available.  This means kernel data structure offsets may not match those at compile-time, and tuners may not operate as expected. This mod>
Dec 26 21:52:58 subtle-bobcat bpftune[1158877]: bpftune supports per-netns policy (via netns cookie)
Dec 26 21:53:00 subtle-bobcat bpftune[1158877]: could not load skeleton: Kernel verifier blocks program loading
Dec 26 21:53:00 subtle-bobcat bpftune[1158877]: error initializing '/usr/lib64/bpftune//tcp_conn_tuner.so: Unknown error 4007

@0xAlcibiades
Copy link

Got thi

[root@lab03 btf]# ls /sys/kernel/btf/ | grep vmlinux vmlinux
I do have the file, so then can we say the offsets used are incorrect?

Yeah, it looks like the BTF can't be read by bpftune. This usually happens when the tools used to create the kernel BTF are newer than those being used to read it - in that case the BTF cannot be parsed. If you can find a more up-to-date libbpf to build with that may help.

Indeed, the hwe-edge kernel was built using a newer version of libbpf than libbpf-devel provided, and that resolved.

@ptr1337
Copy link
Author

ptr1337 commented Apr 3, 2024

Any updates on this?

@alan-maguire
Copy link
Member

the original problem - inlining of fib6_age() - is hard to predict since it is very compiler-specific. we currently have a model of passing optional functions to the bpftuner load function that could potentially be extended to name required functions, and check kallsyms for these, but it feels kind of clunky. ideally we would like to rely on tracepoints in the kernel; the right answer in this case I think is to add a tracepoint to cover FIB[6] garbage collection; it will give us what we need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants