BPF List
 help / color / mirror / Atom feed
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>,
	Jiri Olsa <jolsa@kernel.org>
Subject: [PATCH v2 bpf-next 7/9] libbpf: move BTF loading step after relocation step
Date: Tue, 2 Jan 2024 11:00:53 -0800	[thread overview]
Message-ID: <20240102190055.1602698-8-andrii@kernel.org> (raw)
In-Reply-To: <20240102190055.1602698-1-andrii@kernel.org>

With all the preparations in previous patches done we are ready to
postpone BTF loading and sanitization step until after all the
relocations are performed.

While at it, simplify step name from bpf_object_sanitize_and_load_btf
to bpf_object_load_btf. Map creation and program loading steps also
perform sanitization, but they don't explicitly reflect it in overly
verbose function name. So keep naming and approch consistent here.

Acked-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
 tools/lib/bpf/libbpf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index d44aea1cc428..d5f5c1a8f543 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -3122,7 +3122,7 @@ static int bpf_object_load_vmlinux_btf(struct bpf_object *obj, bool force)
 	return 0;
 }
 
-static int bpf_object_sanitize_and_load_btf(struct bpf_object *obj)
+static int bpf_object_load_btf(struct bpf_object *obj)
 {
 	struct btf *kern_btf = obj->btf;
 	bool btf_mandatory, sanitize;
@@ -8068,10 +8068,10 @@ static int bpf_object_load(struct bpf_object *obj, int extra_log_level, const ch
 	err = bpf_object_probe_loading(obj);
 	err = err ? : bpf_object_load_vmlinux_btf(obj, false);
 	err = err ? : bpf_object_resolve_externs(obj, obj->kconfig);
-	err = err ? : bpf_object_sanitize_and_load_btf(obj);
 	err = err ? : bpf_object_sanitize_maps(obj);
 	err = err ? : bpf_object_init_kern_struct_ops_maps(obj);
 	err = err ? : bpf_object_relocate(obj, obj->btf_custom_path ? : target_btf_path);
+	err = err ? : bpf_object_load_btf(obj);
 	err = err ? : bpf_object_create_maps(obj);
 	err = err ? : bpf_object_load_progs(obj, extra_log_level);
 	err = err ? : bpf_object_init_prog_arrays(obj);
-- 
2.34.1


  parent reply	other threads:[~2024-01-02 19:01 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-02 19:00 [PATCH v2 bpf-next 0/9] Libbpf-side __arg_ctx fallback support Andrii Nakryiko
2024-01-02 19:00 ` [PATCH v2 bpf-next 1/9] libbpf: name internal functions consistently Andrii Nakryiko
2024-01-03 23:12   ` Alexei Starovoitov
2024-01-03 23:17     ` Eduard Zingerman
2024-01-04  0:30       ` Andrii Nakryiko
2024-01-02 19:00 ` [PATCH v2 bpf-next 2/9] libbpf: make uniform use of btf__fd() accessor inside libbpf Andrii Nakryiko
2024-01-02 19:00 ` [PATCH v2 bpf-next 3/9] libbpf: use explicit map reuse flag to skip map creation steps Andrii Nakryiko
2024-01-02 19:00 ` [PATCH v2 bpf-next 4/9] libbpf: don't rely on map->fd as an indicator of map being created Andrii Nakryiko
2024-01-02 19:00 ` [PATCH v2 bpf-next 5/9] libbpf: use stable map placeholder FDs Andrii Nakryiko
2024-01-03 20:57   ` Eduard Zingerman
2024-01-03 22:46     ` Andrii Nakryiko
2024-01-02 19:00 ` [PATCH v2 bpf-next 6/9] libbpf: move exception callbacks assignment logic into relocation step Andrii Nakryiko
2024-01-02 19:00 ` Andrii Nakryiko [this message]
2024-01-02 19:00 ` [PATCH v2 bpf-next 8/9] libbpf: implement __arg_ctx fallback logic Andrii Nakryiko
2024-01-03 20:57   ` Eduard Zingerman
2024-01-03 23:10     ` Andrii Nakryiko
2024-01-03 23:43       ` Eduard Zingerman
2024-01-03 23:59         ` Andrii Nakryiko
2024-01-04  0:09           ` Eduard Zingerman
2024-01-04  0:27             ` Andrii Nakryiko
2024-01-02 19:00 ` [PATCH v2 bpf-next 9/9] selftests/bpf: add arg:ctx cases to test_global_funcs tests Andrii Nakryiko
2024-01-03 20:57   ` Eduard Zingerman
2024-01-03 23:17     ` Andrii Nakryiko
2024-01-03 23:51       ` Eduard Zingerman
2024-01-04  0:26         ` Andrii Nakryiko
2024-01-04  0:28           ` Eduard Zingerman
2024-01-02 19:57 ` [PATCH v2 bpf-next 0/9] Libbpf-side __arg_ctx fallback support Andrii Nakryiko
2024-01-03 20:57 ` Eduard Zingerman

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=20240102190055.1602698-8-andrii@kernel.org \
    --to=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jolsa@kernel.org \
    --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