]> Gentwo Git Trees - linux/.git/commit
selftests/bpf: Add lock wait time stats to rqspinlock stress test
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Tue, 25 Nov 2025 02:07:48 +0000 (02:07 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 25 Nov 2025 23:30:14 +0000 (15:30 -0800)
commit6173c1d6208c146af134e4a1d46f103507d60534
treeb65f2482eaca62448406d0b7955a73c634823cad
parent224de8d5a30e25570660306aeeeb738ed758ef0a
selftests/bpf: Add lock wait time stats to rqspinlock stress test

Add statistics per-CPU broken down by context and various timing windows
for the time taken to acquire an rqspinlock. Cases where all
acquisitions fit into the 10ms window are skipped from printing,
otherwise the full breakdown is displayed when printing the summary.
This allows capturing precisely the number of times outlier attempts
happened for a given lock in a given context.

A critical detail is that time is captured regardless of success or
failure, which is important to capture events for failed but long
waiting timeout attempts.

Output:

[   64.279459] rqspinlock acquisition latency histogram (ms):
[   64.279472]  cpu1: total 528426 (normal 526559, nmi 1867)
[   64.279477]    0-1ms: total 524697 (normal 524697, nmi 0)
[   64.279480]    2-2ms: total 3652 (normal 1811, nmi 1841)
[   64.279482]    3-3ms: total 66 (normal 47, nmi 19)
[   64.279485]    4-4ms: total 2 (normal 1, nmi 1)
[   64.279487]    5-5ms: total 1 (normal 1, nmi 0)
[   64.279489]    6-6ms: total 1 (normal 0, nmi 1)
[   64.279490]    101-150ms: total 1 (normal 0, nmi 1)
[   64.279492]    >= 251ms: total 6 (normal 2, nmi 4)
...

Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20251125020749.2421610-3-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/test_kmods/bpf_test_rqspinlock.c