linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next v2 0/2] Introduce access remote cpu elem support in BPF percpu map
@ 2022-05-11  9:38 Feng zhou
  2022-05-11  9:38 ` [PATCH bpf-next v2 1/2] bpf: add bpf_map_lookup_percpu_elem for " Feng zhou
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Feng zhou @ 2022-05-11  9:38 UTC (permalink / raw)
  To: ast, daniel, andrii, kafai, songliubraving, yhs, john.fastabend,
	kpsingh, rostedt, mingo, jolsa, davemarchevsky, joannekoong,
	geliang.tang
  Cc: netdev, bpf, linux-kernel, duanxiongchun, songmuchun,
	wangdongdong.6, cong.wang, zhouchengming, zhoufeng.zf,
	yosryahmed

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.

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   | 46 ++++++++++++++++
 .../bpf/progs/test_map_lookup_percpu_elem.c   | 54 +++++++++++++++++++
 11 files changed, 203 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

-- 
2.20.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-05-13  1:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-11  9:38 [PATCH bpf-next v2 0/2] Introduce access remote cpu elem support in BPF percpu map Feng zhou
2022-05-11  9:38 ` [PATCH bpf-next v2 1/2] bpf: add bpf_map_lookup_percpu_elem for " Feng zhou
2022-05-11  9:38 ` [PATCH bpf-next v2 2/2] selftests/bpf: add test case for bpf_map_lookup_percpu_elem Feng zhou
2022-05-12  3:34   ` Andrii Nakryiko
2022-05-12  3:58     ` [External] " Feng Zhou
2022-05-12 16:43       ` Andrii Nakryiko
2022-05-13  1:49         ` Feng Zhou
2022-05-12  1:30 ` [PATCH bpf-next v2 0/2] Introduce access remote cpu elem support in BPF percpu map patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).