diff mbox series

[bpf-next,v2,11/16] perf: Use bpf_{btf,link,map,prog}_get_info_by_fd()

Message ID 20230210001210.395194-12-iii@linux.ibm.com (mailing list archive)
State Changes Requested
Delegated to: BPF
Headers show
Series selftests/bpf: Add Memory Sanitizer support | expand

Checks

Context Check Description
bpf/vmtest-bpf-next-PR success PR summary
bpf/vmtest-bpf-next-VM_Test-39 success Logs for test_verifier on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-40 success Logs for test_verifier on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-11 success Logs for test_maps on s390x with gcc
netdev/tree_selection success Clearly marked for bpf-next, async
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count fail Series longer than 15 patches (and no cover letter)
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 9 maintainers not CCed: acme@kernel.org alexander.shishkin@linux.intel.com irogers@google.com mark.rutland@arm.com jolsa@kernel.org namhyung@kernel.org mingo@redhat.com linux-perf-users@vger.kernel.org peterz@infradead.org
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 48 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
bpf/vmtest-bpf-next-VM_Test-1 success Logs for ShellCheck
bpf/vmtest-bpf-next-VM_Test-2 success Logs for build for aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-3 success Logs for build for aarch64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-5 success Logs for build for x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-6 success Logs for build for x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-7 success Logs for llvm-toolchain
bpf/vmtest-bpf-next-VM_Test-8 success Logs for set-matrix
bpf/vmtest-bpf-next-VM_Test-4 success Logs for build for s390x with gcc
bpf/vmtest-bpf-next-VM_Test-9 success Logs for test_maps on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-10 success Logs for test_maps on aarch64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-12 success Logs for test_maps on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-13 success Logs for test_maps on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-14 fail Logs for test_progs on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-17 success Logs for test_progs on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-18 success Logs for test_progs on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-19 success Logs for test_progs_no_alu32 on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-20 success Logs for test_progs_no_alu32 on aarch64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-22 success Logs for test_progs_no_alu32 on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-23 success Logs for test_progs_no_alu32 on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-24 success Logs for test_progs_no_alu32_parallel on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-25 success Logs for test_progs_no_alu32_parallel on aarch64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-27 success Logs for test_progs_no_alu32_parallel on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-28 success Logs for test_progs_no_alu32_parallel on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-29 success Logs for test_progs_parallel on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-30 success Logs for test_progs_parallel on aarch64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-32 success Logs for test_progs_parallel on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-33 success Logs for test_progs_parallel on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-34 success Logs for test_verifier on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-35 success Logs for test_verifier on aarch64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-37 success Logs for test_verifier on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-38 success Logs for test_verifier on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-15 success Logs for test_progs on aarch64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-21 success Logs for test_progs_no_alu32 on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-26 success Logs for test_progs_no_alu32_parallel on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-31 success Logs for test_progs_parallel on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-36 success Logs for test_verifier on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-16 success Logs for test_progs on s390x with gcc

Commit Message

Ilya Leoshkevich Feb. 10, 2023, 12:12 a.m. UTC
Use the new type-safe wrappers around bpf_obj_get_info_by_fd().

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 tools/perf/util/bpf-utils.c   | 4 ++--
 tools/perf/util/bpf_counter.c | 2 +-
 tools/perf/util/bpf_counter.h | 6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)

Comments

Andrii Nakryiko Feb. 10, 2023, 11:26 p.m. UTC | #1
On Thu, Feb 9, 2023 at 4:13 PM Ilya Leoshkevich <iii@linux.ibm.com> wrote:
>
> Use the new type-safe wrappers around bpf_obj_get_info_by_fd().
>
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---

This will cause unnecessary pain for perf for a small gain. perf
supports linking libbpf dynamically, so using some very recent APIs is
a complication. So please drop this patch. Samples and bpftool
conversion is totally fine, IMO.

>  tools/perf/util/bpf-utils.c   | 4 ++--
>  tools/perf/util/bpf_counter.c | 2 +-
>  tools/perf/util/bpf_counter.h | 6 +++---
>  3 files changed, 6 insertions(+), 6 deletions(-)
>

[...]
diff mbox series

Patch

diff --git a/tools/perf/util/bpf-utils.c b/tools/perf/util/bpf-utils.c
index 80b1d2b3729b..a4154199f56c 100644
--- a/tools/perf/util/bpf-utils.c
+++ b/tools/perf/util/bpf-utils.c
@@ -121,7 +121,7 @@  get_bpf_prog_info_linear(int fd, __u64 arrays)
 		return ERR_PTR(-EINVAL);
 
 	/* step 1: get array dimensions */
-	err = bpf_obj_get_info_by_fd(fd, &info, &info_len);
+	err = bpf_prog_get_info_by_fd(fd, &info, &info_len);
 	if (err) {
 		pr_debug("can't get prog info: %s", strerror(errno));
 		return ERR_PTR(-EFAULT);
@@ -183,7 +183,7 @@  get_bpf_prog_info_linear(int fd, __u64 arrays)
 	}
 
 	/* step 5: call syscall again to get required arrays */
-	err = bpf_obj_get_info_by_fd(fd, &info_linear->info, &info_len);
+	err = bpf_prog_get_info_by_fd(fd, &info_linear->info, &info_len);
 	if (err) {
 		pr_debug("can't get prog info: %s", strerror(errno));
 		free(info_linear);
diff --git a/tools/perf/util/bpf_counter.c b/tools/perf/util/bpf_counter.c
index eeee899fcf34..5826a1073cf6 100644
--- a/tools/perf/util/bpf_counter.c
+++ b/tools/perf/util/bpf_counter.c
@@ -304,7 +304,7 @@  static bool bperf_attr_map_compatible(int attr_map_fd)
 	__u32 map_info_len = sizeof(map_info);
 	int err;
 
-	err = bpf_obj_get_info_by_fd(attr_map_fd, &map_info, &map_info_len);
+	err = bpf_map_get_info_by_fd(attr_map_fd, &map_info, &map_info_len);
 
 	if (err)
 		return false;
diff --git a/tools/perf/util/bpf_counter.h b/tools/perf/util/bpf_counter.h
index c6d21c07b14c..c071e9444395 100644
--- a/tools/perf/util/bpf_counter.h
+++ b/tools/perf/util/bpf_counter.h
@@ -97,7 +97,7 @@  static inline __u32 bpf_link_get_id(int fd)
 	struct bpf_link_info link_info = { .id = 0, };
 	__u32 link_info_len = sizeof(link_info);
 
-	bpf_obj_get_info_by_fd(fd, &link_info, &link_info_len);
+	bpf_link_get_info_by_fd(fd, &link_info, &link_info_len);
 	return link_info.id;
 }
 
@@ -106,7 +106,7 @@  static inline __u32 bpf_link_get_prog_id(int fd)
 	struct bpf_link_info link_info = { .id = 0, };
 	__u32 link_info_len = sizeof(link_info);
 
-	bpf_obj_get_info_by_fd(fd, &link_info, &link_info_len);
+	bpf_link_get_info_by_fd(fd, &link_info, &link_info_len);
 	return link_info.prog_id;
 }
 
@@ -115,7 +115,7 @@  static inline __u32 bpf_map_get_id(int fd)
 	struct bpf_map_info map_info = { .id = 0, };
 	__u32 map_info_len = sizeof(map_info);
 
-	bpf_obj_get_info_by_fd(fd, &map_info, &map_info_len);
+	bpf_map_get_info_by_fd(fd, &map_info, &map_info_len);
 	return map_info.id;
 }