Message ID | 20220513063952.41794-1-zhoufeng.zf@bytedance.com (mailing list archive) |
---|---|
Headers | show |
Series | Introduce access remote cpu elem support in BPF percpu map | expand |
On 5/13/22 8:39 AM, Feng zhou wrote: [...] > Changelog: > ---------- > v2->v3: Addressed comments from Andrii Nakryiko. > - use /* */ instead of // > - use libbpf_num_possible_cpus() instead of sysconf(_SC_NPROCESSORS_ONLN) > - use 8 bytes for value size > - fix memory leak > - use ASSERT_EQ instead of ASSERT_OK > - add bpf_loop to fetch values on each possible CPU > some details in here: > https://lore.kernel.org/lkml/20220511093854.411-1-zhoufeng.zf@bytedance.com/T/ The v2 of your series is already in bpf-next tree, please just send a relative diff for the selftest patch. https://lore.kernel.org/lkml/165231901346.29050.11394051230756915389.git-patchwork-notify@kernel.org/ Thanks, Daniel
在 2022/5/13 下午11:01, Daniel Borkmann 写道: > On 5/13/22 8:39 AM, Feng zhou wrote: > [...] >> Changelog: >> ---------- >> v2->v3: Addressed comments from Andrii Nakryiko. >> - use /* */ instead of // >> - use libbpf_num_possible_cpus() instead of >> sysconf(_SC_NPROCESSORS_ONLN) >> - use 8 bytes for value size >> - fix memory leak >> - use ASSERT_EQ instead of ASSERT_OK >> - add bpf_loop to fetch values on each possible CPU >> some details in here: >> https://lore.kernel.org/lkml/20220511093854.411-1-zhoufeng.zf@bytedance.com/T/ >> > > The v2 of your series is already in bpf-next tree, please just send a > relative diff for > the selftest patch. > > https://lore.kernel.org/lkml/165231901346.29050.11394051230756915389.git-patchwork-notify@kernel.org/ > > > Thanks, > Daniel Ok, will do. Thanks.
From: Feng Zhou <zhoufeng.zf@bytedance.com> Trace some functions, such as enqueue_task_fair, need to access the corresponding cpu, not the current cpu, and bpf_map_lookup_elem percpu map cannot do it. So add bpf_map_lookup_percpu_elem to accomplish it for percpu_array_map, percpu_hash_map, lru_percpu_hash_map. Changelog: ---------- v2->v3: Addressed comments from Andrii Nakryiko. - use /* */ instead of // - use libbpf_num_possible_cpus() instead of sysconf(_SC_NPROCESSORS_ONLN) - use 8 bytes for value size - fix memory leak - use ASSERT_EQ instead of ASSERT_OK - add bpf_loop to fetch values on each possible CPU some details in here: https://lore.kernel.org/lkml/20220511093854.411-1-zhoufeng.zf@bytedance.com/T/ v1->v2: Addressed comments from Alexei Starovoitov. - add a selftest for bpf_map_lookup_percpu_elem. Feng Zhou (2): bpf: add bpf_map_lookup_percpu_elem for percpu map selftests/bpf: add test case for bpf_map_lookup_percpu_elem include/linux/bpf.h | 2 + include/uapi/linux/bpf.h | 9 +++ kernel/bpf/arraymap.c | 15 ++++ kernel/bpf/core.c | 1 + kernel/bpf/hashtab.c | 32 +++++++++ kernel/bpf/helpers.c | 18 +++++ kernel/bpf/verifier.c | 17 ++++- kernel/trace/bpf_trace.c | 2 + tools/include/uapi/linux/bpf.h | 9 +++ .../bpf/prog_tests/map_lookup_percpu_elem.c | 59 +++++++++++++++ .../bpf/progs/test_map_lookup_percpu_elem.c | 71 +++++++++++++++++++ 11 files changed, 233 insertions(+), 2 deletions(-) create mode 100644 tools/testing/selftests/bpf/prog_tests/map_lookup_percpu_elem.c create mode 100644 tools/testing/selftests/bpf/progs/test_map_lookup_percpu_elem.c