diff options
| author | Alexei Starovoitov <ast@kernel.org> | 2026-10-31 21:55:40 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-11-02 22:20:01 +0000 |
| commit | 78821f4d8d1836c6cb9a21a780092906fc82ee09 (patch) | |
| tree | 3e523ac412a157f83a5b4240d48b44a16dae51f0 /scripts/basic/split-include.c | |
| parent | 85b6a11252ba7f9631eedcbc6744c6450e6ae8c7 (diff) | |
| download | linux-78821f4d8d1836c6cb9a21a780092906fc82ee09.tar.gz linux-78821f4d8d1836c6cb9a21a780092906fc82ee09.zip | |
bpf: Pass a pointer to arch_bpf_timed_may_goto()
arch_bpf_timed_may_goto() gets the offset of count and timestamp in the
stack frame in BPF_REG_AX. Arch code adds the frame pointer to it, and
calls bpf_check_timed_may_goto() with the result. On arm64, riscv,
loongarch, powerpc and s390 the asm function does it. On x86-64 the JIT
does it, because the frame pointer is in another register when the prog has
a private stack.
The next patch moves count and timestamp out of the stack frame. So pass
the pointer in BPF_REG_AX, and let the verifier emit the addition:
before after
r12 = -16 r12 = r10
call arch_bpf_timed_may_goto r12 += -16
call arch_bpf_timed_may_goto
The JITs know which register r10 is. The asm functions have a move in place
of the addition, and the special case in the x86-64 JIT goes away.
These insns run when the count is used up: in each 65535th iteration. The
cost of an iteration does not change.
Three tests have the insns of may_goto in them. Update them.
Tested on x86-64, and on arm64 and s390 in QEMU. riscv, loongarch and
powerpc are compile tested only.
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261031215543.682284-7-alexei.starovoitov@gmail.com
Diffstat (limited to 'scripts/basic/split-include.c')
0 files changed, 0 insertions, 0 deletions
