[LTP] hrimer-prio test

Joerg Vehlow lkml@jv-coder.de
Fri Feb 11 07:56:44 CET 2022


Hi,

I was looking into fails with the test ltp test hrtimer-prio.

For reference here is the test description:
----
Test the latency of hrtimers under rt load.	
The busy_threads should run at a priority higher than the system
softirq_hrtimer, but lower than the timer_thread.  The timer_thread
measure the time it takes to return from a nanosleep call.  If the
lower priority threads can increase the latency of the higher
priority thread, it is considered a failure.
----

The test fails, repeatedly calls clock_nanosleep(10ms) and if the
latency of one of these nanosleeps is longer than 10us, the test fails.
The latency is measured using clock_gettime(CLOCK_MONOTONIC) In my test
on x86_64 hardware, the test sometimes fails, but mostly passes. On an
arm board it almost fails, sometimes with a minimal latency of > 30ms.

I have no knowledge of the timer subsystem, so I can't even tell if the
test is (still) valid. The test is in ltp since 2007, but wasn't enabled
until last year. So maybe the test is invalid and the expected latency
is not even guaranteed anymore or does it require a specific kernel
config or hardware (e.g. a high precision hardware timer)?

There is a kernel selftest for something similar (nsleep-lat). It only
expects the average latency to be less than 40ms, but that has another
difference, because it uses TIMER_ABSTIME instead of a relative sleep time.

Joerg


More information about the ltp mailing list