Skip to contentSkip to conversation

kselftest: timers: Add adjtick test to validate adjtimex() tick adjustments

PATCH Superseded John Stultz 2 participants 2 messages Oct 2, 2015 – Oct 3, 2015

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 kselftest: timers: Add adjtick test to validate adjtimex() tick adjustments

Recently an issue was reported that was difficult to detect except by tweaking the adjtimex tick value, and noticing how quickly the adjustment took to be made:

	https://lkml.org/lkml/2015/9/1/488

Thus this patch introduces a new test which manipulates the adjtimex tick value and validates the results are what we expect.

Cc Nuno Gonçalves <[email protected]>
Cc Miroslav Lichvar <[email protected]>
Cc Prarit Bhargava <[email protected]>
Cc Richard Cochran <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Shuah Khan <[email protected]>

---
v2: - Use sysconf(_SC_CLK_TCK) to properly get USER_HZ value.
v3: - Set STA_PLL to ensure offset is cleared
- Add rational for 100ppm error bound

 tools/testing/selftests/timers/Makefile  |   3 +-
 tools/testing/selftests/timers/adjtick.c | 210 +++++++++++++++++++++++++++++++
 2 files changed, 212 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/timers/adjtick.c
tools/testing/selftests/timers/Makefile +2 -1
index 89a3f44..4a1be1b 100644
@@ -8,7 +8,7 @@ LDFLAGS += -lrt -lpthread
 TEST_PROGS = posix_timers nanosleep nsleep-lat set-timer-lat mqueue-lat \
 	     inconsistency-check raw_skew threadtest rtctest
 
-TEST_PROGS_EXTENDED = alarmtimer-suspend valid-adjtimex change_skew \
+TEST_PROGS_EXTENDED = alarmtimer-suspend valid-adjtimex adjtick change_skew \
 		      skew_consistency clocksource-switch leap-a-day \
 		      leapcrash set-tai set-2038
 
@@ -24,6 +24,7 @@ include ../lib.mk
 run_destructive_tests: run_tests
 	./alarmtimer-suspend
 	./valid-adjtimex
+	./adjtick
 	./change_skew
 	./skew_consistency
 	./clocksource-switch
tools/testing/selftests/timers/adjtick.c new file +210 -0

210 lines not on this page · raw message

Signature · 1 line
1.9.1
#1 lore raw
Quoted 7 lines · John Stultz

Recently an issue was reported that was difficult to detect except by tweaking the adjtimex tick value, and noticing how quickly the adjustment took to be made:

	https://lkml.org/lkml/2015/9/1/488

Thus this patch introduces a new test which manipulates the adjtimex tick value and validates the results are what we expect.

So I tried to run this:

triton:~/tip/tools/testing/selftests/timers> ./adjtick
systick: 10000
Estimating tick (act: 9000 usec, -100000 ppm): 10000 usec, 1 ppmWARNING: Unexpected adjtimex return values, make sure ntpd is not running. triton:~/tip/tools/testing/selftests/timers>

note the weird placement of the warning, and there's also no newline at the end.

It would also be nice to print out roughly how long the test will take - since it runs longer than 1-2 seconds.

Thanks,

Ingo