summaryrefslogtreecommitdiff
path: root/tools/testing/selftests
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2026-07-26 10:42:14 +0200
committerIngo Molnar <mingo@kernel.org>2026-07-26 10:42:14 +0200
commite04c4c5ef7d14790db3050de8f5e85fa803aca50 (patch)
tree45f2c638111ff1d1ed14b1e8174b1f6b304be66e /tools/testing/selftests
parentb2997796deccc770fa381c3cbae8ccd02b133864 (diff)
parentecc330e3096173f433659aa64ab3674d0d48440e (diff)
downloadlinux-next-e04c4c5ef7d14790db3050de8f5e85fa803aca50.tar.gz
linux-next-e04c4c5ef7d14790db3050de8f5e85fa803aca50.zip
Merge branch into tip/master: 'timers/core'
# New commits in timers/core: ecc330e30961 ("timers/migration: Fix bad line kernel-doc warning in struct tmigr_cpu") 98680a85df88 ("posix-cpu-timers: Avoid kernel-doc warnings") 151ce4cf88cf ("posix-timers: Clean up kernel-doc warnings") f44ce7fdbdd0 ("selftests: timers: Partially revert "Remove local NSEC_PER_SEC and USEC_PER_SEC defines"") 794ddd6e15cf ("ntp: Remove tick_length_base, use tick_length directly") 34ce97c33dca ("timekeeping: Settle competing time_offset and time_adjust skew") 289d1759494f ("timekeeping: Drive time_adjust skew via per-tick ntp_error transfer") d375af589909 ("timekeeping: Drive time_offset skew via per-tick ntp_error transfer") 869a55e662a0 ("timekeeping: Account for clocksource tick quantisation via NTP") b7befd6d9120 ("timekeeping: Account for monotonicity adjustment in ntp_error") 79b8bd857bd7 ("MAINTAINERS: Add Miroslav as timekeeping reviewer") 79ced850e549 ("y2038: uapi: Use 64-bit __kernel_old_timespec::tv_nsec on x32") 79bd39c58f2c ("timekeeping: Move the vDSO update declarations into a private header") 6e435911394b ("timekeeping: Fold vdso_time_update_aux() declarations into the generic ifdeffery") faef65e45a2a ("hrtimer: Remove inclusion of hrtimer_bases.h remove from hrtimer.h") 0c31af3d23e6 ("x86/speculation: Explicitly include linux/types.h") 071993aac72e ("hrtimer: Explicitly include some necessary headers in hrtimer_rearm.h") 95cf8bbadd10 ("hrtimer: Explicitly include linux/hrtimer_bases.h") 73fcec09d162 ("tick: Explicitly include linux/hrtimer_bases.h") a116c7582d7f ("hrtimer: Move hrtimer_update_function() to hrtimer.c") d3dc7fabd4c4 ("hrtimer: Move hrtimer_callback_running() to hrtimer_bases.h") 03b5d4c27982 ("hrtimer: Rename hrtimer_defs.h to hrtimer_bases.h") c4415c993fc2 ("hrtimer: Don't take cpu_base::lock in hrtimer_get_next_event() when hres_active") 1d28a67d496f ("timer_list: Annotate print_cpu() diagnostic reads") 06aba58e5849 ("time/namespace: Validate nanosecond field in proc_timens_set_offset()") eddfded41965 ("timers/migration: Fix memory leak in tmigr_setup_groups() error path") f2eee7e31ccd ("timekeeping: Unwind aux clock sysfs children on failure") 3dee6537e728 ("clocksource: Unregister subsystem on device registration failure") b4b66151a714 ("selftests: timers: leap-a-day: Fix -w option and update usage comment") b3afded935a8 ("clocksource: Remove unused WATCHDOG_INTERVAL_NS macro") d8966ca88566 ("hrtimer: Remove unused next_timer argument from __hrtimer_reprogram()") e2904ddb14a4 ("timekeeping: Document monotonic raw timestamps in snapshots correctly") a73d7f98e41a ("posix-cpu-timers: Don't abuse lock_task_sighand() in handle_posix_cpu_timers()") 034b5779b85b ("hrtimer: Remove unused clock_base_next_timer_safe()") Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/testing/selftests')
-rw-r--r--tools/testing/selftests/timers/Makefile2
-rw-r--r--tools/testing/selftests/timers/adjtick.c5
-rw-r--r--tools/testing/selftests/timers/alarmtimer-suspend.c3
-rw-r--r--tools/testing/selftests/timers/inconsistency-check.c3
-rw-r--r--tools/testing/selftests/timers/leap-a-day.c22
-rw-r--r--tools/testing/selftests/timers/mqueue-lat.c3
-rw-r--r--tools/testing/selftests/timers/nanosleep.c3
-rw-r--r--tools/testing/selftests/timers/nsleep-lat.c3
-rw-r--r--tools/testing/selftests/timers/posix_timers.c4
-rw-r--r--tools/testing/selftests/timers/raw_skew.c3
-rw-r--r--tools/testing/selftests/timers/set-2038.c3
-rw-r--r--tools/testing/selftests/timers/set-timer-lat.c3
-rw-r--r--tools/testing/selftests/timers/valid-adjtimex.c4
13 files changed, 39 insertions, 22 deletions
diff --git a/tools/testing/selftests/timers/Makefile b/tools/testing/selftests/timers/Makefile
index 32203593c62e..0e73a16874c4 100644
--- a/tools/testing/selftests/timers/Makefile
+++ b/tools/testing/selftests/timers/Makefile
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0
-CFLAGS += -O3 -Wl,-no-as-needed -Wall -I $(top_srcdir)
+CFLAGS += -O3 -Wl,-no-as-needed -Wall
LDLIBS += -lrt -lpthread -lm
# these are all "safe" tests that don't modify
diff --git a/tools/testing/selftests/timers/adjtick.c b/tools/testing/selftests/timers/adjtick.c
index 5b3ef708d6e9..22d274d5520f 100644
--- a/tools/testing/selftests/timers/adjtick.c
+++ b/tools/testing/selftests/timers/adjtick.c
@@ -22,10 +22,11 @@
#include <sys/time.h>
#include <sys/timex.h>
#include <time.h>
-#include <include/vdso/time64.h>
-
#include "kselftest.h"
+#define NSEC_PER_SEC 1000000000LL
+#define USEC_PER_SEC 1000000LL
+
#define MILLION 1000000
long systick;
diff --git a/tools/testing/selftests/timers/alarmtimer-suspend.c b/tools/testing/selftests/timers/alarmtimer-suspend.c
index aa66c805f6a4..d55d5b0377c6 100644
--- a/tools/testing/selftests/timers/alarmtimer-suspend.c
+++ b/tools/testing/selftests/timers/alarmtimer-suspend.c
@@ -28,10 +28,11 @@
#include <signal.h>
#include <stdlib.h>
#include <pthread.h>
-#include <include/vdso/time64.h>
#include <errno.h>
#include "kselftest.h"
+#define NSEC_PER_SEC 1000000000LL
+
#define UNREASONABLE_LAT (NSEC_PER_SEC * 5) /* hopefully we resume in 5 secs */
#define SUSPEND_SECS 15
diff --git a/tools/testing/selftests/timers/inconsistency-check.c b/tools/testing/selftests/timers/inconsistency-check.c
index e53e63e18683..9ab7066b4e32 100644
--- a/tools/testing/selftests/timers/inconsistency-check.c
+++ b/tools/testing/selftests/timers/inconsistency-check.c
@@ -28,9 +28,10 @@
#include <sys/timex.h>
#include <string.h>
#include <signal.h>
-#include <include/vdso/time64.h>
#include "kselftest.h"
+#define NSEC_PER_SEC 1000000000LL
+
/* CLOCK_HWSPECIFIC == CLOCK_SGI_CYCLE (Deprecated) */
#define CLOCK_HWSPECIFIC 10
diff --git a/tools/testing/selftests/timers/leap-a-day.c b/tools/testing/selftests/timers/leap-a-day.c
index 3568cfb3e815..71b49734e08c 100644
--- a/tools/testing/selftests/timers/leap-a-day.c
+++ b/tools/testing/selftests/timers/leap-a-day.c
@@ -9,16 +9,19 @@
* kernel's leap-second behavior, as well as how well applications
* handle the leap-second discontinuity.
*
- * Usage: leap-a-day [-s] [-i <num>]
+ * Usage: leap-a-day [-w] [-i <num>] [-t]
*
* Options:
- * -s: Each iteration, set the date to 10 seconds before midnight GMT.
- * This speeds up the number of leapsecond transitions tested,
- * but because it calls settimeofday frequently, advancing the
- * time by 24 hours every ~16 seconds, it may cause application
- * disruption.
+ * -w: Only set the leap-second flag and wait for the leap second
+ * each iteration, instead of advancing the time. By default the
+ * date is set to 10 seconds before midnight GMT, which speeds up
+ * the number of leapsecond transitions tested, but because it
+ * calls settimeofday frequently, advancing the time by 24 hours
+ * every ~16 seconds, it may cause application disruption.
*
- * -i: Number of iterations to run (default: infinite)
+ * -i: Number of iterations to run (-1 = infinite, default: 10)
+ *
+ * -t: Print TAI time.
*
* Other notes: Disabling NTP prior to running this is advised, as the two
* may conflict in their commands to the kernel.
@@ -48,9 +51,10 @@
#include <string.h>
#include <signal.h>
#include <unistd.h>
-#include <include/vdso/time64.h>
#include "kselftest.h"
+#define NSEC_PER_SEC 1000000000LL
+
#define CLOCK_TAI 11
time_t next_leap;
@@ -186,7 +190,7 @@ int main(int argc, char **argv)
int opt;
/* Process arguments */
- while ((opt = getopt(argc, argv, "sti:")) != -1) {
+ while ((opt = getopt(argc, argv, "wti:")) != -1) {
switch (opt) {
case 'w':
printf("Only setting leap-flag, not changing time. It could take up to a day for leap to trigger.\n");
diff --git a/tools/testing/selftests/timers/mqueue-lat.c b/tools/testing/selftests/timers/mqueue-lat.c
index c0d9368e4fca..ce8700c95cac 100644
--- a/tools/testing/selftests/timers/mqueue-lat.c
+++ b/tools/testing/selftests/timers/mqueue-lat.c
@@ -29,9 +29,10 @@
#include <signal.h>
#include <errno.h>
#include <mqueue.h>
-#include <include/vdso/time64.h>
#include "kselftest.h"
+#define NSEC_PER_SEC 1000000000LL
+
#define TARGET_TIMEOUT 100000000 /* 100ms in nanoseconds */
#define UNRESONABLE_LATENCY 40000000 /* 40ms in nanosecs */
diff --git a/tools/testing/selftests/timers/nanosleep.c b/tools/testing/selftests/timers/nanosleep.c
index a054680b3372..ceff18149a48 100644
--- a/tools/testing/selftests/timers/nanosleep.c
+++ b/tools/testing/selftests/timers/nanosleep.c
@@ -27,9 +27,10 @@
#include <sys/timex.h>
#include <string.h>
#include <signal.h>
-#include <include/vdso/time64.h>
#include "kselftest.h"
+#define NSEC_PER_SEC 1000000000LL
+
/* CLOCK_HWSPECIFIC == CLOCK_SGI_CYCLE (Deprecated) */
#define CLOCK_HWSPECIFIC 10
diff --git a/tools/testing/selftests/timers/nsleep-lat.c b/tools/testing/selftests/timers/nsleep-lat.c
index a7ba1eb1e21b..15f6493ca7b5 100644
--- a/tools/testing/selftests/timers/nsleep-lat.c
+++ b/tools/testing/selftests/timers/nsleep-lat.c
@@ -24,9 +24,10 @@
#include <sys/timex.h>
#include <string.h>
#include <signal.h>
-#include <include/vdso/time64.h>
#include "kselftest.h"
+#define NSEC_PER_SEC 1000000000LL
+
#define UNRESONABLE_LATENCY 40000000 /* 40ms in nanosecs */
/* CLOCK_HWSPECIFIC == CLOCK_SGI_CYCLE (Deprecated) */
diff --git a/tools/testing/selftests/timers/posix_timers.c b/tools/testing/selftests/timers/posix_timers.c
index 2f3bac9fc6e8..fa168d802f9e 100644
--- a/tools/testing/selftests/timers/posix_timers.c
+++ b/tools/testing/selftests/timers/posix_timers.c
@@ -16,12 +16,14 @@
#include <string.h>
#include <unistd.h>
#include <time.h>
-#include <include/vdso/time64.h>
#include <pthread.h>
#include <stdbool.h>
#include "kselftest.h"
+#define NSEC_PER_SEC 1000000000LL
+#define USEC_PER_SEC 1000000LL
+
#define DELAY 2
static void __fatal_error(const char *test, const char *name, const char *what)
diff --git a/tools/testing/selftests/timers/raw_skew.c b/tools/testing/selftests/timers/raw_skew.c
index a7bae7d80916..2dd16cb4cdd0 100644
--- a/tools/testing/selftests/timers/raw_skew.c
+++ b/tools/testing/selftests/timers/raw_skew.c
@@ -25,9 +25,10 @@
#include <sys/time.h>
#include <sys/timex.h>
#include <time.h>
-#include <include/vdso/time64.h>
#include "kselftest.h"
+#define NSEC_PER_SEC 1000000000LL
+
#define shift_right(x, s) ({ \
__typeof__(x) __x = (x); \
__typeof__(s) __s = (s); \
diff --git a/tools/testing/selftests/timers/set-2038.c b/tools/testing/selftests/timers/set-2038.c
index ecc171de4728..c1235638406d 100644
--- a/tools/testing/selftests/timers/set-2038.c
+++ b/tools/testing/selftests/timers/set-2038.c
@@ -27,9 +27,10 @@
#include <unistd.h>
#include <time.h>
#include <sys/time.h>
-#include <include/vdso/time64.h>
#include "kselftest.h"
+#define NSEC_PER_SEC 1000000000LL
+
#define KTIME_MAX ((long long)~((unsigned long long)1 << 63))
#define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC)
diff --git a/tools/testing/selftests/timers/set-timer-lat.c b/tools/testing/selftests/timers/set-timer-lat.c
index 44d2e3614fa5..e092c18befff 100644
--- a/tools/testing/selftests/timers/set-timer-lat.c
+++ b/tools/testing/selftests/timers/set-timer-lat.c
@@ -28,9 +28,10 @@
#include <signal.h>
#include <stdlib.h>
#include <pthread.h>
-#include <include/vdso/time64.h>
#include "kselftest.h"
+#define NSEC_PER_SEC 1000000000LL
+
/* CLOCK_HWSPECIFIC == CLOCK_SGI_CYCLE (Deprecated) */
#define CLOCK_HWSPECIFIC 10
diff --git a/tools/testing/selftests/timers/valid-adjtimex.c b/tools/testing/selftests/timers/valid-adjtimex.c
index e1e56d3097d6..dc2559eb11a5 100644
--- a/tools/testing/selftests/timers/valid-adjtimex.c
+++ b/tools/testing/selftests/timers/valid-adjtimex.c
@@ -29,9 +29,11 @@
#include <string.h>
#include <signal.h>
#include <unistd.h>
-#include <include/vdso/time64.h>
#include "kselftest.h"
+#define NSEC_PER_SEC 1000000000LL
+#define USEC_PER_SEC 1000000LL
+
#define ADJ_SETOFFSET 0x0100
#include <sys/syscall.h>