From: Andrii Nakryiko <andrii@kernel.org>
To: <bpf@vger.kernel.org>, <ast@kernel.org>, <daniel@iogearbox.net>,
<martin.lau@kernel.org>
Cc: <andrii@kernel.org>, <kernel-team@meta.com>
Subject: [PATCH bpf-next 6/6] libbpf: mark bpf_iter_num_{new,next,destroy} as __weak
Date: Mon, 17 Apr 2023 17:21:48 -0700 [thread overview]
Message-ID: <20230418002148.3255690-7-andrii@kernel.org> (raw)
In-Reply-To: <20230418002148.3255690-1-andrii@kernel.org>
Mark bpf_iter_num_{new,next,destroy}() kfuncs declared for
bpf_for()/bpf_repeat() macros as __weak to allow users to feature-detect
their presence and guard bpf_for()/bpf_repeat() loops accordingly for
backwards compatibility with old kernels.
Now that libbpf supports kfunc calls poisoning and better reporting of
unresolved (but called) kfuncs, declaring number iterator kfuncs in
bpf_helpers.h won't degrade user experience and won't cause unnecessary
kernel feature dependencies.
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
tools/lib/bpf/bpf_helpers.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/lib/bpf/bpf_helpers.h b/tools/lib/bpf/bpf_helpers.h
index 525dec66c129..929a3baca8ef 100644
--- a/tools/lib/bpf/bpf_helpers.h
+++ b/tools/lib/bpf/bpf_helpers.h
@@ -293,9 +293,9 @@ enum libbpf_tristate {
struct bpf_iter_num;
-extern int bpf_iter_num_new(struct bpf_iter_num *it, int start, int end) __ksym;
-extern int *bpf_iter_num_next(struct bpf_iter_num *it) __ksym;
-extern void bpf_iter_num_destroy(struct bpf_iter_num *it) __ksym;
+extern int bpf_iter_num_new(struct bpf_iter_num *it, int start, int end) __weak __ksym;
+extern int *bpf_iter_num_next(struct bpf_iter_num *it) __weak __ksym;
+extern void bpf_iter_num_destroy(struct bpf_iter_num *it) __weak __ksym;
#ifndef bpf_for_each
/* bpf_for_each(iter_type, cur_elem, args...) provides generic construct for
--
2.34.1
next prev parent reply other threads:[~2023-04-18 0:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-18 0:21 [PATCH bpf-next 0/6] Provide bpf_for() and bpf_for_each() by libbpf Andrii Nakryiko
2023-04-18 0:21 ` [PATCH bpf-next 1/6] libbpf: misc internal libbpf clean ups around log fixup Andrii Nakryiko
2023-04-18 0:21 ` [PATCH bpf-next 2/6] libbpf: report vmlinux vs module name when dealing with ksyms Andrii Nakryiko
2023-04-18 0:21 ` [PATCH bpf-next 3/6] libbpf: improve handling of unresolved kfuncs Andrii Nakryiko
2023-04-18 1:10 ` Alexei Starovoitov
2023-04-18 18:10 ` Andrii Nakryiko
2023-04-18 18:14 ` Alexei Starovoitov
2023-04-18 18:45 ` Andrii Nakryiko
2023-04-18 0:21 ` [PATCH bpf-next 4/6] selftests/bpf: add missing __weak kfunc log fixup test Andrii Nakryiko
2023-04-18 0:21 ` [PATCH bpf-next 5/6] libbpf: move bpf_for(), bpf_for_each(), and bpf_repeat() into bpf_helpers.h Andrii Nakryiko
2023-04-18 0:21 ` Andrii Nakryiko [this message]
2023-04-18 20:00 ` [PATCH bpf-next 0/6] Provide bpf_for() and bpf_for_each() by libbpf 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=20230418002148.3255690-7-andrii@kernel.org \
--to=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@meta.com \
--cc=martin.lau@kernel.org \
/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