Pass external callchain entry to get_perf_callchain
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v8 Latest3 patches 23 repliesIn review
- v7 posting 2/22 patches 7 repliesSuperseded
- v7 posting 1/22 patches 2 repliesSuperseded
Earlier versions · 7
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v6 | 2 patches | 4 replies | Superseded | |
| v5 | 3 patches | 3 replies | Superseded | |
| v4 posting 2/2 | 2 patches | 7 replies | Superseded | |
| v4 posting 1/2 | 2 patches | 2 replies | Superseded | |
| v3 RFC | 2 patches | 5 replies | Superseded | |
| v2 RFC | 2 patches | 7 replies | Superseded | |
| v1 RFC | 2 patches | 3 replies | Superseded |
Patches in v8 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | perf: Add rctx in perf_callchain_entryinclude/ kernel/ kernel/ | +21 | 7 replies | |
| 2/3 | perf: Refactor get_perf_callchaininclude/ kernel/ | +27 | 13 replies | |
| 3/3 | bpf: Hold ther perf callchain entry until used completelykernel/ | +47 | 3 replies |
Reviews trailers per patch
1 of 3 patches has a Reviewed-by or Acked-by.
| Patch | Yonghong Song |
|---|---|
| 1/3 | |
| 2/3 | |
| 3/3 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH bpf-next v8 0/3] Pass external callchain entry to get_perf_callchain
Background
==========
Alexei noted we should use preempt_disable to protect get_perf_callchain in bpf stackmap.
https://lore.kernel.org/bpf/CAADnVQ+s8B7-fvR1TNO-bniSyKv57cH_ihRszmZV7pQDyV=VDQ@mail.gmail.com
A previous patch was submitted to attempt fixing this issue. And Andrii suggested teach get_perf_callchain to let us pass that buffer directly to avoid that unnecessary copy.
https://lore.kernel.org/bpf/[email protected]
Proposed Solution
=================
Add external perf_callchain_entry parameter for get_perf_callchain to allow us to use external buffer from BPF side. The biggest advantage is that it can reduce unnecessary copies.
Todo
====
But I'm not sure if this modification is appropriate. After all, the implementation of get_callchain_entry in the perf subsystem seems much more complex than directly using an external buffer.
Comments and suggestions are always welcome.
Change list:
- v1 -> v2
From Jiri
- rebase code, fix conflict
- v1: https://lore.kernel.org/bpf/[email protected]
- v2 -> v3:
From Andrii
- entries per CPU used in a stack-like fashion
- v2: https://lore.kernel.org/bpf/[email protected]
- v3 -> v4:
From Peter
- refactor get_perf_callchain and add three new APIs to use perf callchain easily.
From Andrii
- reuse the perf callchain management.
- rename patch1 and patch2.
- v3: https://lore.kernel.org/bpf/[email protected]
- v4 -> v5:
From Yonghong
- keep add_mark false in stackmap when refactor get_perf_callchain in
patch1.
- add atomic operation in get_recursion_context in patch2.
- rename bpf_put_callchain_entry with bpf_put_perf_callchain in
patch3. - rebase bpf-next master.
- v4: https://lore.kernel.org/bpf/[email protected]
- v5 -> v6:
From Peter
- disable preemption from BPF side in patch2.
From AI
- use ctx->entry->nr instead of ctx->nr in patch1.
- v5: https://lore.kernel.org/bpf/[email protected]
- v6 -> v7:
From yonghong
- Add ack in patch2
From AI
- resolve conflict
- v6: https://lore.kernel.org/bpf/[email protected]
- v7 -> v8:
From Andrii
- Record rctx in perf_callchain_entry in patch1
- Export __get_perf_callchain in patch2
- v7: https://lore.kernel.org/bpf/[email protected]
Tao Chen (3):
perf: Add rctx in perf_callchain_entry
perf: Refactor get_perf_callchain
bpf: Hold ther perf callchain entry until used completely
include/linux/perf_event.h | 10 +++++-- kernel/bpf/stackmap.c | 58 ++++++++++++++++++++++++++++++------- kernel/events/callchain.c | 59 ++++++++++++++++++++++++-------------- 3 files changed, 93 insertions(+), 34 deletions(-)
Signature · 1 line
2.48.1