FROMLIST: selftests/futex: Order calls in futex_requeue
Fixes a race between parent and child threads in futex_requeue. Similar to fbf4dec7 ("selftests/futex: Order calls to futex_lock_pi"), which fixed a flake in futex_lock_pi due to racing between the parent and child threads. The same issue can occur in the futex_requeue test, because it expects waiterfn to make progress to futex_wait before the parent starts to requeue. This is mitigated by the parent sleeping for WAKE_WAIT_US, but it still fails occasionally. This can be reproduced by adding a sleep in the waiterfn before futex_wait: TAP version 13 1..2 not ok 1 futex_requeue simple returned: 0 not ok 2 futex_requeue simple returned: 0 not ok 3 futex_requeue many returned: 0 not ok 4 futex_requeue many returned: 0 Instead, replace the sleep with barriers to make the sequencing explicit. Fixes: 7cb5dd8e ("selftests: futex: Add futex compare requeue test") Signed-off-by:Edward Liaw <edliaw@google.com> Reviewed-by:
Muhammad Usama Anjum <usama.anjum@collabora.com> Reviewed-by:
André Almeida <andrealmeid@igalia.com> Link: https://lore.kernel.org/linux-kselftest/20240918231102.234253-1-edliaw@google.com/ Bug: 367134942 Bug: 260003172 Test: ./run_test_only.sh -t 'selftests kselftest_futex_requeue' Change-Id: I8650c173bfd6333e00d0dede381a10310f2f42d1 Signed-off-by:
Edward Liaw <edliaw@google.com>
Loading