From 91e76e260f48ac9f7d4de7c9af4b233c654b8850 Mon Sep 17 00:00:00 2001 From: Alexandre Frade Date: Fri, 17 Dec 2021 19:57:41 +0000 Subject: [PATCH] Revert "selftests: futex: Add FUTEX_WAIT_MULTIPLE wake up test" This reverts commit 77467adf2a308098f00f6fc05ab7023300a5985a. --- .../selftests/futex/functional/.gitignore | 1 - .../selftests/futex/functional/Makefile | 3 +- .../futex/functional/futex_wait_multiple.c | 173 ------------------ .../testing/selftests/futex/functional/run.sh | 3 - 4 files changed, 1 insertion(+), 179 deletions(-) delete mode 100644 tools/testing/selftests/futex/functional/futex_wait_multiple.c diff --git a/tools/testing/selftests/futex/functional/.gitignore b/tools/testing/selftests/futex/functional/.gitignore index 03a4bedcebc23..0efcd494daabf 100644 --- a/tools/testing/selftests/futex/functional/.gitignore +++ b/tools/testing/selftests/futex/functional/.gitignore @@ -6,4 +6,3 @@ futex_wait_private_mapped_file futex_wait_timeout futex_wait_uninitialized_heap futex_wait_wouldblock -futex_wait_multiple diff --git a/tools/testing/selftests/futex/functional/Makefile b/tools/testing/selftests/futex/functional/Makefile index 26562f2d792d5..23207829ec752 100644 --- a/tools/testing/selftests/futex/functional/Makefile +++ b/tools/testing/selftests/futex/functional/Makefile @@ -14,8 +14,7 @@ TEST_GEN_FILES := \ futex_requeue_pi_signal_restart \ futex_requeue_pi_mismatched_ops \ futex_wait_uninitialized_heap \ - futex_wait_private_mapped_file \ - futex_wait_multiple + futex_wait_private_mapped_file TEST_PROGS := run.sh diff --git a/tools/testing/selftests/futex/functional/futex_wait_multiple.c b/tools/testing/selftests/futex/functional/futex_wait_multiple.c deleted file mode 100644 index b48422e79f42e..0000000000000 --- a/tools/testing/selftests/futex/functional/futex_wait_multiple.c +++ /dev/null @@ -1,173 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/****************************************************************************** - * - * Copyright © Collabora, Ltd., 2019 - * - * DESCRIPTION - * Test basic semantics of FUTEX_WAIT_MULTIPLE - * - * AUTHOR - * Gabriel Krisman Bertazi - * - * HISTORY - * 2019-Dec-13: Initial version by Krisman - * - *****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include "futextest.h" -#include "logging.h" - -#define TEST_NAME "futex-wait-multiple" -#define timeout_ns 100000 -#define MAX_COUNT 128 -#define WAKE_WAIT_US 3000000 - -int ret = RET_PASS; -char *progname; -futex_t f[MAX_COUNT] = {0}; -struct futex_wait_block fwb[MAX_COUNT]; - -void usage(char *prog) -{ - printf("Usage: %s\n", prog); - printf(" -c Use color\n"); - printf(" -h Display this help message\n"); - printf(" -v L Verbosity level: %d=QUIET %d=CRITICAL %d=INFO\n", - VQUIET, VCRITICAL, VINFO); -} - -void test_count_overflow(void) -{ - futex_t f = FUTEX_INITIALIZER; - struct futex_wait_block fwb[MAX_COUNT+1]; - int res, i; - - ksft_print_msg("%s: Test a too big number of futexes\n", progname); - - for (i = 0; i < MAX_COUNT+1; i++) { - fwb[i].uaddr = &f; - fwb[i].val = f; - fwb[i].bitset = 0; - } - - res = futex_wait_multiple(fwb, MAX_COUNT+1, NULL, FUTEX_PRIVATE_FLAG); - -#ifdef __ILP32__ - if (res != -1 || errno != ENOSYS) { - ksft_test_result_fail("futex_wait_multiple returned %d\n", - res < 0 ? errno : res); - ret = RET_FAIL; - } else { - ksft_test_result_skip("futex_wait_multiple not supported at x32\n"); - } -#else - if (res != -1 || errno != EINVAL) { - ksft_test_result_fail("futex_wait_multiple returned %d\n", - res < 0 ? errno : res); - ret = RET_FAIL; - } else { - ksft_test_result_pass("futex_wait_multiple count overflow succeed\n"); - } - -#endif /* __ILP32__ */ -} - -void *waiterfn(void *arg) -{ - int res; - - res = futex_wait_multiple(fwb, MAX_COUNT, NULL, FUTEX_PRIVATE_FLAG); - -#ifdef __ILP32__ - if (res != -1 || errno != ENOSYS) { - ksft_test_result_fail("futex_wait_multiple returned %d\n", - res < 0 ? errno : res); - ret = RET_FAIL; - } else { - ksft_test_result_skip("futex_wait_multiple not supported at x32\n"); - } -#else - if (res < 0) - ksft_print_msg("waiter failed %d\n", res); - - info("futex_wait_multiple: Got hint futex %d was freed\n", res); -#endif /* __ILP32__ */ - - return NULL; -} - -void test_fwb_wakeup(void) -{ - int res, i; - pthread_t waiter; - - ksft_print_msg("%s: Test wake up in a list of futex\n", progname); - - for (i = 0; i < MAX_COUNT; i++) { - fwb[i].uaddr = &f[i]; - fwb[i].val = f[i]; - fwb[i].bitset = 0xffffffff; - } - - res = pthread_create(&waiter, NULL, waiterfn, NULL); - if (res) { - ksft_test_result_fail("Creating waiting thread failed"); - ksft_exit_fail(); - } - - usleep(WAKE_WAIT_US); - res = futex_wake(&(f[MAX_COUNT-1]), 1, FUTEX_PRIVATE_FLAG); - if (res != 1) { - ksft_test_result_fail("Failed to wake thread res=%d\n", res); - ksft_exit_fail(); - } - - pthread_join(waiter, NULL); - ksft_test_result_pass("%s succeed\n", __func__); -} - -int main(int argc, char *argv[]) -{ - int c; - - while ((c = getopt(argc, argv, "cht:v:")) != -1) { - switch (c) { - case 'c': - log_color(1); - break; - case 'h': - usage(basename(argv[0])); - exit(0); - case 'v': - log_verbosity(atoi(optarg)); - break; - default: - usage(basename(argv[0])); - exit(1); - } - } - - progname = basename(argv[0]); - - ksft_print_header(); - ksft_set_plan(2); - - test_count_overflow(); - -#ifdef __ILP32__ - // if it's a 32x binary, there's no futex to wakeup - ksft_test_result_skip("futex_wait_multiple not supported at x32\n"); -#else - test_fwb_wakeup(); -#endif /* __ILP32__ */ - - ksft_print_cnts(); - return ret; -} diff --git a/tools/testing/selftests/futex/functional/run.sh b/tools/testing/selftests/futex/functional/run.sh index a8be94f28ff78..1acb6ace1680e 100755 --- a/tools/testing/selftests/futex/functional/run.sh +++ b/tools/testing/selftests/futex/functional/run.sh @@ -73,6 +73,3 @@ echo echo ./futex_wait_uninitialized_heap $COLOR ./futex_wait_private_mapped_file $COLOR - -echo -./futex_wait_multiple $COLOR