-
Notifications
You must be signed in to change notification settings - Fork 5
bpf: Introduce BPF_F_CPU and BPF_F_ALL_CPUS flags for percpu maps #6378
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 #6378
Conversation
|
Upstream branch: 4722981 |
86f62c3 to
c8a7e22
Compare
|
Upstream branch: 7dc211c |
e03165d to
38b3787
Compare
c8a7e22 to
c919396
Compare
|
Upstream branch: ec12ab2 |
38b3787 to
527cc61
Compare
c919396 to
73c6b0b
Compare
|
Upstream branch: d6ec090 |
527cc61 to
02ee219
Compare
73c6b0b to
0bdd2b9
Compare
|
Upstream branch: d6ec090 |
02ee219 to
be1ca00
Compare
0bdd2b9 to
729c7ba
Compare
|
Upstream branch: d088da9 |
be1ca00 to
3191c88
Compare
729c7ba to
623bab9
Compare
|
Upstream branch: e0940c6 |
3191c88 to
976fd2a
Compare
623bab9 to
fe03c14
Compare
|
Upstream branch: 792f258 |
976fd2a to
ef70d0f
Compare
fe03c14 to
65bfb85
Compare
|
Upstream branch: 878ee3c |
ef70d0f to
b00dfaa
Compare
65bfb85 to
b1f8b58
Compare
|
Upstream branch: ae24fc8 |
b00dfaa to
cc65cac
Compare
b1f8b58 to
8f7081b
Compare
|
Upstream branch: b7f7d76 |
cc65cac to
32756ac
Compare
8f7081b to
c347688
Compare
|
Upstream branch: 4dd3a48 |
32756ac to
9337b96
Compare
c347688 to
fb42a92
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. Acked-by: Andrii Nakryiko <[email protected]> Signed-off-by: Leon Hwang <[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. Acked-by: Andrii Nakryiko <[email protected]> Signed-off-by: Leon Hwang <[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]>
…ge maps Copy map value using 'copy_map_value_long()'. It's to keep consistent style with the way of other percpu maps. No functional change intended. 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. Acked-by: Andrii Nakryiko <[email protected]> Signed-off-by: Leon Hwang <[email protected]>
|
Upstream branch: 8f7cf30 |
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() Add tests to verify that array and hash maps do not support BPF_F_CPU and BPF_F_ALL_CPUS flags. Signed-off-by: Leon Hwang <[email protected]>
9337b96 to
d00aa6d
Compare
|
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=1024375 expired. Closing PR. |
Pull request for series with
subject: bpf: Introduce BPF_F_CPU and BPF_F_ALL_CPUS flags for percpu maps
version: 10
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1024375