bpf: support percpu ARRAY map
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest9 patches 17 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/9 | bpf: prepare for moving map common stuff into one placekernel/ kernel/ kernel/ | +36 | 0 replies | |
| 2/9 | bpf: array map: use pre-defined nop map functionkernel/ | +5 | 1 reply | |
| 3/9 | bpf: introduce percpu verion of lookup/update in bpf_map_opsinclude/ kernel/ kernel/ +2 more | +30 | 0 replies | |
| 4/9 | bpf: add percpu version of lookup/update element helpersinclude/ include/ kernel/ +2 more | +68 | 0 replies | |
| 5/9 | bpf: syscall: add percpu version of lookup/update eleminclude/ kernel/ | +41 | 14 replies | |
| 6/9 | bpf: arraymap: introduce BPF_MAP_TYPE_ARRAY_PERCPUinclude/ include/ kernel/ +2 more | +135 | 1 reply | |
| 7/9 | sample/bpf: introduces helpers for percpu array examplesamples/ samples/ samples/ | +52 | 0 replies | |
| 8/9 | sample/bpf: sockex1: user percpu array mapsamples/ samples/ | +20 | 0 replies | |
| 9/9 | samples/bpf: test percpu array mapsamples/ | +110 | 1 reply |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/9] bpf: support percpu ARRAY map
Hi,
In case of ARRAY map, the index of the array is used as key of the map, then inevitably the mapped element/value can be accessed from more than one CPU concurrently, so expensive atomic operations are often required in eBPF prog. And we can see these usages in tracex3, sockex1 and sockex3 in sample/bpf/ of kernel tree.
This patchset trys to introduce percpu ARRAY map to address the issue.
The 1st two patches prepares for supporting percpu map, and introduces one file to hold the map common functions.
The following 3 patches introdues percpu version of update/ lookup element in bpf_map_ops, bpf helpers and syscall, so that percpu value can be retrieved/updated from eBPF prog and syscall.
The 6th patch implements percpu array map.
The last 3 patches are changes in samples/bpf, and implements test for perpcu array and converts to percpu array in sockex1 exmaple.
include/linux/bpf.h | 10 ++++ include/uapi/linux/bpf.h | 10 ++++ kernel/bpf/Makefile | 2 +- kernel/bpf/arraymap.c | 153 +++++++++++++++++++++++++++++++++++++++++++++++++++--------- kernel/bpf/bpf_map.h | 15 ++++++ kernel/bpf/core.c | 2 + kernel/bpf/hashtab.c | 4 ++ kernel/bpf/helpers.c | 53 +++++++++++++++++++++ kernel/bpf/map.c | 43 +++++++++++++++++ kernel/bpf/syscall.c | 48 +++++++++++++++---- net/core/filter.c | 4 ++ samples/bpf/bpf_helpers.h | 5 ++ samples/bpf/libbpf.c | 42 +++++++++++++++++ samples/bpf/libbpf.h | 5 ++ samples/bpf/sockex1_kern.c | 7 +-- samples/bpf/sockex1_user.c | 20 ++++++-- samples/bpf/test_maps.c | 110 +++++++++++++++++++++++++++++++++++++++++++ 17 files changed, 493 insertions(+), 40 deletions(-)
thanks,
Ming