From nobody Mon Apr 6 14:57:15 2026 Received: from mail-dl1-f44.google.com (mail-dl1-f44.google.com [74.125.82.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7169030E84F for ; Thu, 19 Mar 2026 03:12:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773889959; cv=none; b=SlcMM5leu20N3rSlQ1oOYJGBi+KBKIRoso8xZWmQCbTTs6kYZwxHnwjU9Np3ywJO3Th/Yw/T+LMuWaCm/kj/4rFofHOx8ikhthBYDuOTfyl7I8axEopLmN2TSaKSY5EHpVzO9QziAyOiGBG1Uk++ded25+xekaJ/MQhT+Bs21bk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773889959; c=relaxed/simple; bh=OQN1kt/oQVgvZ4HUaTJNxkHVzBBhZ3DiRkzvZeMcZdk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=O1PB1GE0RaX7IUCGlAwHAhGD0bpDWeKSaBk5lzxsVH2MeOnKIufgX9d6k7RGMZ3wsmADN2WpaVZbRiF1wAv1to0SlfDjv7QEQbEuLC/SOUiKfm8/9rBdsDy24nLAvEMbQpPGxzWwqlIL0vIZWLHT5p0i0WRaSFdTDt3jdYKentg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QZ9svj7R; arc=none smtp.client-ip=74.125.82.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QZ9svj7R" Received: by mail-dl1-f44.google.com with SMTP id a92af1059eb24-126ea4b77adso217339c88.1 for ; Wed, 18 Mar 2026 20:12:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773889957; x=1774494757; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=HaQeluzw0pyS5dmNEqnoRowDSdw9ZIo82XeBTu2w18M=; b=QZ9svj7R29Q+I0lq27pL3BIaFzZfAwmwj6QGaETEataXkQZqFBWCYZrFt8h+nO8YD+ sgr5cxk0cW7ghztqkl6/AeBhsduCoNP3U7y440UB73Hkry8ooqFFb1vYDAvapIJNc9AS G45sG+irzmAjOi/S+3RNjAXs5oXPhkakh1F7rGVaXfzHNqAZPU3EOurk/9/bNZUU7bmw jQArIof5hyuXHz86fZM6Y6lWLmKHM+J2m6d9qEYCeKWl06jyh9DH16aailf6VDo9TVLi lO4TztdrnQNO4MsHeRAWWlFEqPWUXj8ktHGErVb+4+WrWdZKqgpPV2Uv6tyiuIZEG2oN ZzYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773889957; x=1774494757; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=HaQeluzw0pyS5dmNEqnoRowDSdw9ZIo82XeBTu2w18M=; b=hR7ZTjr65p/IRdP9Q7ZP4oIKfbaw0Wos7Gt30vQy+EHqyIHaYufwrcQIkr5xZrdPD7 T5zla5kSzHrewtUmP4lC/pe5hklqWQVB3wk23pAhfFhm1/MBDcDS9uwfxmvuBFNM5sOg 2TSwEYBkYBI6YGJ+TEXkoL5X2ZhdV5SIPCSDSAxDkHOe+xnJfMPvfEhCyBInJNKWSrk2 G9SnzwxhPnz8cy8ahGZgjp+ZCzLIg19n1/JxVUcrgTkxNAuZY4EhVRsnCH3UNp4ys8U5 LgDEUPGFri1C9BRJbFp3M9UISMRA62XIM0HHqhEToUyffx9JyXETRKtLy+c+nz5C1rhk B7bg== X-Forwarded-Encrypted: i=1; AJvYcCW3iC7HjLxXxxSjiBhERxuk7jqe+68mztlLEjKsqlkiwbZp4eCvr5oWlTBXu1+qLl7NXscyd5ldQ+HSJZc=@vger.kernel.org X-Gm-Message-State: AOJu0YwqXxjixgUU3lYC8+FTEdC3BFiy2GFuUpCY7TzQDTlAVtdydsah c+5GVA8S6cgpG4IRGDAdZtNEPi+t6kZTTFo9EXvohQt0pRqbiBYS/e7s X-Gm-Gg: ATEYQzxq/5bAvrxtNxTwUQmp8iZmSh663Z2WRpgbnZMF/B+2TzyW3fKXk950MHJFE4z 4Amsa83Ea8mdDQjW3R80ek/ZsJ6kVSQRpx4d2ur13nvHRiOhHJnoFt5gcUw9Gr35AYZrNpQjVua rhB6ITnK9L1TpJYL6q5Z6K0bKrY+bUhpckF+QO738Ys//ZQUVXUlEmluk3B85UiyVJJkv9Kuo2L Rs2alxnmHTuXXwccMuOi47TAabitngQbJ3EZSWLi5CuKX/MUjmTDnd29B9L9C++0cyXVcVGfHEU VFywGC46sTz2oMRrVfTSthGL/JbTPIwJcq4QXVVKzPkIzpXRzCtcoVFL2l8+0uwaBVhIgxihXIU bPTkeg+BQvfUFfNIHjZKWBH0D2uut3diuoqFOM8hABvQZwB+duB22YVdWwGvcObFsMB8j+kDetf 6pvz2PvMJ/Ig3rBcg63XKS+rVBq6gCb6aB9C2Y0VZv2mFzobl6iFkN1y2xaTgbDHEvAPPsL/Eg4 i2+foY0Fs3CZrpVeX24JzsK368= X-Received: by 2002:a05:7022:6608:b0:11b:82b8:40ae with SMTP id a92af1059eb24-129a70e5ecbmr3309714c88.18.1773889957433; Wed, 18 Mar 2026 20:12:37 -0700 (PDT) Received: from localhost.localdomain (108-214-96-168.lightspeed.sntcca.sbcglobal.net. [108.214.96.168]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2c0e53b51easm6458674eec.7.2026.03.18.20.12.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2026 20:12:37 -0700 (PDT) From: Sun Jian To: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, shuah@kernel.org Cc: martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org, yonghong.song@linux.dev, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@fomichev.me, haoluo@google.com, jolsa@kernel.org, paul.chaignon@gmail.com, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Sun Jian Subject: [PATCH] selftests/bpf: trampoline_count: use dedicated bpf_testmod target Date: Thu, 19 Mar 2026 11:12:27 +0800 Message-ID: <20260319031227.330505-1-sun.jian.kdev@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- .../selftests/bpf/prog_tests/trampoline_count.c | 3 +-- .../selftests/bpf/progs/test_trampoline_count.c | 6 +++--- .../selftests/bpf/test_kmods/bpf_testmod.c | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/trampoline_count.c b/to= ols/testing/selftests/bpf/prog_tests/trampoline_count.c index 6cd7349d4a2b..b19358aed126 100644 --- a/tools/testing/selftests/bpf/prog_tests/trampoline_count.c +++ b/tools/testing/selftests/bpf/prog_tests/trampoline_count.c @@ -30,8 +30,7 @@ static struct bpf_program *load_prog(char *file, char *na= me, struct inst *inst) return prog; } =20 -/* TODO: use different target function to run in concurrent mode */ -void serial_test_trampoline_count(void) +void test_trampoline_count(void) { char *file =3D "test_trampoline_count.bpf.o"; char *const progs[] =3D { "fentry_test", "fmod_ret_test", "fexit_test" }; diff --git a/tools/testing/selftests/bpf/progs/test_trampoline_count.c b/to= ols/testing/selftests/bpf/progs/test_trampoline_count.c index 7765720da7d5..14ad2f53cf33 100644 --- a/tools/testing/selftests/bpf/progs/test_trampoline_count.c +++ b/tools/testing/selftests/bpf/progs/test_trampoline_count.c @@ -3,19 +3,19 @@ #include #include =20 -SEC("fentry/bpf_modify_return_test") +SEC("fentry/bpf_testmod_trampoline_count_test") int BPF_PROG(fentry_test, int a, int *b) { return 0; } =20 -SEC("fmod_ret/bpf_modify_return_test") +SEC("fmod_ret/bpf_testmod_trampoline_count_test") int BPF_PROG(fmod_ret_test, int a, int *b, int ret) { return 0; } =20 -SEC("fexit/bpf_modify_return_test") +SEC("fexit/bpf_testmod_trampoline_count_test") int BPF_PROG(fexit_test, int a, int *b, int ret) { return 0; diff --git a/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c b/tools/t= esting/selftests/bpf/test_kmods/bpf_testmod.c index e62c6b78657f..6eaceb4dfbec 100644 --- a/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c +++ b/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c @@ -581,6 +581,12 @@ noinline int bpf_fentry_shadow_test(int a) } EXPORT_SYMBOL_GPL(bpf_fentry_shadow_test); =20 +noinline int bpf_testmod_trampoline_count_test(int a, int *b) +{ + *b +=3D 1; + return a + *b; +} + __bpf_hook_end(); =20 static struct bin_attribute bin_attr_bpf_testmod_file __ro_after_init =3D { @@ -1843,6 +1849,16 @@ struct bpf_struct_ops testmod_multi_st_ops =3D { =20 extern int bpf_fentry_test1(int a); =20 +BTF_KFUNCS_START(bpf_testmod_trampoline_count_ids) +BTF_ID_FLAGS(func, bpf_testmod_trampoline_count_test) +BTF_KFUNCS_END(bpf_testmod_trampoline_count_ids) + +static const struct +btf_kfunc_id_set bpf_testmod_trampoline_count_fmodret_set =3D { + .owner =3D THIS_MODULE, + .set =3D &bpf_testmod_trampoline_count_ids, +}; + static int bpf_testmod_init(void) { const struct btf_id_dtor_kfunc bpf_testmod_dtors[] =3D { @@ -1859,6 +1875,7 @@ static int bpf_testmod_init(void) ret =3D ret ?: register_btf_kfunc_id_set(BPF_PROG_TYPE_TRACING, &bpf_test= mod_kfunc_set); ret =3D ret ?: register_btf_kfunc_id_set(BPF_PROG_TYPE_SYSCALL, &bpf_test= mod_kfunc_set); ret =3D ret ?: register_btf_kfunc_id_set(BPF_PROG_TYPE_STRUCT_OPS, &bpf_t= estmod_kfunc_set); + ret =3D ret ?: register_btf_fmodret_id_set(&bpf_testmod_trampoline_count_= fmodret_set); ret =3D ret ?: register_bpf_struct_ops(&bpf_bpf_testmod_ops, bpf_testmod_= ops); ret =3D ret ?: register_bpf_struct_ops(&bpf_testmod_ops2, bpf_testmod_ops= 2); ret =3D ret ?: register_bpf_struct_ops(&bpf_testmod_ops3, bpf_testmod_ops= 3); base-commit: 8a30aeb0d1b4e4aaf7f7bae72f20f2ae75385ccb --=20 2.43.0