On Thu, 5 Mar 2026 at 09:45, Sun Jian <[email protected]> wrote: > > perf_link creates a system-wide perf event pinned to CPU 0 (pid=-1, cpu=0) > and also pins the test thread to CPU 0. Under concurrent selftests this > can lead to cross-test interference and CPU 0 contention, making the test > flaky. > > Create a per-task perf event instead (pid=0, cpu=-1) and drop CPU pinning > from burn_cpu(). Use barrier() to prevent the burn loop from being > optimized away. Drop the serial_ prefix so the test can run in parallel. > Also remove the stale TODO comment. > > Tested: > ./test_progs -t perf_link -vv > ./test_progs -j$(nproc) -t perf_link -vv > for i in $(seq 1 50); do ./test_progs -j$(nproc) -t perf_link; done > > Signed-off-by: Sun Jian <[email protected]> > ---
I tried reproducing the flakiness when removing serial_ prefix without this patch for a while, but wasn't successful. That said, the logic makes sense to me, the bit about burn_cpu() being optimized away can be true, and I think it is an improvement. Acked-by: Kumar Kartikeya Dwivedi <[email protected]> > [...]
