Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools build feature: Check if libaio is available

This will be used by 'perf record' to speed up reading the perf ring
buffer.

Committer testing:

$ make -C tools/perf O=/tmp/build/perf
make: Entering directory '/home/acme/git/perf/tools/perf'
BUILD: Doing 'make -j8' parallel build

Auto-detecting system features:
... dwarf: [ on ]
... dwarf_getlocations: [ on ]
... glibc: [ on ]
... gtk2: [ OFF ]
... libaudit: [ OFF ]
... libbfd: [ OFF ]
... libelf: [ on ]
... libnuma: [ OFF ]
... numa_num_possible_cpus: [ OFF ]
... libperl: [ OFF ]
... libpython: [ OFF ]
... libslang: [ on ]
... libcrypto: [ on ]
... libunwind: [ on ]
... libdw-dwarf-unwind: [ on ]
... zlib: [ on ]
... lzma: [ on ]
... get_cpuid: [ on ]
... bpf: [ on ]
... libaio: [ on ]

$ ls -la /tmp/build/perf/feature/test-libaio.*
-rwxrwxr-x. 1 acme acme 18296 Nov 26 08:49 /tmp/build/perf/feature/test-libaio.bin
-rw-rw-r--. 1 acme acme 1165 Nov 26 08:49 /tmp/build/perf/feature/test-libaio.d
-rw-rw-r--. 1 acme acme 0 Nov 26 08:49 /tmp/build/perf/feature/test-libaio.make.output
$
$ grep -i aio /tmp/build/perf/FEATURE-DUMP
feature-libaio=1
$

Signed-off-by: Alexey Budankov <alexey.budankov@linux.intel.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Reviewed-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/5fcda10c-6c63-68df-383a-c6d9e5d1f918@linux.intel.com
[ split from a larger patch ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Alexey Budankov and committed by
Arnaldo Carvalho de Melo
2a07d814 1c6f709b

+42 -4
+4 -2
tools/build/Makefile.feature
··· 70 70 sched_getcpu \ 71 71 sdt \ 72 72 setns \ 73 - libopencsd 73 + libopencsd \ 74 + libaio 74 75 75 76 # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list 76 77 # of all feature tests ··· 117 116 zlib \ 118 117 lzma \ 119 118 get_cpuid \ 120 - bpf 119 + bpf \ 120 + libaio 121 121 122 122 # Set FEATURE_CHECK_(C|LD)FLAGS-all for all FEATURE_TESTS features. 123 123 # If in the future we need per-feature checks/flags for features not
+5 -1
tools/build/feature/Makefile
··· 61 61 test-libopencsd.bin \ 62 62 test-clang.bin \ 63 63 test-llvm.bin \ 64 - test-llvm-version.bin 64 + test-llvm-version.bin \ 65 + test-libaio.bin 65 66 66 67 FILES := $(addprefix $(OUTPUT),$(FILES)) 67 68 ··· 297 296 > $(@:.bin=.make.output) 2>&1 298 297 299 298 -include $(OUTPUT)*.d 299 + 300 + $(OUTPUT)test-libaio.bin: 301 + $(BUILD) -lrt 300 302 301 303 ############################### 302 304
+5
tools/build/feature/test-all.c
··· 174 174 # include "test-libopencsd.c" 175 175 #undef main 176 176 177 + #define main main_test_libaio 178 + # include "test-libaio.c" 179 + #undef main 180 + 177 181 int main(int argc, char *argv[]) 178 182 { 179 183 main_test_libpython(); ··· 218 214 main_test_sdt(); 219 215 main_test_setns(); 220 216 main_test_libopencsd(); 217 + main_test_libaio(); 221 218 222 219 return 0; 223 220 }
+16
tools/build/feature/test-libaio.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + #include <aio.h> 3 + 4 + int main(void) 5 + { 6 + struct aiocb aiocb; 7 + 8 + aiocb.aio_fildes = 0; 9 + aiocb.aio_offset = 0; 10 + aiocb.aio_buf = 0; 11 + aiocb.aio_nbytes = 0; 12 + aiocb.aio_reqprio = 0; 13 + aiocb.aio_sigevent.sigev_notify = 1 /*SIGEV_NONE*/; 14 + 15 + return (int)aio_return(&aiocb); 16 + }
+6
tools/perf/Makefile.config
··· 365 365 CFLAGS += -DHAVE_GLIBC_SUPPORT 366 366 endif 367 367 368 + ifeq ($(feature-libaio), 1) 369 + ifndef NO_AIO 370 + CFLAGS += -DHAVE_AIO_SUPPORT 371 + endif 372 + endif 373 + 368 374 ifdef NO_DWARF 369 375 NO_LIBDW_DWARF_UNWIND := 1 370 376 endif
+6 -1
tools/perf/Makefile.perf
··· 101 101 # Define LIBCLANGLLVM if you DO want builtin clang and llvm support. 102 102 # When selected, pass LLVM_CONFIG=/path/to/llvm-config to `make' if 103 103 # llvm-config is not in $PATH. 104 - 104 + # 105 105 # Define NO_CORESIGHT if you do not want support for CoreSight trace decoding. 106 + # 107 + # Define NO_AIO if you do not want support of Posix AIO based trace 108 + # streaming for record mode. Currently Posix AIO trace streaming is 109 + # supported only when linking with glibc. 110 + # 106 111 107 112 # As per kernel Makefile, avoid funny character set dependencies 108 113 unexport LC_ALL