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

tools build feature: Check if pthread_barrier_t is available

As 'perf bench futex wake-parallel" will use this, which is not
available in older systems such as versions of the android NDK used in
my container build tests (r12b and r15c at the moment).

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: James Yang <james.yang@arm.com
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kim Phillips <kim.phillips@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-1i7iv54in4wj08lwo55b0pzv@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+26
+1
tools/build/Makefile.feature
··· 56 56 libunwind-arm \ 57 57 libunwind-aarch64 \ 58 58 pthread-attr-setaffinity-np \ 59 + pthread-barrier \ 59 60 stackprotector-all \ 60 61 timerfd \ 61 62 libdw-dwarf-unwind \
+4
tools/build/feature/Makefile
··· 37 37 test-libunwind-debug-frame-arm.bin \ 38 38 test-libunwind-debug-frame-aarch64.bin \ 39 39 test-pthread-attr-setaffinity-np.bin \ 40 + test-pthread-barrier.bin \ 40 41 test-stackprotector-all.bin \ 41 42 test-timerfd.bin \ 42 43 test-libdw-dwarf-unwind.bin \ ··· 79 78 80 79 $(OUTPUT)test-pthread-attr-setaffinity-np.bin: 81 80 $(BUILD) -D_GNU_SOURCE -lpthread 81 + 82 + $(OUTPUT)test-pthread-barrier.bin: 83 + $(BUILD) -lpthread 82 84 83 85 $(OUTPUT)test-stackprotector-all.bin: 84 86 $(BUILD) -fstack-protector-all
+5
tools/build/feature/test-all.c
··· 118 118 # include "test-pthread-attr-setaffinity-np.c" 119 119 #undef main 120 120 121 + #define main main_test_pthread_barrier 122 + # include "test-pthread-barrier.c" 123 + #undef main 124 + 121 125 #define main main_test_sched_getcpu 122 126 # include "test-sched_getcpu.c" 123 127 #undef main ··· 191 187 main_test_sync_compare_and_swap(argc, argv); 192 188 main_test_zlib(); 193 189 main_test_pthread_attr_setaffinity_np(); 190 + main_test_pthread_barrier(); 194 191 main_test_lzma(); 195 192 main_test_get_cpuid(); 196 193 main_test_bpf();
+12
tools/build/feature/test-pthread-barrier.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + #include <stdint.h> 3 + #include <pthread.h> 4 + 5 + int main(void) 6 + { 7 + pthread_barrier_t barrier; 8 + 9 + pthread_barrier_init(&barrier, NULL, 1); 10 + pthread_barrier_wait(&barrier); 11 + return pthread_barrier_destroy(&barrier); 12 + }
+4
tools/perf/Makefile.config
··· 263 263 CFLAGS += -DHAVE_PTHREAD_ATTR_SETAFFINITY_NP 264 264 endif 265 265 266 + ifeq ($(feature-pthread-barrier), 1) 267 + CFLAGS += -DHAVE_PTHREAD_BARRIER 268 + endif 269 + 266 270 ifndef NO_BIONIC 267 271 $(call feature_check,bionic) 268 272 ifeq ($(feature-bionic), 1)