clock_gettime04: Retry on transient preemption delays
PATCH 1/1 clock_gettime04: Retry on transient preemption delays
clock_gettime04 performs 10,000 iterations of back-to-back clock readings across multiple syscall and vDSO variants, requiring every consecutive pair of readings to be within 5 ms. On preemptible kernels, if the test process is preempted or migrated by the scheduler between two readings, the elapsed off-CPU time can exceed 5 ms and cause a false failure even when all clock interfaces are accurate.
Unlike a persistent vDSO synchronization bug (such as 5b43bd184530), a scheduler preemption spike is transient. Allow up to 10 retries per clock by repeating the current iteration when a reading gap exceeds delta, failing only if the discrepancy persists.
--- testcases/kernel/syscalls/clock_gettime/clock_gettime04.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/clock_gettime/clock_gettime04.c +7 -1
@@ -107,7 +107,7 @@ static void run(unsigned int i)struct tst_ts ts;long long start, end =0 , diff, slack;struct time64_variants *tv; -int count =10000 , ret; +int count =10000 , retries =10 , ret;unsigned int j;if (clks[i] ==CLOCK_REALTIME_COARSE || clks[i] ==CLOCK_MONOTONIC_COARSE )
@@ -166,6 +166,12 @@ static void run(unsigned int i) diff /=1000000 ;if (diff >= delta) { +if (retries >0 ) { + retries--; + count++; +break ; + } +tst_res (TFAIL ,"%s(%s): Difference between successive readings greater than %lld ms (%d): %lld" ,tst_clock_name (clks[i]), tv->desc, delta, j, diff);return ;
Signature · 5 lines
2.56.0.611.g1030f0b940-goog -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Wake,
Quoted 1 line · Wake Liu
clock_gettime04: Retry on transient preemption delays
Verdict - Reviewed
---
Note:
The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp