summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2026-10-16 19:50:00 +0000
committerAlexei Starovoitov <ast@kernel.org>2026-10-16 19:50:01 +0000
commit645f5fcf7a5582f5d6ed2322f41cb34076c63b2c (patch)
tree3a12b546a7e2d9753560a52a0ff6e8434af9d3a4 /tools/perf/scripts/python
parent837e5176bb157d7bc1f6cb8b5a33be6edf327542 (diff)
parent8395b40318816ded8e4c55f07741dd5594ee9b9b (diff)
Merge branch 'bpf-follow-up-by-value-struct-and-__int128-argument-support'
Yonghong Song says: ==================== bpf: Follow up by-value struct and __int128 argument support This is a follow-up to the series "bpf: Support by-value struct and __int128 arguments" [1], which placed kfunc arguments by the kernel calling convention in the x86-64 and arm64 JITs, and made the arm64 trampoline place an argument aligned to 16 bytes: an __int128, or an aggregate holding one. This series covers what was left, and a few problems found on the way: - The x86-64 trampoline. x86-64 starts such an argument passed on the stack at a 16-byte aligned slot, which can leave an empty slot before it, but the trampoline copied the stack arguments as if there were none. A bpf program attached to such a function read the wrong values from the empty slot on, and with fexit, where the trampoline calls the traced function itself, that function got its stack arguments one slot off as well. - A trampoline on a BPF function. BPF code calls one with argument slot N where the kernel convention passes its Nth u64 argument, but the trampolines placed the arguments by their types: arm64 left a register empty before a 16-byte argument, x86-64 would not split one between r9 and the stack, and s390 took one as a pointer to it. Such a function is now described to its trampoline as one u64 per slot. - The x86-64 trampoline on a function of a program that can tail call pushed the tail call counter pointer between the stack arguments and the return address. - A static function whose BTF is unreliable could still take stack arguments, while its trampoline saved and restored only five registers. Attaching to such a function is now refused. - Tests with an __int128 at an odd slot, where arm64 leaves a register or a stack slot empty. On arm64 such a kfunc gets BTF only with the pahole patch [2], now in pahole master after v1.32, so these tests were not part of [1]. Patch 1 keeps the x86-64 trampoline's tail call counter pointer clear of the stack arguments, and patch 2 tests it. Patch 3 adds the odd-slot kfunc tests. Patch 4 describes a BPF function to its trampoline as one u64 per slot, and patch 5 places the x86-64 trampoline arguments by the calling convention. Patches 6 and 7 test trampolines on kernel functions and on BPF functions with an argument after a 16-byte aligned one, the latter on s390x as well. Patch 8 refuses a trampoline on an unreliable static function with stack arguments, and patch 9 tests it, along with a BPF function whose 16-byte argument x86-64 splits between r9 and the stack. [1] https://lore.kernel.org/bpf/20260912195156.980886-1-yonghong.song@linux.dev/ [2] https://lore.kernel.org/dwarves/20260917164043.1577508-1-yonghong.song@linux.dev/ Changelogs: v3 -> v4: - v3: https://lore.kernel.org/bpf/20261013170910.2126673-1-yonghong.song@linux.dev/ - Drop v3 patches 10 and 11 (16-byte aligned kfunc stack argument on x86-64); no kfunc in the tree needs it. - Drop byte-order based ctx indexing for the __int128 struct argument; tests on BPF functions use BPF_PROG2(). (patches 6, 7 and 9) - Run the test on BPF functions on s390x too. The functions taking stack arguments are built only for x86 and arm64. (patch 7) - Say that patch 4 also fixes the s390 trampoline on a BPF function taking a 16-byte argument. (patch 4) v2 -> v3: - v2: https://lore.kernel.org/bpf/20261013003429.1853052-1-yonghong.song@linux.dev/ - Index the two halves of a struct holding an __int128 in ctx by the byte order, so the tracing tests also hold on a big-endian kernel. (patches 6, 7 and 9) - Say that only x86-64 BPF code splits a 16-byte argument between r9 and the stack; on arm64 nothing is split. (patches 4 and 9) v1 -> v2: - v1: https://lore.kernel.org/bpf/20261009064206.1238047-1-yonghong.song@linux.dev/ - Replace the bpf_tgt_prog flag of v1 patch 2, which only bpf_jit_place_args() looked at, with a model of one u64 per argument slot for a BPF function, built in bpf_check_attach_target(). This also fixes the arm64 trampoline, which took a 16-byte argument split between x7 and the stack as wholly in registers, without any arch change. (patch 4) - Refuse a trampoline on a static function whose BTF is unreliable but which takes stack arguments. (patches 8 and 9) - New: keep the x86-64 trampoline's tail call counter pointer in a slot of its frame instead of pushing it between the stack arguments and the return address. (patches 1 and 2) - New: pass a kfunc's 16-byte aligned stack argument 16-byte aligned in the x86-64 JIT, with bpf_jit_stack_slots_to_align() and bpf_jit_plan_slot_moves() in kernel/bpf/core.c. (patches 10 and 11) - Reword the x86-64 placement patch and the BPF function test for the new model. (patches 5 and 7) ==================== Link: https://patch.msgid.link/20261016183039.1132126-1-yonghong.song@linux.dev Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions