From: Andrii Nakryiko <andrii@kernel.org>
To: <bpf@vger.kernel.org>, <ast@kernel.org>, <daniel@iogearbox.net>
Cc: <andrii@kernel.org>, <kernel-team@fb.com>
Subject: [PATCH bpf-next 2/3] libbpf: use weak hidden modifier for USDT BPF-side API functions
Date: Fri, 8 Apr 2022 11:14:24 -0700 [thread overview]
Message-ID: <20220408181425.2287230-3-andrii@kernel.org> (raw)
In-Reply-To: <20220408181425.2287230-1-andrii@kernel.org>
Use __weak __hidden for bpf_usdt_xxx() APIs instead of much more
confusing `static inline __noinline`. This was previously impossible due
to libbpf erroring out on CO-RE relocations pointing to eliminated weak
subprogs. Now that previous patch fixed this issue, switch back to
__weak __hidden as it's a more direct way of specifying the desired
behavior.
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
tools/lib/bpf/usdt.bpf.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/lib/bpf/usdt.bpf.h b/tools/lib/bpf/usdt.bpf.h
index 881a2422a8ef..4181fddb3687 100644
--- a/tools/lib/bpf/usdt.bpf.h
+++ b/tools/lib/bpf/usdt.bpf.h
@@ -103,7 +103,7 @@ int __bpf_usdt_spec_id(struct pt_regs *ctx)
}
/* Return number of USDT arguments defined for currently traced USDT. */
-static inline __noinline
+__weak __hidden
int bpf_usdt_arg_cnt(struct pt_regs *ctx)
{
struct __bpf_usdt_spec *spec;
@@ -124,7 +124,7 @@ int bpf_usdt_arg_cnt(struct pt_regs *ctx)
* Returns 0 on success; negative error, otherwise.
* On error *res is guaranteed to be set to zero.
*/
-static inline __noinline
+__weak __hidden
int bpf_usdt_arg(struct pt_regs *ctx, __u64 arg_num, long *res)
{
struct __bpf_usdt_spec *spec;
@@ -204,7 +204,7 @@ int bpf_usdt_arg(struct pt_regs *ctx, __u64 arg_num, long *res)
* utilizing BPF cookies internally, so user can't use BPF cookie directly
* for USDT programs and has to use bpf_usdt_cookie() API instead.
*/
-static inline __noinline
+__weak __hidden
long bpf_usdt_cookie(struct pt_regs *ctx)
{
struct __bpf_usdt_spec *spec;
--
2.30.2
next prev parent reply other threads:[~2022-04-08 18:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-08 18:14 [PATCH bpf-next 0/3] Fix handling of CO-RE relos for __weak subprogs Andrii Nakryiko
2022-04-08 18:14 ` [PATCH bpf-next 1/3] libbpf: don't error out on CO-RE relos for overriden weak subprogs Andrii Nakryiko
2022-04-08 18:14 ` Andrii Nakryiko [this message]
2022-04-08 18:14 ` [PATCH bpf-next 3/3] selftests/bpf: add CO-RE relos into linked_funcs selftests Andrii Nakryiko
2022-04-08 18:40 ` [PATCH bpf-next 0/3] Fix handling of CO-RE relos for __weak subprogs Andrii Nakryiko
2022-04-08 21:09 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220408181425.2287230-3-andrii@kernel.org \
--to=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox