Skip to contentSkip to conversation

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

PATCH New John Stultz 2 participants 2 messages Oct 6, 2015 – Oct 12, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v4 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
v4: - Add message informing each iteration takes ~15 secs
- Cleanup error message when ntpd is suspected of running

 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

[tip:timers/core] timers, kselftest: Add 'adjtick' test to validate adjtimex() tick adjustments

timers, kselftest: Add 'adjtick' test to validate adjtimex() tick adjustments
Commit-ID:  6035519fcf5aa17084b41790cdc584d881d82c03
Gitweb:     http://git.kernel.org/tip/6035519fcf5aa17084b41790cdc584d881d82c03
Author:     John Stultz <[email protected]>
AuthorDate: Mon, 5 Oct 2015 18:16:57 -0700
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 12 Oct 2015 09:51:34 +0200

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

Recently a kernel side NTP bug was fixed via the following commit:

2619d7e9c92d ("time: Fix timekeeping_freqadjust()'s incorrect use of abs() instead of abs64()")

When the bug was reported it was difficult to detect, except by tweaking the adjtimex tick value, and noticing how quickly the adjustment took:

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

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

Cc Linus Torvalds <[email protected]>
Cc Miroslav Lichvar <[email protected]>
Cc Nuno Gonçalves <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Prarit Bhargava <[email protected]>
Cc Richard Cochran <[email protected]>
Cc Shuah Khan <[email protected]>
Cc Thomas Gleixner <[email protected]>
[ Tidied up the code and the changelog a bit. ]
---
 tools/testing/selftests/timers/Makefile  |   3 +-
 tools/testing/selftests/timers/adjtick.c | 221 +++++++++++++++++++++++++++++++
 2 files changed, 223 insertions(+), 1 deletion(-)
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 +221 -0

221 lines not on this page · raw message