Re: [PATCH v2] selftests/bpf: move trampoline_count to dedicated bpf_testmod target

From: Alexei Starovoitov

Date: Thu Mar 19 2026 - 02:15:05 EST


On Wed, Mar 18, 2026 at 9:04 PM Sun Jian <sun.jian.kdev@xxxxxxxxx> wrote:
>
> trampoline_count fills all trampoline attachment slots for a single
> target function and verifies that one extra attach fails with -E2BIG.
>
> It currently targets bpf_modify_return_test, which is also used by
> other selftests such as modify_return, get_func_ip_test, and
> get_func_args_test. When such tests run in parallel, they can contend
> for the same per-function trampoline quota and cause unexpected attach
> failures. This issue is currently masked by harness serialization.
>
> Move trampoline_count to a dedicated bpf_testmod target and register it
> for fmod_ret attachment. This keeps the test semantics unchanged while
> isolating it from other selftests, so it no longer needs to run in
> serial mode. Remove the TODO comment as well.
>
> Tested:
> ./test_progs -t trampoline_count -vv
> ./test_progs -t modify_return -vv
> ./test_progs -t get_func_ip_test -vv
> ./test_progs -t get_func_args_test -vv
> ./test_progs -j$(nproc) -t trampoline_count -vv
> ./test_progs -j$(nproc) -t
> trampoline_count,modify_return,get_func_ip_test,get_func_args_test,\
> kprobe_multi_test -vv
> 20 runs of:
> ./test_progs -j$(nproc) -t
> trampoline_count,modify_return,get_func_ip_test,get_func_args_test,\
> kprobe_multi_test
>
> Signed-off-by: Sun Jian <sun.jian.kdev@xxxxxxxxx>

if you want to land these patches please participate in code reviews:
https://lore.kernel.org/bpf/CAADnVQ+TKKptnNB25V3=bcdybh5G6c2DyW2sYtXvyRaVnPN8MA@xxxxxxxxxxxxxx/