2019-05-19 12:07:45 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-only
|
2015-03-01 20:19:44 +00:00
|
|
|
feature_dir := $(srctree)/tools/build/feature
|
2015-03-01 20:12:25 +00:00
|
|
|
|
2015-03-01 20:04:01 +00:00
|
|
|
ifneq ($(OUTPUT),)
|
2015-03-01 20:19:44 +00:00
|
|
|
OUTPUT_FEATURES = $(OUTPUT)feature/
|
2015-03-01 20:04:01 +00:00
|
|
|
$(shell mkdir -p $(OUTPUT_FEATURES))
|
|
|
|
endif
|
|
|
|
|
|
|
|
feature_check = $(eval $(feature_check_code))
|
|
|
|
define feature_check_code
|
2020-08-12 22:15:17 +00:00
|
|
|
feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CC="$(CC)" CXX="$(CXX)" CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" CXXFLAGS="$(EXTRA_CXXFLAGS) $(FEATURE_CHECK_CXXFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" -C $(feature_dir) $(OUTPUT_FEATURES)test-$1.bin >/dev/null 2>/dev/null && echo 1 || echo 0)
|
2015-03-01 20:04:01 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
feature_set = $(eval $(feature_set_code))
|
|
|
|
define feature_set_code
|
|
|
|
feature-$(1) := 1
|
|
|
|
endef
|
|
|
|
|
|
|
|
#
|
|
|
|
# Build the feature check binaries in parallel, ignore errors, ignore return value and suppress output:
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# Note that this is not a complete list of all feature tests, just
|
|
|
|
# those that are typically built on a fully configured system.
|
|
|
|
#
|
|
|
|
# [ Feature tests not mentioned here have to be built explicitly in
|
|
|
|
# the rule that uses them - an example for that is the 'bionic'
|
|
|
|
# feature check. ]
|
|
|
|
#
|
2016-12-04 20:42:53 +00:00
|
|
|
FEATURE_TESTS_BASIC := \
|
|
|
|
backtrace \
|
|
|
|
dwarf \
|
|
|
|
dwarf_getlocations \
|
2023-11-09 23:59:27 +00:00
|
|
|
dwarf_getcfi \
|
2018-11-21 20:42:00 +00:00
|
|
|
eventfd \
|
2016-12-04 20:42:53 +00:00
|
|
|
fortify-source \
|
2018-11-19 19:56:22 +00:00
|
|
|
get_current_dir_name \
|
2019-06-13 15:04:19 +00:00
|
|
|
gettid \
|
2016-12-04 20:42:53 +00:00
|
|
|
glibc \
|
|
|
|
libbfd \
|
2020-09-03 16:44:39 +00:00
|
|
|
libbfd-buildid \
|
2019-08-07 14:44:14 +00:00
|
|
|
libcap \
|
2016-12-04 20:42:53 +00:00
|
|
|
libelf \
|
|
|
|
libelf-getphdrnum \
|
|
|
|
libelf-gelf_getnote \
|
|
|
|
libelf-getshdrstrndx \
|
|
|
|
libnuma \
|
|
|
|
numa_num_possible_cpus \
|
|
|
|
libperl \
|
|
|
|
libpython \
|
|
|
|
libslang \
|
2019-06-18 20:43:35 +00:00
|
|
|
libslang-include-subdir \
|
2021-04-28 09:20:23 +00:00
|
|
|
libtraceevent \
|
2021-09-23 00:10:21 +00:00
|
|
|
libtracefs \
|
2016-12-04 20:42:53 +00:00
|
|
|
libcrypto \
|
|
|
|
libunwind \
|
|
|
|
pthread-attr-setaffinity-np \
|
2017-12-05 13:14:42 +00:00
|
|
|
pthread-barrier \
|
2018-07-14 02:08:59 +00:00
|
|
|
reallocarray \
|
2016-12-04 20:42:53 +00:00
|
|
|
stackprotector-all \
|
|
|
|
timerfd \
|
|
|
|
libdw-dwarf-unwind \
|
|
|
|
zlib \
|
|
|
|
lzma \
|
|
|
|
get_cpuid \
|
|
|
|
bpf \
|
2023-04-04 14:05:57 +00:00
|
|
|
scandirat \
|
2017-03-02 15:55:49 +00:00
|
|
|
sched_getcpu \
|
2017-07-18 20:15:29 +00:00
|
|
|
sdt \
|
2018-01-17 17:52:10 +00:00
|
|
|
setns \
|
2019-03-12 05:30:48 +00:00
|
|
|
libaio \
|
2019-03-18 17:39:49 +00:00
|
|
|
libzstd \
|
2020-04-02 01:52:49 +00:00
|
|
|
disassembler-four-args \
|
2022-08-01 01:38:27 +00:00
|
|
|
disassembler-init-styled \
|
2020-04-02 01:52:49 +00:00
|
|
|
file-handle
|
2015-03-01 20:04:01 +00:00
|
|
|
|
2016-01-25 09:55:50 +00:00
|
|
|
# FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
|
|
|
|
# of all feature tests
|
2016-12-04 20:42:53 +00:00
|
|
|
FEATURE_TESTS_EXTRA := \
|
|
|
|
bionic \
|
|
|
|
compile-32 \
|
|
|
|
compile-x32 \
|
|
|
|
cplus-demangle \
|
2023-03-11 06:57:48 +00:00
|
|
|
cxa-demangle \
|
2020-09-04 20:11:59 +00:00
|
|
|
gtk2 \
|
|
|
|
gtk2-infobar \
|
2016-12-04 20:42:53 +00:00
|
|
|
hello \
|
|
|
|
libbabeltrace \
|
2024-02-17 07:40:42 +00:00
|
|
|
libcapstone \
|
2018-11-16 00:32:01 +00:00
|
|
|
libbfd-liberty \
|
|
|
|
libbfd-liberty-z \
|
2019-02-12 17:37:15 +00:00
|
|
|
libopencsd \
|
2019-02-12 19:34:32 +00:00
|
|
|
libunwind-x86 \
|
|
|
|
libunwind-x86_64 \
|
|
|
|
libunwind-arm \
|
|
|
|
libunwind-aarch64 \
|
2016-12-04 20:42:53 +00:00
|
|
|
libunwind-debug-frame \
|
|
|
|
libunwind-debug-frame-arm \
|
2018-03-07 15:50:18 +00:00
|
|
|
libunwind-debug-frame-aarch64 \
|
|
|
|
cxx \
|
|
|
|
llvm \
|
2019-11-26 12:12:53 +00:00
|
|
|
clang \
|
2020-04-29 23:14:41 +00:00
|
|
|
libbpf \
|
perf build: Fix check for btf__load_from_kernel_by_id() in libbpf
Avi Kivity reported a problem where the __weak
btf__load_from_kernel_by_id() in tools/perf/util/bpf-event.c was being
used and it called btf__get_from_id() in tools/lib/bpf/btf.c that in
turn called back to btf__load_from_kernel_by_id(), resulting in an
endless loop.
Fix this by adding a feature test to check if
btf__load_from_kernel_by_id() is available when building perf with
LIBBPF_DYNAMIC=1, and if not then provide the fallback to the old
btf__get_from_id(), that doesn't call back to btf__load_from_kernel_by_id()
since at that time it didn't exist at all.
Tested on Fedora 35 where we have libbpf-devel 0.4.0 with LIBBPF_DYNAMIC
where we don't have btf__load_from_kernel_by_id() and thus its feature
test fail, not defining HAVE_LIBBPF_BTF__LOAD_FROM_KERNEL_BY_ID:
$ cat /tmp/build/perf-urgent/feature/test-libbpf-btf__load_from_kernel_by_id.make.output
test-libbpf-btf__load_from_kernel_by_id.c: In function ‘main’:
test-libbpf-btf__load_from_kernel_by_id.c:6:16: error: implicit declaration of function ‘btf__load_from_kernel_by_id’ [-Werror=implicit-function-declaration]
6 | return btf__load_from_kernel_by_id(20151128, NULL);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
$
$ nm /tmp/build/perf-urgent/perf | grep btf__load_from_kernel_by_id
00000000005ba180 T btf__load_from_kernel_by_id
$
$ objdump --disassemble=btf__load_from_kernel_by_id -S /tmp/build/perf-urgent/perf
/tmp/build/perf-urgent/perf: file format elf64-x86-64
<SNIP>
00000000005ba180 <btf__load_from_kernel_by_id>:
#include "record.h"
#include "util/synthetic-events.h"
#ifndef HAVE_LIBBPF_BTF__LOAD_FROM_KERNEL_BY_ID
struct btf *btf__load_from_kernel_by_id(__u32 id)
{
5ba180: 55 push %rbp
5ba181: 48 89 e5 mov %rsp,%rbp
5ba184: 48 83 ec 10 sub $0x10,%rsp
5ba188: 64 48 8b 04 25 28 00 mov %fs:0x28,%rax
5ba18f: 00 00
5ba191: 48 89 45 f8 mov %rax,-0x8(%rbp)
5ba195: 31 c0 xor %eax,%eax
struct btf *btf;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
int err = btf__get_from_id(id, &btf);
5ba197: 48 8d 75 f0 lea -0x10(%rbp),%rsi
5ba19b: e8 a0 57 e5 ff call 40f940 <btf__get_from_id@plt>
5ba1a0: 89 c2 mov %eax,%edx
#pragma GCC diagnostic pop
return err ? ERR_PTR(err) : btf;
5ba1a2: 48 98 cltq
5ba1a4: 85 d2 test %edx,%edx
5ba1a6: 48 0f 44 45 f0 cmove -0x10(%rbp),%rax
}
<SNIP>
Fixes: 218e7b775d368f38 ("perf bpf: Provide a weak btf__load_from_kernel_by_id() for older libbpf versions")
Reported-by: Avi Kivity <avi@scylladb.com>
Link: https://lore.kernel.org/linux-perf-users/f0add43b-3de5-20c5-22c4-70aff4af959f@scylladb.com
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/linux-perf-users/YobjjFOblY4Xvwo7@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-05-20 00:25:12 +00:00
|
|
|
libbpf-btf__load_from_kernel_by_id \
|
perf build: Stop using __weak bpf_prog_load() to handle older libbpf versions
By adding a feature test for bpf_prog_load() and providing a fallback if
it isn't present in older versions of libbpf.
Committer testing:
$ rpm -q libbpf-devel
libbpf-devel-0.4.0-2.fc35.x86_64
$ make -C tools/perf LIBBPF_DYNAMIC=1 O=/tmp/build/perf install-bin
$ cat /tmp/build/perf/feature/test-libbpf-bpf_prog_load.make.output
test-libbpf-bpf_prog_load.c: In function ‘main’:
test-libbpf-bpf_prog_load.c:6:16: error: implicit declaration of function ‘bpf_prog_load’ [-Werror=implicit-function-declaration]
6 | return bpf_prog_load(0 /* prog_type */, NULL /* prog_name */,
| ^~~~~~~~~~~~~
cc1: all warnings being treated as errors
$
$ objdump -dS /tmp/build/perf/perf | grep '<bpf_prog_load>:' -A20
00000000005b2d70 <bpf_prog_load>:
{
5b2d70: 55 push %rbp
5b2d71: 48 89 ce mov %rcx,%rsi
5b2d74: 4c 89 c8 mov %r9,%rax
5b2d77: 49 89 d2 mov %rdx,%r10
5b2d7a: 4c 89 c2 mov %r8,%rdx
5b2d7d: 48 89 e5 mov %rsp,%rbp
5b2d80: 48 83 ec 18 sub $0x18,%rsp
5b2d84: 64 48 8b 0c 25 28 00 mov %fs:0x28,%rcx
5b2d8b: 00 00
5b2d8d: 48 89 4d f8 mov %rcx,-0x8(%rbp)
5b2d91: 31 c9 xor %ecx,%ecx
return bpf_load_program(prog_type, insns, insn_cnt, license,
5b2d93: 41 8b 49 5c mov 0x5c(%r9),%ecx
5b2d97: 51 push %rcx
5b2d98: 4d 8b 49 60 mov 0x60(%r9),%r9
5b2d9c: 4c 89 d1 mov %r10,%rcx
5b2d9f: 44 8b 40 1c mov 0x1c(%rax),%r8d
5b2da3: e8 f8 aa e5 ff call 40d8a0 <bpf_load_program@plt>
}
$
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Link: http://lore.kernel.org/linux-perf-users/YozLKby7ITEtchC9@krava
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-05-24 11:04:43 +00:00
|
|
|
libbpf-bpf_prog_load \
|
perf build: Stop using __weak bpf_object__next_program() to handle older libbpf versions
By adding a feature test for bpf_object__next_program() and providing a fallback if
it isn't present in older versions of libbpf.
Committer testing:
$ rpm -q libbpf-devel
libbpf-devel-0.4.0-2.fc35.x86_64
$ make -C tools/perf LIBBPF_DYNAMIC=1 O=/tmp/build/perf install-bin
$ cat /tmp/build/perf/feature/test-libbpf-bpf_object__next_program.make.output
test-libbpf-bpf_object__next_program.c: In function ‘main’:
test-libbpf-bpf_object__next_program.c:6:9: error: implicit declaration of function ‘bpf_object__next_program’; did you mean ‘bpf_object__unpin_programs’? [-Werror=implicit-function-declaration]
6 | bpf_object__next_program(NULL /* obj */, NULL /* prev */);
| ^~~~~~~~~~~~~~~~~~~~~~~~
| bpf_object__unpin_programs
cc1: all warnings being treated as errors
$
$ objdump -dS /tmp/build/perf/perf | grep '<bpf_object__next_program>:' -A20
00000000005b2dc0 <bpf_object__next_program>:
{
5b2dc0: 55 push %rbp
5b2dc1: 48 89 e5 mov %rsp,%rbp
5b2dc4: 48 83 ec 10 sub $0x10,%rsp
5b2dc8: 64 48 8b 04 25 28 00 mov %fs:0x28,%rax
5b2dcf: 00 00
5b2dd1: 48 89 45 f8 mov %rax,-0x8(%rbp)
5b2dd5: 31 c0 xor %eax,%eax
return bpf_program__next(prev, obj);
5b2dd7: 48 8b 45 f8 mov -0x8(%rbp),%rax
5b2ddb: 64 48 2b 04 25 28 00 sub %fs:0x28,%rax
5b2de2: 00 00
5b2de4: 75 0f jne 5b2df5 <bpf_object__next_program+0x35>
}
5b2de6: c9 leave
5b2de7: 49 89 f8 mov %rdi,%r8
5b2dea: 48 89 f7 mov %rsi,%rdi
return bpf_program__next(prev, obj);
5b2ded: 4c 89 c6 mov %r8,%rsi
5b2df0: e9 3b b4 e5 ff jmp 40e230 <bpf_program__next@plt>
$
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Link: http://lore.kernel.org/linux-perf-users/YozLKby7ITEtchC9@krava
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-05-24 11:09:42 +00:00
|
|
|
libbpf-bpf_object__next_program \
|
perf build: Stop using __weak bpf_object__next_map() to handle older libbpf versions
By adding a feature test for bpf_object__next_map() and providing a fallback if
it isn't present in older versions of libbpf.
Committer testing:
$ rpm -q libbpf-devel
libbpf-devel-0.4.0-2.fc35.x86_64
$ make -C tools/perf LIBBPF_DYNAMIC=1 O=/tmp/build/perf install-bin
$ cat /tmp/build/perf/feature/test-libbpf-bpf_object__next_map.make.output
test-libbpf-bpf_object__next_map.c: In function ‘main’:
test-libbpf-bpf_object__next_map.c:6:9: error: implicit declaration of function ‘bpf_object__next_map’; did you mean ‘bpf_object__next’? [-Werror=implicit-function-declaration]
6 | bpf_object__next_map(NULL /* obj */, NULL /* prev */);
| ^~~~~~~~~~~~~~~~~~~~
| bpf_object__next
cc1: all warnings being treated as errors
$
$ objdump -dS /tmp/build/perf/perf | grep '<bpf_object__next_map>:' -A20
00000000005b2e00 <bpf_object__next_map>:
{
5b2e00: 55 push %rbp
5b2e01: 48 89 e5 mov %rsp,%rbp
5b2e04: 48 83 ec 10 sub $0x10,%rsp
5b2e08: 64 48 8b 04 25 28 00 mov %fs:0x28,%rax
5b2e0f: 00 00
5b2e11: 48 89 45 f8 mov %rax,-0x8(%rbp)
5b2e15: 31 c0 xor %eax,%eax
return bpf_map__next(prev, obj);
5b2e17: 48 8b 45 f8 mov -0x8(%rbp),%rax
5b2e1b: 64 48 2b 04 25 28 00 sub %fs:0x28,%rax
5b2e22: 00 00
5b2e24: 75 0f jne 5b2e35 <bpf_object__next_map+0x35>
}
5b2e26: c9 leave
5b2e27: 49 89 f8 mov %rdi,%r8
5b2e2a: 48 89 f7 mov %rsi,%rdi
return bpf_map__next(prev, obj);
5b2e2d: 4c 89 c6 mov %r8,%rsi
5b2e30: e9 cb b1 e5 ff jmp 40e000 <bpf_map__next@plt>
$
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Link: http://lore.kernel.org/linux-perf-users/YozLKby7ITEtchC9@krava
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-05-24 11:13:17 +00:00
|
|
|
libbpf-bpf_object__next_map \
|
2022-10-19 12:44:17 +00:00
|
|
|
libbpf-bpf_program__set_insns \
|
perf build: Stop using __weak bpf_map_create() to handle older libbpf versions
By adding a feature test for bpf_map_create() and providing a fallback if
it isn't present in older versions of libbpf.
This also fixes the build with torvalds/master at this point:
$ git log --oneline -5 torvalds/master
babf0bb978e3c9fc (torvalds/master) Merge tag 'xfs-5.19-for-linus' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
e375780b631a5fc2 Merge tag 'fsnotify_for_v5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
8b728edc5be16179 Merge tag 'fs_for_v5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
3f306ea2e18568f6 Merge tag 'dma-mapping-5.19-2022-05-25' of git://git.infradead.org/users/hch/dma-mapping
fbe86daca0ba878b Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
$
Coping with:
$ git log --oneline -2 d16495a982324f75
d16495a982324f75 libbpf: remove bpf_create_map*() APIs
e2371b1632b1c61c libbpf: start 1.0 development cycle
$
As the __weak function fails to build as it calls the now removed
bpf_create_map() API.
Testing:
$ rpm -q libbpf-devel
libbpf-devel-0.4.0-2.fc35.x86_64
$
$ make -C tools/perf BUILD_BPF_SKEL=1 LIBBPF_DYNAMIC=1 O=/tmp/build/perf install-bin
$ cat /tmp/build/perf/feature/test-libbpf-bpf_map_create.make.output
test-libbpf-bpf_map_create.c: In function ‘main’:
test-libbpf-bpf_map_create.c:6:16: error: implicit declaration of function ‘bpf_map_create’; did you mean ‘bpf_map_freeze’? [-Werror=implicit-function-declaration]
6 | return bpf_map_create(0 /* map_type */, NULL /* map_name */, 0, /* key_size */,
| ^~~~~~~~~~~~~~
| bpf_map_freeze
test-libbpf-bpf_map_create.c:6:87: error: expected expression before ‘,’ token
6 | return bpf_map_create(0 /* map_type */, NULL /* map_name */, 0, /* key_size */,
| ^
cc1: all warnings being treated as errors
$
$ objdump -dS /tmp/build/perf/perf | grep '<bpf_map_create>:' -A20
000000000058b290 <bpf_map_create>:
{
58b290: 55 push %rbp
58b291: 48 89 e5 mov %rsp,%rbp
58b294: 48 83 ec 10 sub $0x10,%rsp
58b298: 64 48 8b 04 25 28 00 mov %fs:0x28,%rax
58b29f: 00 00
58b2a1: 48 89 45 f8 mov %rax,-0x8(%rbp)
58b2a5: 31 c0 xor %eax,%eax
return bpf_create_map(map_type, key_size, value_size, max_entries, 0);
58b2a7: 48 8b 45 f8 mov -0x8(%rbp),%rax
58b2ab: 64 48 2b 04 25 28 00 sub %fs:0x28,%rax
58b2b2: 00 00
58b2b4: 75 10 jne 58b2c6 <bpf_map_create+0x36>
}
58b2b6: c9 leave
58b2b7: 89 d6 mov %edx,%esi
58b2b9: 89 ca mov %ecx,%edx
58b2bb: 44 89 c1 mov %r8d,%ecx
return bpf_create_map(map_type, key_size, value_size, max_entries, 0);
58b2be: 45 31 c0 xor %r8d,%r8d
$
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Song Liu <songliubraving@fb.com>
Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Link: http://lore.kernel.org/linux-perf-users/Yo+XvQNKL4K5khl2@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-05-26 14:48:58 +00:00
|
|
|
libbpf-bpf_create_map \
|
2020-08-13 08:22:04 +00:00
|
|
|
libpfm4 \
|
2020-12-29 21:42:13 +00:00
|
|
|
libdebuginfod \
|
|
|
|
clang-bpf-co-re
|
|
|
|
|
2016-01-25 09:55:50 +00:00
|
|
|
|
|
|
|
FEATURE_TESTS ?= $(FEATURE_TESTS_BASIC)
|
|
|
|
|
|
|
|
ifeq ($(FEATURE_TESTS),all)
|
|
|
|
FEATURE_TESTS := $(FEATURE_TESTS_BASIC) $(FEATURE_TESTS_EXTRA)
|
|
|
|
endif
|
|
|
|
|
2016-12-04 20:42:53 +00:00
|
|
|
FEATURE_DISPLAY ?= \
|
|
|
|
dwarf \
|
|
|
|
dwarf_getlocations \
|
|
|
|
glibc \
|
|
|
|
libbfd \
|
2020-09-03 16:44:39 +00:00
|
|
|
libbfd-buildid \
|
2019-08-07 14:44:14 +00:00
|
|
|
libcap \
|
2016-12-04 20:42:53 +00:00
|
|
|
libelf \
|
|
|
|
libnuma \
|
|
|
|
numa_num_possible_cpus \
|
|
|
|
libperl \
|
|
|
|
libpython \
|
|
|
|
libcrypto \
|
|
|
|
libunwind \
|
|
|
|
libdw-dwarf-unwind \
|
2024-02-17 07:40:42 +00:00
|
|
|
libcapstone \
|
2024-09-10 14:04:00 +00:00
|
|
|
llvm-perf \
|
2016-12-04 20:42:53 +00:00
|
|
|
zlib \
|
|
|
|
lzma \
|
|
|
|
get_cpuid \
|
2018-11-06 09:03:35 +00:00
|
|
|
bpf \
|
2019-03-12 05:30:48 +00:00
|
|
|
libaio \
|
2022-08-01 01:38:28 +00:00
|
|
|
libzstd
|
2015-03-01 20:04:01 +00:00
|
|
|
|
tools build: Display logical OR of a feature flavors
Sometimes, features are simply different flavors of another feature, to
properly detect the exact dependencies needed by different Linux
distributions.
For example, libbfd has three flavors: libbfd if the distro does not
require any additional dependency; libbfd-liberty if it requires libiberty;
libbfd-liberty-z if it requires libiberty and libz.
It might not be clear to the user whether a feature has been successfully
detected or not, given that some of its flavors will be set to OFF, others
to ON.
Instead, display only the feature main flavor if not in verbose mode
(VF != 1), and set it to ON if at least one of its flavors has been
successfully detected (logical OR), OFF otherwise. Omit the other flavors.
Accomplish that by declaring a FEATURE_GROUP_MEMBERS-<feature main flavor>
variable, with the list of the other flavors as variable value. For now, do
it just for libbfd.
In verbose mode, of if no group is defined for a feature, show the feature
detection result as before.
Committer testing:
Collecting the output from:
$ make -C tools/bpf/bpftool/ clean
$ make -C tools/bpf/bpftool/ |& grep "Auto-detecting system features" -A10
$ diff -u before after
--- before 2022-08-18 10:06:40.422086966 -0300
+++ after 2022-08-18 10:07:59.202138282 -0300
@@ -1,6 +1,4 @@
Auto-detecting system features:
... libbfd: [ on ]
-... libbfd-liberty: [ on ]
-... libbfd-liberty-z: [ on ]
... libcap: [ on ]
... clang-bpf-co-re: [ on ]
$
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Quentin Monnet <quentin@isovalent.com>
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20220818120957.319995-3-roberto.sassu@huaweicloud.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-08-18 12:09:57 +00:00
|
|
|
#
|
|
|
|
# Declare group members of a feature to display the logical OR of the detection
|
|
|
|
# result instead of each member result.
|
|
|
|
#
|
|
|
|
FEATURE_GROUP_MEMBERS-libbfd = libbfd-liberty libbfd-liberty-z
|
|
|
|
|
2024-07-17 17:47:36 +00:00
|
|
|
#
|
|
|
|
# Declare list of feature dependency packages that provide pkg-config files.
|
|
|
|
#
|
|
|
|
FEATURE_PKG_CONFIG ?= \
|
|
|
|
libtraceevent \
|
|
|
|
libtracefs
|
|
|
|
|
|
|
|
feature_pkg_config = $(eval $(feature_pkg_config_code))
|
|
|
|
define feature_pkg_config_code
|
|
|
|
FEATURE_CHECK_CFLAGS-$(1) := $(shell $(PKG_CONFIG) --cflags $(1) 2>/dev/null)
|
|
|
|
FEATURE_CHECK_LDFLAGS-$(1) := $(shell $(PKG_CONFIG) --libs $(1) 2>/dev/null)
|
|
|
|
endef
|
|
|
|
|
|
|
|
# Set FEATURE_CHECK_(C|LD)FLAGS-$(package) for packages using pkg-config.
|
|
|
|
ifneq ($(PKG_CONFIG),)
|
|
|
|
$(foreach package,$(FEATURE_PKG_CONFIG),$(call feature_pkg_config,$(package)))
|
|
|
|
endif
|
|
|
|
|
2015-03-01 20:04:01 +00:00
|
|
|
# Set FEATURE_CHECK_(C|LD)FLAGS-all for all FEATURE_TESTS features.
|
|
|
|
# If in the future we need per-feature checks/flags for features not
|
|
|
|
# mentioned in this list we need to refactor this ;-).
|
|
|
|
set_test_all_flags = $(eval $(set_test_all_flags_code))
|
|
|
|
define set_test_all_flags_code
|
|
|
|
FEATURE_CHECK_CFLAGS-all += $(FEATURE_CHECK_CFLAGS-$(1))
|
|
|
|
FEATURE_CHECK_LDFLAGS-all += $(FEATURE_CHECK_LDFLAGS-$(1))
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach feat,$(FEATURE_TESTS),$(call set_test_all_flags,$(feat)))
|
|
|
|
|
|
|
|
#
|
|
|
|
# Special fast-path for the 'all features are available' case:
|
|
|
|
#
|
|
|
|
$(call feature_check,all,$(MSG))
|
|
|
|
|
|
|
|
#
|
|
|
|
# Just in case the build freshly failed, make sure we print the
|
|
|
|
# feature matrix:
|
|
|
|
#
|
|
|
|
ifeq ($(feature-all), 1)
|
|
|
|
#
|
|
|
|
# test-all.c passed - just set all the core feature flags to 1:
|
|
|
|
#
|
|
|
|
$(foreach feat,$(FEATURE_TESTS),$(call feature_set,$(feat)))
|
2016-01-28 19:13:24 +00:00
|
|
|
#
|
|
|
|
# test-all.c does not comprise these tests, so we need to
|
|
|
|
# for this case to get features proper values
|
|
|
|
#
|
|
|
|
$(call feature_check,compile-32)
|
|
|
|
$(call feature_check,compile-x32)
|
|
|
|
$(call feature_check,bionic)
|
|
|
|
$(call feature_check,libbabeltrace)
|
2015-03-01 20:04:01 +00:00
|
|
|
else
|
|
|
|
$(foreach feat,$(FEATURE_TESTS),$(call feature_check,$(feat)))
|
|
|
|
endif
|
|
|
|
|
|
|
|
#
|
|
|
|
# Print the result of the feature test:
|
|
|
|
#
|
tools build: Fix feature detection output due to eval expansion
As the first eval expansion is used only to generate Makefile statements,
messages should not be displayed at this stage, as for example conditional
expressions are not evaluated.
It can be seen for example in the output of feature detection for bpftool,
where the number of detected features does not change, despite turning on
the verbose mode (VF = 1) and there are additional features to display.
Fix this issue by escaping the $ before $(info) statements, to ensure that
messages are printed only when the function containing them is actually
executed, and not when it is expanded.
In addition, move the $(info) statement out of feature_print_status, due to
the fact that is called both inside and outside an eval context, and place
it to the caller so that the $ can be escaped when necessary. For symmetry,
move the $(info) statement also out of feature_print_text, and place it to
the caller.
Force the TMP variable evaluation in verbose mode, to display the features
in FEATURE_TESTS that are not in FEATURE_DISPLAY.
Reorder perf feature detection messages (first non-verbose, then verbose
ones) by moving the call to feature_display_entries earlier, before the VF
environment variable check.
Also, remove the newline from that function, as perf might display
additional messages. Move the newline to perf Makefile, and display another
one if displaying the detection result is not deferred as in the case of
bpftool.
Committer testing:
Collecting the output from:
$ make VF=1 -C tools/bpf/bpftool/ |& grep "Auto-detecting system features" -A20
$ diff -u before after
--- before 2022-08-18 09:59:55.460529231 -0300
+++ after 2022-08-18 10:01:11.182517282 -0300
@@ -4,3 +4,5 @@
... libbfd-liberty-z: [ on ]
... libcap: [ on ]
... clang-bpf-co-re: [ on ]
+... disassembler-four-args: [ on ]
+... disassembler-init-styled: [ OFF ]
$
Fixes: 0afc5cad387db560 ("perf build: Separate feature make support into config/Makefile.feature")
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: bpf@vger.kernel.org
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Quentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/r/20220818120957.319995-1-roberto.sassu@huaweicloud.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-08-18 12:09:55 +00:00
|
|
|
feature_print_status = $(eval $(feature_print_status_code))
|
2015-03-01 20:04:01 +00:00
|
|
|
|
tools build: Display logical OR of a feature flavors
Sometimes, features are simply different flavors of another feature, to
properly detect the exact dependencies needed by different Linux
distributions.
For example, libbfd has three flavors: libbfd if the distro does not
require any additional dependency; libbfd-liberty if it requires libiberty;
libbfd-liberty-z if it requires libiberty and libz.
It might not be clear to the user whether a feature has been successfully
detected or not, given that some of its flavors will be set to OFF, others
to ON.
Instead, display only the feature main flavor if not in verbose mode
(VF != 1), and set it to ON if at least one of its flavors has been
successfully detected (logical OR), OFF otherwise. Omit the other flavors.
Accomplish that by declaring a FEATURE_GROUP_MEMBERS-<feature main flavor>
variable, with the list of the other flavors as variable value. For now, do
it just for libbfd.
In verbose mode, of if no group is defined for a feature, show the feature
detection result as before.
Committer testing:
Collecting the output from:
$ make -C tools/bpf/bpftool/ clean
$ make -C tools/bpf/bpftool/ |& grep "Auto-detecting system features" -A10
$ diff -u before after
--- before 2022-08-18 10:06:40.422086966 -0300
+++ after 2022-08-18 10:07:59.202138282 -0300
@@ -1,6 +1,4 @@
Auto-detecting system features:
... libbfd: [ on ]
-... libbfd-liberty: [ on ]
-... libbfd-liberty-z: [ on ]
... libcap: [ on ]
... clang-bpf-co-re: [ on ]
$
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Quentin Monnet <quentin@isovalent.com>
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20220818120957.319995-3-roberto.sassu@huaweicloud.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-08-18 12:09:57 +00:00
|
|
|
feature_group = $(eval $(feature_gen_group)) $(GROUP)
|
|
|
|
|
|
|
|
define feature_gen_group
|
|
|
|
GROUP := $(1)
|
|
|
|
ifneq ($(feature_verbose),1)
|
|
|
|
GROUP += $(FEATURE_GROUP_MEMBERS-$(1))
|
|
|
|
endif
|
|
|
|
endef
|
|
|
|
|
2015-03-01 20:04:01 +00:00
|
|
|
define feature_print_status_code
|
tools build: Display logical OR of a feature flavors
Sometimes, features are simply different flavors of another feature, to
properly detect the exact dependencies needed by different Linux
distributions.
For example, libbfd has three flavors: libbfd if the distro does not
require any additional dependency; libbfd-liberty if it requires libiberty;
libbfd-liberty-z if it requires libiberty and libz.
It might not be clear to the user whether a feature has been successfully
detected or not, given that some of its flavors will be set to OFF, others
to ON.
Instead, display only the feature main flavor if not in verbose mode
(VF != 1), and set it to ON if at least one of its flavors has been
successfully detected (logical OR), OFF otherwise. Omit the other flavors.
Accomplish that by declaring a FEATURE_GROUP_MEMBERS-<feature main flavor>
variable, with the list of the other flavors as variable value. For now, do
it just for libbfd.
In verbose mode, of if no group is defined for a feature, show the feature
detection result as before.
Committer testing:
Collecting the output from:
$ make -C tools/bpf/bpftool/ clean
$ make -C tools/bpf/bpftool/ |& grep "Auto-detecting system features" -A10
$ diff -u before after
--- before 2022-08-18 10:06:40.422086966 -0300
+++ after 2022-08-18 10:07:59.202138282 -0300
@@ -1,6 +1,4 @@
Auto-detecting system features:
... libbfd: [ on ]
-... libbfd-liberty: [ on ]
-... libbfd-liberty-z: [ on ]
... libcap: [ on ]
... clang-bpf-co-re: [ on ]
$
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Quentin Monnet <quentin@isovalent.com>
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20220818120957.319995-3-roberto.sassu@huaweicloud.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-08-18 12:09:57 +00:00
|
|
|
ifneq (,$(filter 1,$(foreach feat,$(call feature_group,$(feat)),$(feature-$(feat)))))
|
2022-08-18 12:09:56 +00:00
|
|
|
MSG = $(shell printf '...%40s: [ \033[32mon\033[m ]' $(1))
|
2015-03-01 20:04:01 +00:00
|
|
|
else
|
2022-08-18 12:09:56 +00:00
|
|
|
MSG = $(shell printf '...%40s: [ \033[31mOFF\033[m ]' $(1))
|
2015-03-01 20:04:01 +00:00
|
|
|
endif
|
|
|
|
endef
|
|
|
|
|
tools build: Fix feature detection output due to eval expansion
As the first eval expansion is used only to generate Makefile statements,
messages should not be displayed at this stage, as for example conditional
expressions are not evaluated.
It can be seen for example in the output of feature detection for bpftool,
where the number of detected features does not change, despite turning on
the verbose mode (VF = 1) and there are additional features to display.
Fix this issue by escaping the $ before $(info) statements, to ensure that
messages are printed only when the function containing them is actually
executed, and not when it is expanded.
In addition, move the $(info) statement out of feature_print_status, due to
the fact that is called both inside and outside an eval context, and place
it to the caller so that the $ can be escaped when necessary. For symmetry,
move the $(info) statement also out of feature_print_text, and place it to
the caller.
Force the TMP variable evaluation in verbose mode, to display the features
in FEATURE_TESTS that are not in FEATURE_DISPLAY.
Reorder perf feature detection messages (first non-verbose, then verbose
ones) by moving the call to feature_display_entries earlier, before the VF
environment variable check.
Also, remove the newline from that function, as perf might display
additional messages. Move the newline to perf Makefile, and display another
one if displaying the detection result is not deferred as in the case of
bpftool.
Committer testing:
Collecting the output from:
$ make VF=1 -C tools/bpf/bpftool/ |& grep "Auto-detecting system features" -A20
$ diff -u before after
--- before 2022-08-18 09:59:55.460529231 -0300
+++ after 2022-08-18 10:01:11.182517282 -0300
@@ -4,3 +4,5 @@
... libbfd-liberty-z: [ on ]
... libcap: [ on ]
... clang-bpf-co-re: [ on ]
+... disassembler-four-args: [ on ]
+... disassembler-init-styled: [ OFF ]
$
Fixes: 0afc5cad387db560 ("perf build: Separate feature make support into config/Makefile.feature")
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: bpf@vger.kernel.org
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Quentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/r/20220818120957.319995-1-roberto.sassu@huaweicloud.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-08-18 12:09:55 +00:00
|
|
|
feature_print_text = $(eval $(feature_print_text_code))
|
2015-03-01 20:04:01 +00:00
|
|
|
define feature_print_text_code
|
2022-08-18 12:09:56 +00:00
|
|
|
MSG = $(shell printf '...%40s: %s' $(1) $(2))
|
2015-03-01 20:04:01 +00:00
|
|
|
endef
|
|
|
|
|
2015-12-23 17:58:32 +00:00
|
|
|
#
|
|
|
|
# generates feature value assignment for name, like:
|
|
|
|
# $(call feature_assign,dwarf) == feature-dwarf=1
|
|
|
|
#
|
|
|
|
feature_assign = feature-$(1)=$(feature-$(1))
|
|
|
|
|
2015-09-21 15:24:47 +00:00
|
|
|
FEATURE_DUMP_FILENAME = $(OUTPUT)FEATURE-DUMP$(FEATURE_USER)
|
2015-12-23 17:58:33 +00:00
|
|
|
FEATURE_DUMP := $(shell touch $(FEATURE_DUMP_FILENAME); cat $(FEATURE_DUMP_FILENAME))
|
|
|
|
|
|
|
|
feature_dump_check = $(eval $(feature_dump_check_code))
|
|
|
|
define feature_dump_check_code
|
|
|
|
ifeq ($(findstring $(1),$(FEATURE_DUMP)),)
|
|
|
|
$(2) := 1
|
|
|
|
endif
|
|
|
|
endef
|
|
|
|
|
|
|
|
#
|
|
|
|
# First check if any test from FEATURE_DISPLAY
|
|
|
|
# and set feature_display := 1 if it does
|
|
|
|
$(foreach feat,$(FEATURE_DISPLAY),$(call feature_dump_check,$(call feature_assign,$(feat)),feature_display))
|
|
|
|
|
|
|
|
#
|
|
|
|
# Now also check if any other test changed,
|
|
|
|
# so we force FEATURE-DUMP generation
|
|
|
|
$(foreach feat,$(FEATURE_TESTS),$(call feature_dump_check,$(call feature_assign,$(feat)),feature_dump_changed))
|
2015-03-01 20:04:01 +00:00
|
|
|
|
|
|
|
# The $(feature_display) controls the default detection message
|
|
|
|
# output. It's set if:
|
|
|
|
# - detected features differes from stored features from
|
2015-09-21 15:24:47 +00:00
|
|
|
# last build (in $(FEATURE_DUMP_FILENAME) file)
|
2015-03-01 20:04:01 +00:00
|
|
|
# - one of the $(FEATURE_DISPLAY) is not detected
|
|
|
|
# - VF is enabled
|
|
|
|
|
2015-12-23 17:58:33 +00:00
|
|
|
ifeq ($(feature_dump_changed),1)
|
|
|
|
$(shell rm -f $(FEATURE_DUMP_FILENAME))
|
|
|
|
$(foreach feat,$(FEATURE_TESTS),$(shell echo "$(call feature_assign,$(feat))" >> $(FEATURE_DUMP_FILENAME)))
|
2015-03-01 20:04:01 +00:00
|
|
|
endif
|
|
|
|
|
2015-09-21 14:49:51 +00:00
|
|
|
feature_display_check = $(eval $(feature_check_display_code))
|
2015-12-23 17:58:30 +00:00
|
|
|
define feature_check_display_code
|
2015-03-01 20:04:01 +00:00
|
|
|
ifneq ($(feature-$(1)), 1)
|
|
|
|
feature_display := 1
|
|
|
|
endif
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach feat,$(FEATURE_DISPLAY),$(call feature_display_check,$(feat)))
|
|
|
|
|
|
|
|
ifeq ($(VF),1)
|
|
|
|
feature_display := 1
|
|
|
|
feature_verbose := 1
|
|
|
|
endif
|
|
|
|
|
tools build: Display logical OR of a feature flavors
Sometimes, features are simply different flavors of another feature, to
properly detect the exact dependencies needed by different Linux
distributions.
For example, libbfd has three flavors: libbfd if the distro does not
require any additional dependency; libbfd-liberty if it requires libiberty;
libbfd-liberty-z if it requires libiberty and libz.
It might not be clear to the user whether a feature has been successfully
detected or not, given that some of its flavors will be set to OFF, others
to ON.
Instead, display only the feature main flavor if not in verbose mode
(VF != 1), and set it to ON if at least one of its flavors has been
successfully detected (logical OR), OFF otherwise. Omit the other flavors.
Accomplish that by declaring a FEATURE_GROUP_MEMBERS-<feature main flavor>
variable, with the list of the other flavors as variable value. For now, do
it just for libbfd.
In verbose mode, of if no group is defined for a feature, show the feature
detection result as before.
Committer testing:
Collecting the output from:
$ make -C tools/bpf/bpftool/ clean
$ make -C tools/bpf/bpftool/ |& grep "Auto-detecting system features" -A10
$ diff -u before after
--- before 2022-08-18 10:06:40.422086966 -0300
+++ after 2022-08-18 10:07:59.202138282 -0300
@@ -1,6 +1,4 @@
Auto-detecting system features:
... libbfd: [ on ]
-... libbfd-liberty: [ on ]
-... libbfd-liberty-z: [ on ]
... libcap: [ on ]
... clang-bpf-co-re: [ on ]
$
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Quentin Monnet <quentin@isovalent.com>
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20220818120957.319995-3-roberto.sassu@huaweicloud.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-08-18 12:09:57 +00:00
|
|
|
ifneq ($(feature_verbose),1)
|
|
|
|
#
|
|
|
|
# Determine the features to omit from the displayed message, as only the
|
|
|
|
# logical OR of the detection result will be shown.
|
|
|
|
#
|
|
|
|
FEATURE_OMIT := $(foreach feat,$(FEATURE_DISPLAY),$(FEATURE_GROUP_MEMBERS-$(feat)))
|
|
|
|
endif
|
|
|
|
|
2021-04-26 20:01:24 +00:00
|
|
|
feature_display_entries = $(eval $(feature_display_entries_code))
|
|
|
|
define feature_display_entries_code
|
|
|
|
ifeq ($(feature_display),1)
|
tools build: Fix feature detection output due to eval expansion
As the first eval expansion is used only to generate Makefile statements,
messages should not be displayed at this stage, as for example conditional
expressions are not evaluated.
It can be seen for example in the output of feature detection for bpftool,
where the number of detected features does not change, despite turning on
the verbose mode (VF = 1) and there are additional features to display.
Fix this issue by escaping the $ before $(info) statements, to ensure that
messages are printed only when the function containing them is actually
executed, and not when it is expanded.
In addition, move the $(info) statement out of feature_print_status, due to
the fact that is called both inside and outside an eval context, and place
it to the caller so that the $ can be escaped when necessary. For symmetry,
move the $(info) statement also out of feature_print_text, and place it to
the caller.
Force the TMP variable evaluation in verbose mode, to display the features
in FEATURE_TESTS that are not in FEATURE_DISPLAY.
Reorder perf feature detection messages (first non-verbose, then verbose
ones) by moving the call to feature_display_entries earlier, before the VF
environment variable check.
Also, remove the newline from that function, as perf might display
additional messages. Move the newline to perf Makefile, and display another
one if displaying the detection result is not deferred as in the case of
bpftool.
Committer testing:
Collecting the output from:
$ make VF=1 -C tools/bpf/bpftool/ |& grep "Auto-detecting system features" -A20
$ diff -u before after
--- before 2022-08-18 09:59:55.460529231 -0300
+++ after 2022-08-18 10:01:11.182517282 -0300
@@ -4,3 +4,5 @@
... libbfd-liberty-z: [ on ]
... libcap: [ on ]
... clang-bpf-co-re: [ on ]
+... disassembler-four-args: [ on ]
+... disassembler-init-styled: [ OFF ]
$
Fixes: 0afc5cad387db560 ("perf build: Separate feature make support into config/Makefile.feature")
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: bpf@vger.kernel.org
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Quentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/r/20220818120957.319995-1-roberto.sassu@huaweicloud.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-08-18 12:09:55 +00:00
|
|
|
$$(info )
|
|
|
|
$$(info Auto-detecting system features:)
|
tools build: Display logical OR of a feature flavors
Sometimes, features are simply different flavors of another feature, to
properly detect the exact dependencies needed by different Linux
distributions.
For example, libbfd has three flavors: libbfd if the distro does not
require any additional dependency; libbfd-liberty if it requires libiberty;
libbfd-liberty-z if it requires libiberty and libz.
It might not be clear to the user whether a feature has been successfully
detected or not, given that some of its flavors will be set to OFF, others
to ON.
Instead, display only the feature main flavor if not in verbose mode
(VF != 1), and set it to ON if at least one of its flavors has been
successfully detected (logical OR), OFF otherwise. Omit the other flavors.
Accomplish that by declaring a FEATURE_GROUP_MEMBERS-<feature main flavor>
variable, with the list of the other flavors as variable value. For now, do
it just for libbfd.
In verbose mode, of if no group is defined for a feature, show the feature
detection result as before.
Committer testing:
Collecting the output from:
$ make -C tools/bpf/bpftool/ clean
$ make -C tools/bpf/bpftool/ |& grep "Auto-detecting system features" -A10
$ diff -u before after
--- before 2022-08-18 10:06:40.422086966 -0300
+++ after 2022-08-18 10:07:59.202138282 -0300
@@ -1,6 +1,4 @@
Auto-detecting system features:
... libbfd: [ on ]
-... libbfd-liberty: [ on ]
-... libbfd-liberty-z: [ on ]
... libcap: [ on ]
... clang-bpf-co-re: [ on ]
$
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Quentin Monnet <quentin@isovalent.com>
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20220818120957.319995-3-roberto.sassu@huaweicloud.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-08-18 12:09:57 +00:00
|
|
|
$(foreach feat,$(filter-out $(FEATURE_OMIT),$(FEATURE_DISPLAY)),$(call feature_print_status,$(feat),) $$(info $(MSG)))
|
2015-03-01 20:04:01 +00:00
|
|
|
endif
|
|
|
|
|
2021-04-26 20:01:24 +00:00
|
|
|
ifeq ($(feature_verbose),1)
|
tools build: Fix feature detection output due to eval expansion
As the first eval expansion is used only to generate Makefile statements,
messages should not be displayed at this stage, as for example conditional
expressions are not evaluated.
It can be seen for example in the output of feature detection for bpftool,
where the number of detected features does not change, despite turning on
the verbose mode (VF = 1) and there are additional features to display.
Fix this issue by escaping the $ before $(info) statements, to ensure that
messages are printed only when the function containing them is actually
executed, and not when it is expanded.
In addition, move the $(info) statement out of feature_print_status, due to
the fact that is called both inside and outside an eval context, and place
it to the caller so that the $ can be escaped when necessary. For symmetry,
move the $(info) statement also out of feature_print_text, and place it to
the caller.
Force the TMP variable evaluation in verbose mode, to display the features
in FEATURE_TESTS that are not in FEATURE_DISPLAY.
Reorder perf feature detection messages (first non-verbose, then verbose
ones) by moving the call to feature_display_entries earlier, before the VF
environment variable check.
Also, remove the newline from that function, as perf might display
additional messages. Move the newline to perf Makefile, and display another
one if displaying the detection result is not deferred as in the case of
bpftool.
Committer testing:
Collecting the output from:
$ make VF=1 -C tools/bpf/bpftool/ |& grep "Auto-detecting system features" -A20
$ diff -u before after
--- before 2022-08-18 09:59:55.460529231 -0300
+++ after 2022-08-18 10:01:11.182517282 -0300
@@ -4,3 +4,5 @@
... libbfd-liberty-z: [ on ]
... libcap: [ on ]
... clang-bpf-co-re: [ on ]
+... disassembler-four-args: [ on ]
+... disassembler-init-styled: [ OFF ]
$
Fixes: 0afc5cad387db560 ("perf build: Separate feature make support into config/Makefile.feature")
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: bpf@vger.kernel.org
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Quentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/r/20220818120957.319995-1-roberto.sassu@huaweicloud.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-08-18 12:09:55 +00:00
|
|
|
$(eval TMP := $(filter-out $(FEATURE_DISPLAY),$(FEATURE_TESTS)))
|
|
|
|
$(foreach feat,$(TMP),$(call feature_print_status,$(feat),) $$(info $(MSG)))
|
2021-04-26 20:01:24 +00:00
|
|
|
endif
|
|
|
|
endef
|
|
|
|
|
|
|
|
ifeq ($(FEATURE_DISPLAY_DEFERRED),)
|
|
|
|
$(call feature_display_entries)
|
tools build: Fix feature detection output due to eval expansion
As the first eval expansion is used only to generate Makefile statements,
messages should not be displayed at this stage, as for example conditional
expressions are not evaluated.
It can be seen for example in the output of feature detection for bpftool,
where the number of detected features does not change, despite turning on
the verbose mode (VF = 1) and there are additional features to display.
Fix this issue by escaping the $ before $(info) statements, to ensure that
messages are printed only when the function containing them is actually
executed, and not when it is expanded.
In addition, move the $(info) statement out of feature_print_status, due to
the fact that is called both inside and outside an eval context, and place
it to the caller so that the $ can be escaped when necessary. For symmetry,
move the $(info) statement also out of feature_print_text, and place it to
the caller.
Force the TMP variable evaluation in verbose mode, to display the features
in FEATURE_TESTS that are not in FEATURE_DISPLAY.
Reorder perf feature detection messages (first non-verbose, then verbose
ones) by moving the call to feature_display_entries earlier, before the VF
environment variable check.
Also, remove the newline from that function, as perf might display
additional messages. Move the newline to perf Makefile, and display another
one if displaying the detection result is not deferred as in the case of
bpftool.
Committer testing:
Collecting the output from:
$ make VF=1 -C tools/bpf/bpftool/ |& grep "Auto-detecting system features" -A20
$ diff -u before after
--- before 2022-08-18 09:59:55.460529231 -0300
+++ after 2022-08-18 10:01:11.182517282 -0300
@@ -4,3 +4,5 @@
... libbfd-liberty-z: [ on ]
... libcap: [ on ]
... clang-bpf-co-re: [ on ]
+... disassembler-four-args: [ on ]
+... disassembler-init-styled: [ OFF ]
$
Fixes: 0afc5cad387db560 ("perf build: Separate feature make support into config/Makefile.feature")
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: bpf@vger.kernel.org
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Quentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/r/20220818120957.319995-1-roberto.sassu@huaweicloud.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-08-18 12:09:55 +00:00
|
|
|
$(info )
|
2015-03-01 20:04:01 +00:00
|
|
|
endif
|