How and When You
Should Measure CPU
Overhead of eBPF
Programs/proc/sys/kernel/bpf_stats_enabled ## Three ways to access kernel eBPF stats ## bpftool prog show ## ☐ ☐ ☐ $ sudo bpftool prog show 100: kprobe name do_sys_open tag b3b38339b16f56d9 gpl run_time_ns int fd = enable_stats(); if (fd < 0) { return; } // do profiling close(fd); ## bpftool prog profile ## bpftool prog profile – Added in kernel v5.7 – Uses hardware perf counters – Available metrics: instructions, lld loads, llc misses – Used for more in-depth profiling ## bpftool prog run / BPF_PROG_TEST_RUN ## bpftool prog run – Added in kernel v4.12 – Only for specific program types – Specify0 码力 | 20 页 | 2.04 MB | 1 年前3
Steering connections to sockets with BPF socket lookup hookneed VM running Linux kernel 5.9+ bpftool 5.9+ libbpf headers ☐ kernel headers ## vm $ uname -r 5.9.1-36.vanilla.1.fc32.x86_64 vm $ bpftool version bpftool v5.9.1 ## Code and instructions at https://github -target bpf -c -o echo_dispatch.bpf.o echo_dispatch.bpf.c # bpftool prog load echo_dispatch.bpf.o /sys/fs/bpf/echo_dispatch_prog # bpftool prog show pinned /sys/fs/bpf/echo_dispatch_prog load & pin ~vagrant/bpffs # bpftool map show id 28 28: hash name echo_ports flags 0x0 key 2B value 1B max_entries 1024 memlock 86016B # bpftool map pin id 28 ~vagrant/bpffs/echo_ports # bpftool map show id 29 29:0 码力 | 23 页 | 441.22 KB | 1 年前3
Cilium v1.5 Documentationto the Linux kernel, respectively. Similarly, for debugging and introspection purposes building bpftool is optional, but recommended. ## Fedora The following applies to Fedora 25 or later: $ sudo dnf earlier. ## Compiling bpftool bpftool is an essential tool around debugging and introspection of BPF programs and maps. It is part of the kernel tree and available under tools/bpf/bpftool/. Make sure to have kernel tree as described earlier. In order to build and install bpftool, the following steps are required: $ cd/tools/bpf/bpftool/ $ make Auto-detecting system features: ... libbfd: [ on ] 0 码力 | 740 页 | 12.52 MB | 1 年前3
Cilium v1.6 Documentationto the Linux kernel, respectively. Similarly, for debugging and introspection purposes building bpftool is optional, but recommended. ## Fedora The following applies to Fedora 25 or later: $ sudo dnf earlier. ## Compiling bpftool bpftool is an essential tool around debugging and introspection of BPF programs and maps. It is part of the kernel tree and available under tools/bpf/bpftool/. Make sure to have kernel tree as described earlier. In order to build and install bpftool, the following steps are required: $ cd/tools/bpf/bpftool/ $ make Auto-detecting system features: ... libbfd: [ on ] 0 码力 | 734 页 | 11.45 MB | 1 年前3
Cilium v1.7 DocumentationTail Calls BPF to BPF Calls JIT Hardening Offloads Toolchain Development Environment LLVM iproute2 bpftool BPF sysctls Kernel Testing JIT Debugging Introspection Tracing pipe Miscellaneous Program Types XDP to the Linux kernel, respectively. Similarly, for debugging and introspection purposes building bpftool is optional, but recommended. Fedora The following applies to Fedora 25 or later: $ sudo dnf install earlier. Compiling bpftool bpftool is an essential tool around debugging and introspection of BPF programs and maps. It is part of the kernel tree and available under tools/bpf/bpftool/. Make sure to have0 码力 | 885 页 | 12.41 MB | 1 年前3
Cilium v1.9 DocumentationTail Calls BPF to BPF Calls JIT Hardening Offloads Toolchain Development Environment LLVM iproute2 bpftool BPF sysctls Kernel Testing JIT Debugging Introspection Tracing pipe Miscellaneous Program Types programs running in the parent cgroup hierarchy by following the bpftool documentation [https://manpages.ubuntu.com/manpages/focal/man8/bpftool-cgroup.8.html]. For more information, see the Pull Request [https://github [https://github.com/cilium/cilium/pull/16259]. level=warning msg="+ bpftool cgroup attach /var/run/cilium/cgroupv2 connect6 pinned /sys/fs/bpf/tc/globals/cilium_cgroups_connect6" subsys=datapath-loader0 码力 | 1263 页 | 18.62 MB | 1 年前3
Cilium v1.11 DocumentationTail Calls BPF to BPF Calls JIT Hardening Offloads Toolchain Development Environment LLVM iproute2 bpftool BPF sysctls Kernel Testing JIT Debugging Introspection Tracing pipe Miscellaneous Program Types XDP programs running in the parent cgroup hierarchy by following the bpftool documentation [https://manpages.ubuntu.com/manpages/focal/man8/bpftool-cgroup.8.html]. For more information, see the Pull Request [https://github [https://github.com/cilium/cilium/pull/16259]. level=warning msg="+ bpftool cgroup attach /var/run/cilium/cgroupv2 connect6 pinned /sys/fs/bpf/tc/globals/cilium_cgroups_connect6" subsys=datapath-loader0 码力 | 1373 页 | 19.37 MB | 1 年前3
Cilium v1.8 DocumentationTail Calls BPF to BPF Calls JIT Hardening Offloads Toolchain Development Environment LLVM iproute2 bpftool BPF sysctls Kernel Testing JIT Debugging Introspection Tracing pipe Miscellaneous Program Types XDP to the Linux kernel, respectively. Similarly, for debugging and introspection purposes building bpftool is optional, but recommended. Fedora The following applies to Fedora 25 or later: $ sudo dnf install earlier. Compiling bpftool bpftool is an essential tool around debugging and introspection of BPF programs and maps. It is part of the kernel tree and available under tools/bpf/bpftool/. Make sure to have0 码力 | 1124 页 | 21.33 MB | 1 年前3
Cilium v1.10 DocumentationHardening ■ Offloads ## ○ Toolchain ■ Development Environment ■ LLVM ■ iproute2 ■ bpftool ■ BPF sysctls ■ Kernel Testing - JIT Debugging - Introspection - Tracing.pipe - Miscellaneous programs running in the parent cgroup hierarchy by following the bpftool documentation [https://manpages.ubuntu.com/manpages/focal/man8/bpftool-cgroup.8.html]. For more information, see the Pull Request [https://github [https://github.com/cilium/cilium/pull/16259]. level=warning msg="+ bpftool cgroup attach /var/run/cilium/cgroupv2 connect6 pinned /sys/fs/bpf/tc/globals/cilium_cgroups_connect6" subsys=datapath-loader0 码力 | 1307 页 | 19.26 MB | 1 年前3
05. 李枫 用于 Linux 内核调试的 Python all register states after each instruction. ## I lvm-objdump, Ilvm-mc ## bpftool ## $KERNEL_SRC/tools/bpf /bpftool bpftool - bash-completion - btf.c - btf_dumper.c - cfg.c - cfg.h - cgroup.c xlated_dumper.c - xlated_dumper.h # bpftool prog show 1337: sched_cls name cls_entry tag e202124da7c84e89 loaded_at Mar 08/19:53 uid 0 xlated 304B not jited memlock 4096B # bpftool prog dump xlated id 1337 pc+7 3: (bf) r6 = r1 [...] 37: (95) exit ## # bpftool map 1234: array name ch_rings flags 0x0 key 4B value 4B max_entries 7860 memlock 65536B # bpftool map dump id 1234 key: 00 00 00 00 value: 00 000 码力 | 63 页 | 4.07 MB | 2 年前3
共 13 条
- 1
- 2













