BPF: Introduction, Programming Tips and Tricks
Talkat KubeCon + CloudNativeCon + Open Source Summit China 2021 · on Friday, 2021-12-10· at 13:15· Open Source Summit 演讲厅, 虚拟会议 (Virtual)·
summary
Claims that libbpf + BPF CO-RE lets BPF programs run unchanged across kernel versions by using BTF-based relocations and read-only globals, cutting per-host compile overhead. Shows concrete tools: a selective-attach block-layer latency tracer that chooses a BTF path or a fallback and works in practice, and demonstrates map resize and bpf_no_prealloc to avoid deadlocks on large maps. Covers perf-events per-CPU links and verifier-friendly read-only globals for fast, portable control parameters.
AI-written summary · about
chapters (17)
- 0:00Intro
- 0:20Speaker
- 1:19What's BPF CO-RE?
- 8:20"Hello world" with libbpf
- 9:13BPF skeleton and BPF app lifecycle
- 13:07Combining the open and load phases
- 13:42Selective attach
- 14:20Selective load
- 15:28Custom load and attach
- 16:25Multiple handlers for the same event
- 17:26Reading kernel structure's fields
- 21:33How to tell if a field exists?
- 22:24How to deal with kernel API changes?
- 24:41Control BPF behavior with global variable
- 27:21Reduce map pre-allocation overhead
- 28:59Determine the map size at runtime
- 29:42Use global variables instead of map
related talks
21mPerformance Wins with BPF: Getting Started
46mbpftrace internals
35mPerformance Insights into eBPF Step by Step
38meBPF for Observability: Hard Truths and Practical Wins
32meBPF: The Next Power Tool of SREs
31meBPF 101
36mObservability and performance analysis with BPF
28mDeveloping Modern eBPF Applications
