-
Notifications
You must be signed in to change notification settings - Fork 6
bpf: Introduce BPF_F_CPU and BPF_F_ALL_CPUS flags for percpu maps #5935
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
bpf: Introduce BPF_F_CPU and BPF_F_ALL_CPUS flags for percpu maps #5935
Conversation
Upstream branch: f859813 |
ba991b7
to
cf2fd3b
Compare
Upstream branch: 5d87e96 |
e03e6c4
to
9b214ce
Compare
cf2fd3b
to
cd9a59e
Compare
Upstream branch: a578b54 |
9b214ce
to
58ceb62
Compare
cd9a59e
to
41fb65e
Compare
Upstream branch: 6798668 |
58ceb62
to
019546d
Compare
41fb65e
to
bcefb31
Compare
Upstream branch: fd2e081 |
019546d
to
63bc4a1
Compare
bcefb31
to
9de6d74
Compare
Upstream branch: 32d3766 |
63bc4a1
to
fd00855
Compare
9de6d74
to
607e46d
Compare
Upstream branch: f7528e4 |
fd00855
to
2bf8dd0
Compare
607e46d
to
0f635c7
Compare
Upstream branch: 61ee2cc |
2bf8dd0
to
dec8da4
Compare
0f635c7
to
cde4d9b
Compare
Upstream branch: 3ae4c52 |
dec8da4
to
7abbc20
Compare
cde4d9b
to
2b3c471
Compare
Upstream branch: b13448d |
7abbc20
to
ec987bc
Compare
It is to unify map flags checking for lookup_elem, update_elem, lookup_batch and update_batch APIs. Therefore, it will be convenient to check BPF_F_CPU and BPF_F_ALL_CPUS flags in it for these APIs in next patch. Signed-off-by: Leon Hwang <[email protected]> Acked-by: Andrii Nakryiko <[email protected]>
Introduce BPF_F_CPU and BPF_F_ALL_CPUS flags and check them for following APIs: * 'map_lookup_elem()' * 'map_update_elem()' * 'generic_map_lookup_batch()' * 'generic_map_update_batch()' And, get the correct value size for these APIs. Signed-off-by: Leon Hwang <[email protected]> Acked-by: Andrii Nakryiko <[email protected]>
…maps Introduce support for the BPF_F_ALL_CPUS flag in percpu_array maps to allow updating values for all CPUs with a single value for both update_elem and update_batch APIs. Introduce support for the BPF_F_CPU flag in percpu_array maps to allow: * update value for specified CPU for both update_elem and update_batch APIs. * lookup value for specified CPU for both lookup_elem and lookup_batch APIs. The BPF_F_CPU flag is passed via: * map_flags of lookup_elem and update_elem APIs along with embedded cpu info. * elem_flags of lookup_batch and update_batch APIs along with embedded cpu info. Signed-off-by: Leon Hwang <[email protected]>
…nd lru_percpu_hash maps Introduce BPF_F_ALL_CPUS flag support for percpu_hash and lru_percpu_hash maps to allow updating values for all CPUs with a single value for both update_elem and update_batch APIs. Introduce BPF_F_CPU flag support for percpu_hash and lru_percpu_hash maps to allow: * update value for specified CPU for both update_elem and update_batch APIs. * lookup value for specified CPU for both lookup_elem and lookup_batch APIs. The BPF_F_CPU flag is passed via: * map_flags along with embedded cpu info. * elem_flags along with embedded cpu info. Signed-off-by: Leon Hwang <[email protected]>
…_storage maps Introduce BPF_F_ALL_CPUS flag support for percpu_cgroup_storage maps to allow updating values for all CPUs with a single value for update_elem API. Introduce BPF_F_CPU flag support for percpu_cgroup_storage maps to allow: * update value for specified CPU for update_elem API. * lookup value for specified CPU for lookup_elem API. The BPF_F_CPU flag is passed via map_flags along with embedded cpu info. Signed-off-by: Leon Hwang <[email protected]>
Add libbpf support for the BPF_F_CPU flag for percpu maps by embedding the cpu info into the high 32 bits of: 1. **flags**: bpf_map_lookup_elem_flags(), bpf_map__lookup_elem(), bpf_map_update_elem() and bpf_map__update_elem() 2. **opts->elem_flags**: bpf_map_lookup_batch() and bpf_map_update_batch() And the flag can be BPF_F_ALL_CPUS, but cannot be 'BPF_F_CPU | BPF_F_ALL_CPUS'. Behavior: * If the flag is BPF_F_ALL_CPUS, the update is applied across all CPUs. * If the flag is BPF_F_CPU, it updates value only to the specified CPU. * If the flag is BPF_F_CPU, lookup value only from the specified CPU. * lookup does not support BPF_F_ALL_CPUS. Signed-off-by: Leon Hwang <[email protected]> Acked-by: Andrii Nakryiko <[email protected]>
Upstream branch: b13448d |
Add test coverage for the new BPF_F_CPU and BPF_F_ALL_CPUS flags support in percpu maps. The following APIs are exercised: * bpf_map_update_batch() * bpf_map_lookup_batch() * bpf_map_update_elem() * bpf_map__update_elem() * bpf_map_lookup_elem_flags() * bpf_map__lookup_elem() cd tools/testing/selftests/bpf/ ./test_progs -t percpu_alloc 253/13 percpu_alloc/cpu_flag_percpu_array:OK 253/14 percpu_alloc/cpu_flag_percpu_hash:OK 253/15 percpu_alloc/cpu_flag_lru_percpu_hash:OK 253/16 percpu_alloc/cpu_flag_percpu_cgroup_storage:OK 253 percpu_alloc:OK Summary: 1/16 PASSED, 0 SKIPPED, 0 FAILED Signed-off-by: Leon Hwang <[email protected]>
ec987bc
to
9596458
Compare
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=1001043 expired. Closing PR. |
Pull request for series with
subject: bpf: Introduce BPF_F_CPU and BPF_F_ALL_CPUS flags for percpu maps
version: 7
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1001043