|
Which file should I include for KERNEL_VERSION macro ?
It will soon be part of bpf_helpers.h, but meanwhile just copy/paste it into your code. See https://patchwork.kernel.org/project/netdevbpf/patch/20210317200510.1354627-2-andrii@... >
It will soon be part of bpf_helpers.h, but meanwhile just copy/paste it into your code. See https://patchwork.kernel.org/project/netdevbpf/patch/20210317200510.1354627-2-andrii@... >
|
By
Andrii Nakryiko
· #1975
·
|
|
Which is oldest linux kernel version that can support BTF?
#bcc
Yes, correct. Yes, you can, if you have vmlinux image with DWARF information in it. You can use pahole tool like this to add .BTF section to vmlinux image: pahole -J <path-to-vmlinux-image> You most p
Yes, correct. Yes, you can, if you have vmlinux image with DWARF information in it. You can use pahole tool like this to add .BTF section to vmlinux image: pahole -J <path-to-vmlinux-image> You most p
|
By
Andrii Nakryiko
· #1969
·
|
|
Which is oldest linux kernel version that can support BTF?
#bcc
/sys/kernel/btf/vmlinux appeared in 5.4 kernel (upstream version). If you see it on 4.18, that means someone backported the changes. But for BPF CO-RE (which I assume is what you are referring to) to
/sys/kernel/btf/vmlinux appeared in 5.4 kernel (upstream version). If you see it on 4.18, that means someone backported the changes. But for BPF CO-RE (which I assume is what you are referring to) to
|
By
Andrii Nakryiko
· #1966
·
|
|
__builtin_memcpy behavior
-- Andrii <mayfieldtristan@...> wrote: vmlinux usually refers to kernel image binary. /sys/kernel/btf/vmlinux is not that, it's only the BTF data. So CO-RE needs kernel BTF, not necessarily vmli
-- Andrii <mayfieldtristan@...> wrote: vmlinux usually refers to kernel image binary. /sys/kernel/btf/vmlinux is not that, it's only the BTF data. So CO-RE needs kernel BTF, not necessarily vmli
|
By
Andrii Nakryiko
· #1960
·
|
|
__builtin_memcpy behavior
As far as CO-RE BPF program compilation goes, there shouldn't be much difference between the latest kernel vs some older one. In case of libbpf-tools, some of the tools might be using some features th
As far as CO-RE BPF program compilation goes, there shouldn't be much difference between the latest kernel vs some older one. In case of libbpf-tools, some of the tools might be using some features th
|
By
Andrii Nakryiko
· #1957
·
|
|
Reading Pinned maps in eBPF Programs
It's expected right now. BTF started out as purely debug information, but got elevated into pretty much a mandatory thing for modern BPF applications. We've talked about making .BTF emitted without -g
It's expected right now. BTF started out as purely debug information, but got elevated into pretty much a mandatory thing for modern BPF applications. We've talked about making .BTF emitted without -g
|
By
Andrii Nakryiko
· #1909
·
|
|
Reading Pinned maps in eBPF Programs
[...] Ok, this is a very different issue than the kernel missing BTF. libbpf is complaining that your opensnoop.bpf.o itself is missing BTF. And right, BTF is required to parse map definitions properl
[...] Ok, this is a very different issue than the kernel missing BTF. libbpf is complaining that your opensnoop.bpf.o itself is missing BTF. And right, BTF is required to parse map definitions properl
|
By
Andrii Nakryiko
· #1907
·
|
|
Reading Pinned maps in eBPF Programs
Check example [0] for how to set custom logging callback and print all libbpf logs (including those at DEBUG level of verbosity). [0] https://github.com/iovisor/bcc/blob/master/libbpf-tools/runqslower
Check example [0] for how to set custom logging callback and print all libbpf logs (including those at DEBUG level of verbosity). [0] https://github.com/iovisor/bcc/blob/master/libbpf-tools/runqslower
|
By
Andrii Nakryiko
· #1905
·
|
|
Reading Pinned maps in eBPF Programs
<mayfieldtristan@...> wrote: Which version of libbpf are you seeing this on? We've had bugs in libbpf where we'd attempt to load kernel BTF unnecessarily, but I believe we've fixed all those iss
<mayfieldtristan@...> wrote: Which version of libbpf are you seeing this on? We've had bugs in libbpf where we'd attempt to load kernel BTF unnecessarily, but I believe we've fixed all those iss
|
By
Andrii Nakryiko
· #1903
·
|
|
Reading Pinned maps in eBPF Programs
[...] I don't see anything needing kernel BTF in there, so if libbpf still fails on not being able to load kernel BTF, that might be a bug in libbpf. Can you please double-check this with the latest r
[...] I don't see anything needing kernel BTF in there, so if libbpf still fails on not being able to load kernel BTF, that might be a bug in libbpf. Can you please double-check this with the latest r
|
By
Andrii Nakryiko
· #1902
·
|
|
Reading Pinned maps in eBPF Programs
Your BPF code must be relying on CO-RE. I can check if you can show me your BPF source code. The pinning and map definition itself doesn't rely on CO-RE and thus doesn't need kernel BTF.
Your BPF code must be relying on CO-RE. I can check if you can show me your BPF source code. The pinning and map definition itself doesn't rely on CO-RE and thus doesn't need kernel BTF.
|
By
Andrii Nakryiko
· #1899
·
|
|
Reading Pinned maps in eBPF Programs
It doesn't require kernel BTF for that. Only BPF program's BTF generated by Clang. So you'll need something like Clang 10 (or maybe Clang 9 will do as well), but no requirements for kernel BTF. >
It doesn't require kernel BTF for that. Only BPF program's BTF generated by Clang. So you'll need something like Clang 10 (or maybe Clang 9 will do as well), but no requirements for kernel BTF. >
|
By
Andrii Nakryiko
· #1897
·
|
|
Reading Pinned maps in eBPF Programs
Libbpf supports declarative pinning of maps, that's how you easily get "map re-use" from BPF side. See [0] for example. But there is also bpf_map__pin() and bpf_map__reuse_fd() API on user-space side
Libbpf supports declarative pinning of maps, that's how you easily get "map re-use" from BPF side. See [0] for example. But there is also bpf_map__pin() and bpf_map__reuse_fd() API on user-space side
|
By
Andrii Nakryiko
· #1895
·
|
|
Polling multiple BPF_MAP_TYPE_PERF_EVENT_ARRAY causing dropped events
No perf buffer is just fine to pass data from the BPF program in the kernel to the user-space part for post-processing. It's hard to give you any definitive answer, it all depends. But think about thi
No perf buffer is just fine to pass data from the BPF program in the kernel to the user-space part for post-processing. It's hard to give you any definitive answer, it all depends. But think about thi
|
By
Andrii Nakryiko
· #1891
·
|
|
How to get function param in kretprobe bpf program?
#bcc
#pragma
I don't think golang can interrupt thread while it's being executed in the kernel. So from the golang perspective I wouldn't worry, the kernel will execute both kprobe and corresponding kretprobe befo
I don't think golang can interrupt thread while it's being executed in the kernel. So from the golang perspective I wouldn't worry, the kernel will execute both kprobe and corresponding kretprobe befo
|
By
Andrii Nakryiko
· #1889
·
|
|
Polling multiple BPF_MAP_TYPE_PERF_EVENT_ARRAY causing dropped events
If you have the luxury of using Linux kernel 5.8 or newer, you can try a new BPF ring buffer map, that provides MPSC queue (so you can queue from multiple CPUs simultaneously, while BPF perf buffer al
If you have the luxury of using Linux kernel 5.8 or newer, you can try a new BPF ring buffer map, that provides MPSC queue (so you can queue from multiple CPUs simultaneously, while BPF perf buffer al
|
By
Andrii Nakryiko
· #1888
·
|
|
How to get function param in kretprobe bpf program?
#bcc
#pragma
You can't do it reliably with kretprobe. kretprobe is executed right before the function is exiting, by that time all the registers that contained input parameters could have been used for something e
You can't do it reliably with kretprobe. kretprobe is executed right before the function is exiting, by that time all the registers that contained input parameters could have been used for something e
|
By
Andrii Nakryiko
· #1885
·
|
|
BPF Concurrency
You should use __sync_fetch_and_add() for both cases, and then yes, you won't lose any update. You probably would want __sync_add_and_fetch() to get the counter after update, but that's not supported
You should use __sync_fetch_and_add() for both cases, and then yes, you won't lose any update. You probably would want __sync_add_and_fetch() to get the counter after update, but that's not supported
|
By
Andrii Nakryiko
· #1867
·
|
|
Error loading xdp program that worked with bpf_load
Ok, that I can help with, then. What's the kernel version? Where I can find repro? Steps, etc. Basically, a bit more context would help, as I wasn't part of initial discussion.
Ok, that I can help with, then. What's the kernel version? Where I can find repro? Steps, etc. Basically, a bit more context would help, as I wasn't part of initial discussion.
|
By
Andrii Nakryiko
· #1862
·
|
|
Error loading xdp program that worked with bpf_load
<brouer@...> wrote: This is newer Clang recording that function is global, not static. libbpf is sanitizing BTF to remove this flag, if kernel doesn't support this. But given this is re-impleme
<brouer@...> wrote: This is newer Clang recording that function is global, not static. libbpf is sanitizing BTF to remove this flag, if kernel doesn't support this. But given this is re-impleme
|
By
Andrii Nakryiko
· #1860
·
|