Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multi-architecture vmlinux.h support #3265

Merged
merged 2 commits into from
Feb 11, 2021

Conversation

anakryiko
Copy link
Contributor

Add support for per-architecture vmlinux.h headers. Add arm64 and powerpc vmlinux.h, generated by @vt-alt in #3252.

Move vmlinux.h header into a per-architecture subdirectory to allow
architecture-specific builds of libbpf-tools.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Add vmlinux.h for arm64 (aarch64) and powerpc (ppc64le) architectures.
Makefile already normalizes aarch64 -> arm64 and ppc64le -> powerpc, so no
adjustments are necessary.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
@vt-alt
Copy link
Contributor

vt-alt commented Feb 9, 2021

This builds successfully on aarch64, ppc64le, and x86_64. Except there is some compilation warning on powerpc:

[00:01:42] biopattern.c:139:4: warning: format specifies type 'long long' but the argument has type 'unsigned long' [-Wformat]
[00:01:42]                         counter.bytes / 1024);
[00:01:42]                         ^~~~~~~~~~~~~~~~~~~~
[00:01:42] drsnoop.c:119:9: warning: format specifies type 'long long' but the argument has type '__u64' (aka 'unsigned long') [-Wformat]
[00:01:42]                e->nr_reclaimed);
[00:01:42]                ^~~~~~~~~~~~~~~
[00:01:42] drsnoop.c:121:20: warning: format specifies type 'unsigned long long' but the argument has type 'unsigned long' [-Wformat]
[00:01:42]                 printf(" %8llu", e->nr_free_pages * page_size / 1024);
[00:01:42]                          ~~~~~   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[00:01:42]                          %8lu
[00:01:42] drsnoop.c:127:51: warning: format specifies type 'unsigned long long' but the argument has type '__u64' (aka 'unsigned long') [-Wformat]
[00:01:42]         fprintf(stderr, "lost %llu events on CPU #%d\n", lost_cnt, cpu);
[00:01:42]                               ~~~~                       ^~~~~~~~
[00:01:42]                               %lu
[00:01:42] numamove.c:109:4: warning: format specifies type 'long long' but the argument has type '__u64' (aka 'unsigned long') [-Wformat]
[00:01:42]                         __atomic_exchange_n(&obj->bss->num, 0,
[00:01:42]                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[00:01:42] numamove.c:111:4: warning: format specifies type 'long long' but the argument has type '__u64' (aka 'unsigned long') [-Wformat]
[00:01:42]                         __atomic_exchange_n(&obj->bss->latency, 0,
[00:01:42]                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[00:01:42] llcstat.c:143:9: warning: format specifies type 'unsigned long long' but the argument has type '__u64' (aka 'unsigned long') [-Wformat]
[00:01:42]                         cpu, info.ref, info.miss, info.ref > 0 ?
[00:01:42]                              ^~~~~~~~
[00:01:42] llcstat.c:143:19: warning: format specifies type 'unsigned long long' but the argument has type '__u64' (aka 'unsigned long') [-Wformat]
[00:01:42]                         cpu, info.ref, info.miss, info.ref > 0 ?
[00:01:42]                                        ^~~~~~~~~
[00:01:42] llcstat.c:151:3: warning: format specifies type 'unsigned long long' but the argument has type '__u64' (aka 'unsigned long') [-Wformat]
[00:01:42]                 total_ref, total_miss, total_ref > 0 ?
[00:01:42]                 ^~~~~~~~~
[00:01:42] llcstat.c:151:14: warning: format specifies type 'unsigned long long' but the argument has type '__u64' (aka 'unsigned long') [-Wformat]
[00:01:42]                 total_ref, total_miss, total_ref > 0 ?
[00:01:42]                            ^~~~~~~~~~
[00:01:42] softirqs.c:150:45: warning: format specifies type 'unsigned long long' but the argument has type '__u64' (aka 'unsigned long') [-Wformat]
[00:01:42]                         printf("%-16s %11llu\n", vec_names[vec], count);
[00:01:42]                                       ~~~~~~                     ^~~~~
[00:01:42]                                       %11lu

etc.

Build log is temporary there: http://git.altlinux.org/tasks/265490/build/300/ppc64le/log

@anakryiko
Copy link
Contributor Author

right, eternal long long vs long problem on different 64-bit architectures. We can fix that separately, it shouldn't affect correctness.

@yonghong-song, please consider pulling

@vt-alt
Copy link
Contributor

vt-alt commented Feb 9, 2021

Would be also great to remove libbpf-tools/bin/bpftool binary from the source. It's x86_64 specific blob.

@anakryiko
Copy link
Contributor Author

Would be also great to remove libbpf-tools/bin/bpftool binary from the source. It's x86_64 specific blob.

Yes, it's necessary for BPF skeleton generation and it's here to make it simpler for users to compile libbpf-tools. We could instead do the same thing we did with vmlinux.h and provide per-architecture binaries, though.

@yonghong-song
Copy link
Collaborator

[buildbot, test this please]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants