Thread (10 messages) 10 messages, 3 authors, 2d ago

Re: [PATCH v3 0/7] arm64: ftrace: support CALL_OPS on kernels built with kCFI

flat view

From: Sami Tolvanen <samitolvanen@google.com>
Date: 2026-10-29 21:59:11
Also in: bpf, linux-trace-kernel, lkml

Hi Jose,

On Thu, Oct 29, 2026 at 9:53 AM Jose Fernandez (Anthropic)
[off-list ref] wrote:
CALL_OPS and kCFI have been mutually exclusive on arm64 since commit
baaf553d3bc3 ("arm64: Implement HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS").
kCFI checks the type hash at a fixed offset before the entry point, so
every function needs the same number of prefix NOPs. Before clang 21 the
compiler could not emit prefix NOPs without also adding the function to
ftrace's table. Since commit 9315e22b0c0a ("arm64: ftrace: allow
DIRECT_CALLS without CALL_OPS") a kCFI kernel can attach BPF
trampolines. A trampoline out of BL range is reached through
ftrace_caller. That path costs ~10 ns more per call than on a CALL_OPS
kernel, plus ~4 ns for every extra ftrace_ops registered. Clang 21 takes
a section name as a third argument of -fpatchable-function-entry [1].
This series uses it to give every function three prefix NOPs while
keeping untraced functions out of ftrace's table, and enables CALL_OPS
under kCFI. The per-call cost drops by ~10 ns and stops growing with the
number of ftrace_ops registered.
Thanks for implementing this! For the series:

Reviewed-by: Sami Tolvanen <samitolvanen@google.com>

Sami
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help