aliyun/plugsched

conflict with ftrace function_graph

Opened this issue · 2 comments

When running tools/testing/selftests/bpf/test_ftrace.sh on kernel 5.10, I found ftrace shutdown due to conflict with the interface functions.

This is because:
"echo function_graph > current_tracer" enables function_graph, and ftrace will try to modify many functions (including interface functions).
The check in ftrace_verify_code() will fail and causing the whole ftrace shutdown.

Just like commit b91e014f078e ("bpf: Make BPF trampoline use register_ftrace_direct() API"), we can use the API of ftrace to let it know we've already occupied the function entry.
However this still remains several problems (conflicts with function_graph, fentry/fexit, etc). They will just return -EBUSY, instead of directly shutdown (this is a good news).

Plan B: borrow from bpf trampoline
do sth. like bpf_trampoline_get() and modify tr->func.addr directly.
then call bpf_trampoline_update()

So that we will have a trampoline like:
bpf fentry();
plugsched function(); <------- we modify this!
bpf fexit();