From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796214947; b=1toQpHLNwDEioQRF8yUkDniauEqxjPGt1MVExCXAFPknQTusOKK77+dONdIe5xeQBkdz yaaht3wg8duCAqV7lBPB6UpOPa139TuHxpzGS0GrqYKfY1/Nwyis+Oj5ObosGjZbSLCYk x7yDRwlvNO+2788wEw93mMwVWSEqcGjU1fBuEgGsq2VT3PlKS8cMnawZ0RJYm2C7w/e4B vOhfjTFtlZEeA3b06JT4wdfCSagybk08gPXWFEKeWQeowy6wrmE2HXkkqAmo4Eb0dyQB8 iOUQZRcJs+SQdZGkd9+HkCyiS/w1euZOj8lgTrjtrt0ZrgHSDrCTHAO9cSL+ZZyjSFQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796214947; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=Ta8doYja9IgJ2R0fdw/ABmcPY57s4ldx288UXjI3Fdo=; b=J14I7OPKq0JKGRcwl39icgfOoJbKaLmXQmFTulnQd/ql1hT4zzfeabjlkyuJAeFjNgdY pV/oiy+nozB87Bwi7k0bziXh6yAcOzYmL3XtDQ953nKkYEJ4Bg9OWfe0/zhzRa9D0u5sn HwnowLRVfpyqQq6Ebx1iQKItvt/mOtv5bEqYNsHJf5J/lN7v/nwqbvVwOaaQytTEW4Ded o1Ff4TYCahGpxALei+HplLaqqKrIa3JT3FhnAp8EbSM4WyuFfnwAAFOeKV973QZP6D8E+ QeyTVVzUELNCdWW0V3IWCKhYVsXFeoIIt99plCAwcKwhpx7f2cToP6sr433pFQqkOAw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=CrIcyvk5; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A5D1E606A323; Wed, 2 Dec 2026 12:35:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=CrIcyvk5 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7405D1F00893; Wed, 2 Dec 2026 12:35:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796214947; bh=Ta8doYja9IgJ2R0fdw/ABmcPY57s4ldx288UXjI3Fdo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=CrIcyvk547dVZxSGHn7Q2WEopfA/H04BxqVQTkL7mIw/B2RiQ3V96RZBOUSDsvxsF QTY2yJs/rElATm5NyCfDTMAfWOmvym0JohwmAcBwCmCpffJQUoHStkOTUh8YihFOdB JCy9vLPLk/AnLMksu33g50UXwCGAmIWK6ktFJBdFiDO8yhg74pc8v8BVJfD1+asM+H 8iP4TJXJWdjHhcbWZfsufqhsil8aoRBbVVcFx3L/Akb4D55szbC+56bhUf12Hf7gyR KicbKuCVL3+EKAnw1ra4wcI3kHLQ8+hxwSsEOVjQhKi3RIODtKXlwSqmZesIJ8amqa lGpa3T6F2u/uw== From: Jiri Olsa To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Masami Hiramatsu Cc: bpf@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, Song Liu , Yonghong Song , Quentin Monnet , Alan Maguire Subject: [PATCH RFC bpf-next 30/31] selftests/bpf: Add kprobe multi inline bench attach test Date: Wed, 2 Dec 2026 13:30:34 +0100 Message-ID: <20261202123035.10335-31-jolsa@kernel.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261202123035.10335-1-jolsa@kernel.org> References: <20261202123035.10335-1-jolsa@kernel.org> X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add kernel_inline and modules_inline subtests to the kprobe_multi_bench_attach test that attach all attachable functions with BPF_F_KPROBE_MULTI_INLINE flag, so the link is attached also to all their inlined instances. On top of the attach/detach times the test prints the number of attached and skipped inlined instances from the link's fdinfo. Signed-off-by: Jiri Olsa --- .../bpf/prog_tests/kprobe_multi_test.c | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c b/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c index 6ae5bfaa81ba..c403d1cb9d9e 100644 --- a/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c +++ b/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c @@ -520,6 +520,7 @@ static void do_bench_test(struct kprobe_multi_empty *skel, struct bpf_kprobe_mul long detach_start_ns, detach_end_ns; double attach_delta, detach_delta; struct bpf_link *link = NULL; + long inline_cnt = 0, inline_skipped = 0; attach_start_ns = get_time_ns(); link = bpf_program__attach_kprobe_multi_opts(skel->progs.test_kprobe_empty, @@ -529,6 +530,11 @@ static void do_bench_test(struct kprobe_multi_empty *skel, struct bpf_kprobe_mul if (!ASSERT_OK_PTR(link, "bpf_program__attach_kprobe_multi_opts")) return; + if (opts->inlined) { + inline_cnt = get_fdinfo_cnt(bpf_link__fd(link), "kprobe_inline_cnt"); + inline_skipped = get_fdinfo_cnt(bpf_link__fd(link), "kprobe_inline_skipped"); + } + detach_start_ns = get_time_ns(); bpf_link__destroy(link); detach_end_ns = get_time_ns(); @@ -537,6 +543,10 @@ static void do_bench_test(struct kprobe_multi_empty *skel, struct bpf_kprobe_mul detach_delta = (detach_end_ns - detach_start_ns) / 1000000000.0; printf("%s: found %lu functions\n", __func__, opts->cnt); + if (opts->inlined) { + printf("%s: attached %ld inlined instances, skipped %ld\n", __func__, + inline_cnt, inline_skipped); + } printf("%s: attached in %7.3lfs\n", __func__, attach_delta); printf("%s: detached in %7.3lfs\n", __func__, detach_delta); } @@ -574,6 +584,42 @@ static bool inline_attach_supported(void) #endif } +/* Attach all attachable functions together with their inlined instances. */ +static void test_kprobe_multi_bench_attach_inline(bool kernel) +{ + LIBBPF_OPTS(bpf_kprobe_multi_opts, opts); + struct kprobe_multi_empty *skel = NULL; + struct ksyms *ksyms = NULL; + + if (!inline_attach_supported()) { + test__skip(); + return; + } + + /* pahole may not have inline BTF feature support. */ + if (access("/sys/kernel/btf/vmlinux.inline", F_OK)) { + test__skip(); + return; + } + + if (!ASSERT_OK(bpf_get_ksyms(&ksyms, kernel), "bpf_get_ksyms")) + return; + + skel = kprobe_multi_empty__open_and_load(); + if (!ASSERT_OK_PTR(skel, "kprobe_multi_empty__open_and_load")) + goto cleanup; + + opts.syms = (const char **)ksyms->filtered_syms; + opts.cnt = ksyms->filtered_cnt; + opts.inlined = true; + + do_bench_test(skel, &opts); + +cleanup: + kprobe_multi_empty__destroy(skel); + free_kallsyms_local(ksyms); +} + static void test_kprobe_multi_bench_attach_addr(bool kernel) { LIBBPF_OPTS(bpf_kprobe_multi_opts, opts); @@ -1625,6 +1671,10 @@ void serial_test_kprobe_multi_bench_attach(void) test_kprobe_multi_bench_attach_addr(true); if (test__start_subtest("modules")) test_kprobe_multi_bench_attach_addr(false); + if (test__start_subtest("kernel_inline")) + test_kprobe_multi_bench_attach_inline(true); + if (test__start_subtest("modules_inline")) + test_kprobe_multi_bench_attach_inline(false); } void test_kprobe_multi_test(void) -- 2.56.1