-
Notifications
You must be signed in to change notification settings - Fork 111
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
perf tools: Fix prologue generation #3109
Conversation
Master branch: f175ece |
Master branch: f913ad6 |
d91190c
to
8319448
Compare
Master branch: f913ad6 |
8319448
to
eac041c
Compare
Master branch: 4349680 |
eac041c
to
f92cce1
Compare
4349680
to
02f4afe
Compare
Master branch: 02f4afe |
f92cce1
to
d7cf874
Compare
Master branch: d352bd8 |
d7cf874
to
e67cfda
Compare
Master branch: d352bd8 |
e67cfda
to
0242ff0
Compare
Master branch: 0b81705 |
0242ff0
to
cf98e41
Compare
Master branch: fe92833 |
Perf is using section name to declare special kprobe arguments, which no longer works with current libbpf, that either requires certain form of the section name or allows to register custom handler. Adding perf support to register 'fallback' section handler to take care of perf kprobe programs. The fallback means that it handles any section definition besides the ones that libbpf handles. The handler serves two purposes: - allows perf programs to have special arguments in section name - allows perf to use pre-load callback where we can attach init code (zeroing all argument registers) to each perf program The second is essential part of new prologue generation code, that's coming in following patch. Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Some functions we use for bpf prologue generation are going to be deprecated. This change reworks current code not to use them. We need to replace following functions/struct: bpf_program__set_prep bpf_program__nth_fd struct bpf_prog_prep_result Currently we use bpf_program__set_prep to hook perf callback before program is loaded and provide new instructions with the prologue. We replace this function/ality by taking instructions for specific program, attaching prologue to them and load such new ebpf programs with prologue using separate bpf_prog_load calls (outside libbpf load machinery). Before we can take and use program instructions, we need libbpf to actually load it. This way we get the final shape of its instructions with all relocations and verifier adjustments). There's one glitch though.. perf kprobe program already assumes generated prologue code with proper values in argument registers, so loading such program directly will fail in the verifier. That's where the fallback pre-load handler fits in and prepends the initialization code to the program. Once such program is loaded we take its instructions, cut off the initialization code and prepend the prologue. I know.. sorry ;-) Suggested-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
cf98e41
to
9c2cea8
Compare
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=647321 expired. Closing PR. |
Pull request for series with
subject: perf tools: Fix prologue generation
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=647121