<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/125510>125510</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Many libcxx/test/benchmarks tests FAIL
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            libc++
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          rorth
      </td>
    </tr>
</table>

<pre>
    When running a LLVM 20.1.0 rc1 reltest on Linux/x86_64, many (49 out of 75) new `libcxx/test/benchmarks` tests `FAIL`.  It seems the failure mode is always the same:
```
# .---command stderr------------
# | 2025-02-02T09:25:53+01:00
# | Running /var/llvm/reltest/llvm-20.1.0/rc1/Phase3/Release/llvmCore-20.1.0-rc1.obj/runtimes/runtimes-bins/libcxx/test/benchmarks/Output/atomic_wait_1_waiter_1_notifier.bench.cpp.dir/t.tmp.exe
# | Run on (64 X 2350 MHz CPU s)
# | CPU Caches:
# |   L1 Data 32 KiB (x32)
# |   L1 Instruction 32 KiB (x32)
# |   L2 Unified 512 KiB (x32)
# | L3 Unified 16384 KiB (x8)
# | Load Average: 174.90, 123.26, 82.05
# | ***WARNING*** CPU scaling is enabled, the benchmark real time measurements may be noisy and will incur extra overhead.
# | libc++abi: terminating due to uncaught exception of type std::runtime_error: failed to create thread
# `-----------------------------
# error: command failed with exit status: 250
```
The system is running Ubuntu 20.04 and has a single AMD EPYC 7452 32-Core cpu.

Unfortunately, the error message (from `libcxx/test/benchmarks/atomic_wait_helper.h (HighPrioTask::HighPrioTask)`) isn't particularly helpful: it should include the error returned from `pthread_create`.

When running one of the failing tests under `strace`, I find
```
139055 sched_get_priority_max(SCHED_FIFO) = 99
1139055 sched_get_priority_min(SCHED_FIFO) = 1
1139055 sched_get_priority_max(SCHED_FIFO) = 99
1139055 clone(child_stack=0x7f706411dfb0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tid=[1139741], tls=0x7f706411e700, child_tidptr=0x7f706411e9d0) = 1139741
1139055 sched_setscheduler(1139741, SCHED_FIFO, [99] <unfinished ...>
1139741 set_robust_list(0x7f706411e9e0, 24 <unfinished ...>
1139055 <... sched_setscheduler resumed>) = -1 EPERM (Operation not permitted)
```
It seems this code was introduced only recently in
```
commit 699f19605579f25083152a9ad21e14c2751d5d66
Author: Hui <hui.xie1990@gmail.com>
Date:   Sat Jan 18 14:50:53 2025 +0000

 [libc++] remove yield from atomic::wait (#120012)
```
@huixie90 : this introduces an enormous amount of noise and should be fixed before the LLVM 20.1.0 release.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMVl9z4kgO_zSdFxWu7rYN-IEHhz8b7shMKsnM3j5RjS3j3rHbVP9J4D79lYxDSG53ZimqaAtJln6Sfi3lnN4bxBlLb1m6uFHB152d2c76-mbXlafZ7zUasMEYbfagYLP5fg-SRyLiYAsBFhuPzkNnYKNNODK5Ok7H23HC5BxaZU7A5DTJoAseugomKZMZGHwFNuaN3hVHsiAPTK52aIq6VfaHY2MOJHSktsrXGzbmEcDag0NsHfgaoVK6CRah7UoE7UA1r-p0_supFlmcM56zMR--PGcyhmg0GhVd2ypTgvMlWju6-gxKbDIHyWU64nLE5TPPWJzLlMV5GjN5ywWLc86vdB8HdJhcvSjL5KppXlomVwM2g2B0Ro3khWBy9VArhzGTq0dsUDkc1OadxUF1ZAsRdbs_ySQYr1t0V8fRTht6_gmKcvU1-EMgqfJdq4vtq9J-K_oftFuxNZ3XlUYb9VZRcThEpaYUfOTbQ4RH_Jgn1ZnJ6TiB_4CMUw73d_-F-cM3cExmV6okmquiRjfUYZADbAQslFcQS_i3viVnx1h-NO6V1sZ5GwqvO_MLXQnfDCVRQir-XnETX9TEOJ4mF8XpJ71OlZC_oFV76iEQkyTKOHWzkHEkx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