posix_timers.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (C) 2013 Red Hat, Inc., Frederic Weisbecker <fweisbec@redhat.com>
  4. *
  5. * Selftests for a few posix timers interface.
  6. *
  7. * Kernel loop code stolen from Steven Rostedt <srostedt@redhat.com>
  8. */
  9. #define _GNU_SOURCE
  10. #include <sys/time.h>
  11. #include <sys/types.h>
  12. #include <stdio.h>
  13. #include <signal.h>
  14. #include <stdint.h>
  15. #include <string.h>
  16. #include <unistd.h>
  17. #include <time.h>
  18. #include <pthread.h>
  19. #include "../kselftest.h"
  20. #define DELAY 2
  21. #define USECS_PER_SEC 1000000
  22. #define NSECS_PER_SEC 1000000000
  23. static void __fatal_error(const char *test, const char *name, const char *what)
  24. {
  25. char buf[64];
  26. char *ret_str = NULL;
  27. ret_str = strerror_r(errno, buf, sizeof(buf));
  28. if (name && strlen(name) && ret_str)
  29. ksft_exit_fail_msg("%s %s %s %s\n", test, name, what, ret_str);
  30. else if (ret_str)
  31. ksft_exit_fail_msg("%s %s %s\n", test, what, ret_str);
  32. else
  33. ksft_exit_fail_msg("%s %s\n", test, what);
  34. }
  35. #define fatal_error(name, what) __fatal_error(__func__, name, what)
  36. static volatile int done;
  37. /* Busy loop in userspace to elapse ITIMER_VIRTUAL */
  38. static void user_loop(void)
  39. {
  40. while (!done);
  41. }
  42. /*
  43. * Try to spend as much time as possible in kernelspace
  44. * to elapse ITIMER_PROF.
  45. */
  46. static void kernel_loop(void)
  47. {
  48. void *addr = sbrk(0);
  49. int err = 0;
  50. while (!done && !err) {
  51. err = brk(addr + 4096);
  52. err |= brk(addr);
  53. }
  54. }
  55. /*
  56. * Sleep until ITIMER_REAL expiration.
  57. */
  58. static void idle_loop(void)
  59. {
  60. pause();
  61. }
  62. static void sig_handler(int nr)
  63. {
  64. done = 1;
  65. }
  66. /*
  67. * Check the expected timer expiration matches the GTOD elapsed delta since
  68. * we armed the timer. Keep a 0.5 sec error margin due to various jitter.
  69. */
  70. static int check_diff(struct timeval start, struct timeval end)
  71. {
  72. long long diff;
  73. diff = end.tv_usec - start.tv_usec;
  74. diff += (end.tv_sec - start.tv_sec) * USECS_PER_SEC;
  75. if (llabs(diff - DELAY * USECS_PER_SEC) > USECS_PER_SEC / 2) {
  76. printf("Diff too high: %lld..", diff);
  77. return -1;
  78. }
  79. return 0;
  80. }
  81. static void check_itimer(int which, const char *name)
  82. {
  83. struct timeval start, end;
  84. struct itimerval val = {
  85. .it_value.tv_sec = DELAY,
  86. };
  87. done = 0;
  88. if (which == ITIMER_VIRTUAL)
  89. signal(SIGVTALRM, sig_handler);
  90. else if (which == ITIMER_PROF)
  91. signal(SIGPROF, sig_handler);
  92. else if (which == ITIMER_REAL)
  93. signal(SIGALRM, sig_handler);
  94. if (gettimeofday(&start, NULL) < 0)
  95. fatal_error(name, "gettimeofday()");
  96. if (setitimer(which, &val, NULL) < 0)
  97. fatal_error(name, "setitimer()");
  98. if (which == ITIMER_VIRTUAL)
  99. user_loop();
  100. else if (which == ITIMER_PROF)
  101. kernel_loop();
  102. else if (which == ITIMER_REAL)
  103. idle_loop();
  104. if (gettimeofday(&end, NULL) < 0)
  105. fatal_error(name, "gettimeofday()");
  106. ksft_test_result(check_diff(start, end) == 0, "%s\n", name);
  107. }
  108. static void check_timer_create(int which, const char *name)
  109. {
  110. struct timeval start, end;
  111. struct itimerspec val = {
  112. .it_value.tv_sec = DELAY,
  113. };
  114. timer_t id;
  115. done = 0;
  116. if (timer_create(which, NULL, &id) < 0)
  117. fatal_error(name, "timer_create()");
  118. if (signal(SIGALRM, sig_handler) == SIG_ERR)
  119. fatal_error(name, "signal()");
  120. if (gettimeofday(&start, NULL) < 0)
  121. fatal_error(name, "gettimeofday()");
  122. if (timer_settime(id, 0, &val, NULL) < 0)
  123. fatal_error(name, "timer_settime()");
  124. user_loop();
  125. if (gettimeofday(&end, NULL) < 0)
  126. fatal_error(name, "gettimeofday()");
  127. ksft_test_result(check_diff(start, end) == 0,
  128. "timer_create() per %s\n", name);
  129. }
  130. static pthread_t ctd_thread;
  131. static volatile int ctd_count, ctd_failed;
  132. static void ctd_sighandler(int sig)
  133. {
  134. if (pthread_self() != ctd_thread)
  135. ctd_failed = 1;
  136. ctd_count--;
  137. }
  138. static void *ctd_thread_func(void *arg)
  139. {
  140. struct itimerspec val = {
  141. .it_value.tv_sec = 0,
  142. .it_value.tv_nsec = 1000 * 1000,
  143. .it_interval.tv_sec = 0,
  144. .it_interval.tv_nsec = 1000 * 1000,
  145. };
  146. timer_t id;
  147. /* 1/10 seconds to ensure the leader sleeps */
  148. usleep(10000);
  149. ctd_count = 100;
  150. if (timer_create(CLOCK_PROCESS_CPUTIME_ID, NULL, &id))
  151. fatal_error(NULL, "timer_create()");
  152. if (timer_settime(id, 0, &val, NULL))
  153. fatal_error(NULL, "timer_settime()");
  154. while (ctd_count > 0 && !ctd_failed)
  155. ;
  156. if (timer_delete(id))
  157. fatal_error(NULL, "timer_delete()");
  158. return NULL;
  159. }
  160. /*
  161. * Test that only the running thread receives the timer signal.
  162. */
  163. static void check_timer_distribution(void)
  164. {
  165. if (signal(SIGALRM, ctd_sighandler) == SIG_ERR)
  166. fatal_error(NULL, "signal()");
  167. if (pthread_create(&ctd_thread, NULL, ctd_thread_func, NULL))
  168. fatal_error(NULL, "pthread_create()");
  169. if (pthread_join(ctd_thread, NULL))
  170. fatal_error(NULL, "pthread_join()");
  171. if (!ctd_failed)
  172. ksft_test_result_pass("check signal distribution\n");
  173. else if (ksft_min_kernel_version(6, 3))
  174. ksft_test_result_fail("check signal distribution\n");
  175. else
  176. ksft_test_result_skip("check signal distribution (old kernel)\n");
  177. }
  178. struct tmrsig {
  179. int signals;
  180. int overruns;
  181. };
  182. static void siginfo_handler(int sig, siginfo_t *si, void *uc)
  183. {
  184. struct tmrsig *tsig = si ? si->si_ptr : NULL;
  185. if (tsig) {
  186. tsig->signals++;
  187. tsig->overruns += si->si_overrun;
  188. }
  189. }
  190. static void *ignore_thread(void *arg)
  191. {
  192. unsigned int *tid = arg;
  193. sigset_t set;
  194. sigemptyset(&set);
  195. sigaddset(&set, SIGUSR1);
  196. if (sigprocmask(SIG_BLOCK, &set, NULL))
  197. fatal_error(NULL, "sigprocmask(SIG_BLOCK)");
  198. *tid = gettid();
  199. sleep(100);
  200. if (sigprocmask(SIG_UNBLOCK, &set, NULL))
  201. fatal_error(NULL, "sigprocmask(SIG_UNBLOCK)");
  202. return NULL;
  203. }
  204. static void check_sig_ign(int thread)
  205. {
  206. struct tmrsig tsig = { };
  207. struct itimerspec its;
  208. unsigned int tid = 0;
  209. struct sigaction sa;
  210. struct sigevent sev;
  211. pthread_t pthread;
  212. timer_t timerid;
  213. sigset_t set;
  214. if (thread) {
  215. if (pthread_create(&pthread, NULL, ignore_thread, &tid))
  216. fatal_error(NULL, "pthread_create()");
  217. sleep(1);
  218. }
  219. sa.sa_flags = SA_SIGINFO;
  220. sa.sa_sigaction = siginfo_handler;
  221. sigemptyset(&sa.sa_mask);
  222. if (sigaction(SIGUSR1, &sa, NULL))
  223. fatal_error(NULL, "sigaction()");
  224. /* Block the signal */
  225. sigemptyset(&set);
  226. sigaddset(&set, SIGUSR1);
  227. if (sigprocmask(SIG_BLOCK, &set, NULL))
  228. fatal_error(NULL, "sigprocmask(SIG_BLOCK)");
  229. memset(&sev, 0, sizeof(sev));
  230. sev.sigev_notify = SIGEV_SIGNAL;
  231. sev.sigev_signo = SIGUSR1;
  232. sev.sigev_value.sival_ptr = &tsig;
  233. if (thread) {
  234. sev.sigev_notify = SIGEV_THREAD_ID;
  235. sev._sigev_un._tid = tid;
  236. }
  237. if (timer_create(CLOCK_MONOTONIC, &sev, &timerid))
  238. fatal_error(NULL, "timer_create()");
  239. /* Start the timer to expire in 100ms and 100ms intervals */
  240. its.it_value.tv_sec = 0;
  241. its.it_value.tv_nsec = 100000000;
  242. its.it_interval.tv_sec = 0;
  243. its.it_interval.tv_nsec = 100000000;
  244. timer_settime(timerid, 0, &its, NULL);
  245. sleep(1);
  246. /* Set the signal to be ignored */
  247. if (signal(SIGUSR1, SIG_IGN) == SIG_ERR)
  248. fatal_error(NULL, "signal(SIG_IGN)");
  249. sleep(1);
  250. if (thread) {
  251. /* Stop the thread first. No signal should be delivered to it */
  252. if (pthread_cancel(pthread))
  253. fatal_error(NULL, "pthread_cancel()");
  254. if (pthread_join(pthread, NULL))
  255. fatal_error(NULL, "pthread_join()");
  256. }
  257. /* Restore the handler */
  258. if (sigaction(SIGUSR1, &sa, NULL))
  259. fatal_error(NULL, "sigaction()");
  260. sleep(1);
  261. /* Unblock it, which should deliver the signal in the !thread case*/
  262. if (sigprocmask(SIG_UNBLOCK, &set, NULL))
  263. fatal_error(NULL, "sigprocmask(SIG_UNBLOCK)");
  264. if (timer_delete(timerid))
  265. fatal_error(NULL, "timer_delete()");
  266. if (!thread) {
  267. ksft_test_result(tsig.signals == 1 && tsig.overruns == 29,
  268. "check_sig_ign SIGEV_SIGNAL\n");
  269. } else {
  270. ksft_test_result(tsig.signals == 0 && tsig.overruns == 0,
  271. "check_sig_ign SIGEV_THREAD_ID\n");
  272. }
  273. }
  274. static void check_rearm(void)
  275. {
  276. struct tmrsig tsig = { };
  277. struct itimerspec its;
  278. struct sigaction sa;
  279. struct sigevent sev;
  280. timer_t timerid;
  281. sigset_t set;
  282. sa.sa_flags = SA_SIGINFO;
  283. sa.sa_sigaction = siginfo_handler;
  284. sigemptyset(&sa.sa_mask);
  285. if (sigaction(SIGUSR1, &sa, NULL))
  286. fatal_error(NULL, "sigaction()");
  287. /* Block the signal */
  288. sigemptyset(&set);
  289. sigaddset(&set, SIGUSR1);
  290. if (sigprocmask(SIG_BLOCK, &set, NULL))
  291. fatal_error(NULL, "sigprocmask(SIG_BLOCK)");
  292. memset(&sev, 0, sizeof(sev));
  293. sev.sigev_notify = SIGEV_SIGNAL;
  294. sev.sigev_signo = SIGUSR1;
  295. sev.sigev_value.sival_ptr = &tsig;
  296. if (timer_create(CLOCK_MONOTONIC, &sev, &timerid))
  297. fatal_error(NULL, "timer_create()");
  298. /* Start the timer to expire in 100ms and 100ms intervals */
  299. its.it_value.tv_sec = 0;
  300. its.it_value.tv_nsec = 100000000;
  301. its.it_interval.tv_sec = 0;
  302. its.it_interval.tv_nsec = 100000000;
  303. if (timer_settime(timerid, 0, &its, NULL))
  304. fatal_error(NULL, "timer_settime()");
  305. sleep(1);
  306. /* Reprogram the timer to single shot */
  307. its.it_value.tv_sec = 10;
  308. its.it_value.tv_nsec = 0;
  309. its.it_interval.tv_sec = 0;
  310. its.it_interval.tv_nsec = 0;
  311. if (timer_settime(timerid, 0, &its, NULL))
  312. fatal_error(NULL, "timer_settime()");
  313. /* Unblock it, which should not deliver a signal */
  314. if (sigprocmask(SIG_UNBLOCK, &set, NULL))
  315. fatal_error(NULL, "sigprocmask(SIG_UNBLOCK)");
  316. if (timer_delete(timerid))
  317. fatal_error(NULL, "timer_delete()");
  318. ksft_test_result(!tsig.signals, "check_rearm\n");
  319. }
  320. static void check_delete(void)
  321. {
  322. struct tmrsig tsig = { };
  323. struct itimerspec its;
  324. struct sigaction sa;
  325. struct sigevent sev;
  326. timer_t timerid;
  327. sigset_t set;
  328. sa.sa_flags = SA_SIGINFO;
  329. sa.sa_sigaction = siginfo_handler;
  330. sigemptyset(&sa.sa_mask);
  331. if (sigaction(SIGUSR1, &sa, NULL))
  332. fatal_error(NULL, "sigaction()");
  333. /* Block the signal */
  334. sigemptyset(&set);
  335. sigaddset(&set, SIGUSR1);
  336. if (sigprocmask(SIG_BLOCK, &set, NULL))
  337. fatal_error(NULL, "sigprocmask(SIG_BLOCK)");
  338. memset(&sev, 0, sizeof(sev));
  339. sev.sigev_notify = SIGEV_SIGNAL;
  340. sev.sigev_signo = SIGUSR1;
  341. sev.sigev_value.sival_ptr = &tsig;
  342. if (timer_create(CLOCK_MONOTONIC, &sev, &timerid))
  343. fatal_error(NULL, "timer_create()");
  344. /* Start the timer to expire in 100ms and 100ms intervals */
  345. its.it_value.tv_sec = 0;
  346. its.it_value.tv_nsec = 100000000;
  347. its.it_interval.tv_sec = 0;
  348. its.it_interval.tv_nsec = 100000000;
  349. if (timer_settime(timerid, 0, &its, NULL))
  350. fatal_error(NULL, "timer_settime()");
  351. sleep(1);
  352. if (timer_delete(timerid))
  353. fatal_error(NULL, "timer_delete()");
  354. /* Unblock it, which should not deliver a signal */
  355. if (sigprocmask(SIG_UNBLOCK, &set, NULL))
  356. fatal_error(NULL, "sigprocmask(SIG_UNBLOCK)");
  357. ksft_test_result(!tsig.signals, "check_delete\n");
  358. }
  359. static inline int64_t calcdiff_ns(struct timespec t1, struct timespec t2)
  360. {
  361. int64_t diff;
  362. diff = NSECS_PER_SEC * (int64_t)((int) t1.tv_sec - (int) t2.tv_sec);
  363. diff += ((int) t1.tv_nsec - (int) t2.tv_nsec);
  364. return diff;
  365. }
  366. static void check_sigev_none(int which, const char *name)
  367. {
  368. struct timespec start, now;
  369. struct itimerspec its;
  370. struct sigevent sev;
  371. timer_t timerid;
  372. memset(&sev, 0, sizeof(sev));
  373. sev.sigev_notify = SIGEV_NONE;
  374. if (timer_create(which, &sev, &timerid))
  375. fatal_error(name, "timer_create()");
  376. /* Start the timer to expire in 100ms and 100ms intervals */
  377. its.it_value.tv_sec = 0;
  378. its.it_value.tv_nsec = 100000000;
  379. its.it_interval.tv_sec = 0;
  380. its.it_interval.tv_nsec = 100000000;
  381. timer_settime(timerid, 0, &its, NULL);
  382. if (clock_gettime(which, &start))
  383. fatal_error(name, "clock_gettime()");
  384. do {
  385. if (clock_gettime(which, &now))
  386. fatal_error(name, "clock_gettime()");
  387. } while (calcdiff_ns(now, start) < NSECS_PER_SEC);
  388. if (timer_gettime(timerid, &its))
  389. fatal_error(name, "timer_gettime()");
  390. if (timer_delete(timerid))
  391. fatal_error(name, "timer_delete()");
  392. ksft_test_result(its.it_value.tv_sec || its.it_value.tv_nsec,
  393. "check_sigev_none %s\n", name);
  394. }
  395. static void check_gettime(int which, const char *name)
  396. {
  397. struct itimerspec its, prev;
  398. struct timespec start, now;
  399. struct sigevent sev;
  400. timer_t timerid;
  401. int wraps = 0;
  402. sigset_t set;
  403. /* Block the signal */
  404. sigemptyset(&set);
  405. sigaddset(&set, SIGUSR1);
  406. if (sigprocmask(SIG_BLOCK, &set, NULL))
  407. fatal_error(name, "sigprocmask(SIG_BLOCK)");
  408. memset(&sev, 0, sizeof(sev));
  409. sev.sigev_notify = SIGEV_SIGNAL;
  410. sev.sigev_signo = SIGUSR1;
  411. if (timer_create(which, &sev, &timerid))
  412. fatal_error(name, "timer_create()");
  413. /* Start the timer to expire in 100ms and 100ms intervals */
  414. its.it_value.tv_sec = 0;
  415. its.it_value.tv_nsec = 100000000;
  416. its.it_interval.tv_sec = 0;
  417. its.it_interval.tv_nsec = 100000000;
  418. if (timer_settime(timerid, 0, &its, NULL))
  419. fatal_error(name, "timer_settime()");
  420. if (timer_gettime(timerid, &prev))
  421. fatal_error(name, "timer_gettime()");
  422. if (clock_gettime(which, &start))
  423. fatal_error(name, "clock_gettime()");
  424. do {
  425. if (clock_gettime(which, &now))
  426. fatal_error(name, "clock_gettime()");
  427. if (timer_gettime(timerid, &its))
  428. fatal_error(name, "timer_gettime()");
  429. if (its.it_value.tv_nsec > prev.it_value.tv_nsec)
  430. wraps++;
  431. prev = its;
  432. } while (calcdiff_ns(now, start) < NSECS_PER_SEC);
  433. if (timer_delete(timerid))
  434. fatal_error(name, "timer_delete()");
  435. ksft_test_result(wraps > 1, "check_gettime %s\n", name);
  436. }
  437. static void check_overrun(int which, const char *name)
  438. {
  439. struct timespec start, now;
  440. struct tmrsig tsig = { };
  441. struct itimerspec its;
  442. struct sigaction sa;
  443. struct sigevent sev;
  444. timer_t timerid;
  445. sigset_t set;
  446. sa.sa_flags = SA_SIGINFO;
  447. sa.sa_sigaction = siginfo_handler;
  448. sigemptyset(&sa.sa_mask);
  449. if (sigaction(SIGUSR1, &sa, NULL))
  450. fatal_error(name, "sigaction()");
  451. /* Block the signal */
  452. sigemptyset(&set);
  453. sigaddset(&set, SIGUSR1);
  454. if (sigprocmask(SIG_BLOCK, &set, NULL))
  455. fatal_error(name, "sigprocmask(SIG_BLOCK)");
  456. memset(&sev, 0, sizeof(sev));
  457. sev.sigev_notify = SIGEV_SIGNAL;
  458. sev.sigev_signo = SIGUSR1;
  459. sev.sigev_value.sival_ptr = &tsig;
  460. if (timer_create(which, &sev, &timerid))
  461. fatal_error(name, "timer_create()");
  462. /* Start the timer to expire in 100ms and 100ms intervals */
  463. its.it_value.tv_sec = 0;
  464. its.it_value.tv_nsec = 100000000;
  465. its.it_interval.tv_sec = 0;
  466. its.it_interval.tv_nsec = 100000000;
  467. if (timer_settime(timerid, 0, &its, NULL))
  468. fatal_error(name, "timer_settime()");
  469. if (clock_gettime(which, &start))
  470. fatal_error(name, "clock_gettime()");
  471. do {
  472. if (clock_gettime(which, &now))
  473. fatal_error(name, "clock_gettime()");
  474. } while (calcdiff_ns(now, start) < NSECS_PER_SEC);
  475. /* Unblock it, which should deliver a signal */
  476. if (sigprocmask(SIG_UNBLOCK, &set, NULL))
  477. fatal_error(name, "sigprocmask(SIG_UNBLOCK)");
  478. if (timer_delete(timerid))
  479. fatal_error(name, "timer_delete()");
  480. ksft_test_result(tsig.signals == 1 && tsig.overruns == 9,
  481. "check_overrun %s\n", name);
  482. }
  483. int main(int argc, char **argv)
  484. {
  485. ksft_print_header();
  486. ksft_set_plan(18);
  487. ksft_print_msg("Testing posix timers. False negative may happen on CPU execution \n");
  488. ksft_print_msg("based timers if other threads run on the CPU...\n");
  489. check_itimer(ITIMER_VIRTUAL, "ITIMER_VIRTUAL");
  490. check_itimer(ITIMER_PROF, "ITIMER_PROF");
  491. check_itimer(ITIMER_REAL, "ITIMER_REAL");
  492. check_timer_create(CLOCK_THREAD_CPUTIME_ID, "CLOCK_THREAD_CPUTIME_ID");
  493. /*
  494. * It's unfortunately hard to reliably test a timer expiration
  495. * on parallel multithread cputime. We could arm it to expire
  496. * on DELAY * nr_threads, with nr_threads busy looping, then wait
  497. * the normal DELAY since the time is elapsing nr_threads faster.
  498. * But for that we need to ensure we have real physical free CPUs
  499. * to ensure true parallelism. So test only one thread until we
  500. * find a better solution.
  501. */
  502. check_timer_create(CLOCK_PROCESS_CPUTIME_ID, "CLOCK_PROCESS_CPUTIME_ID");
  503. check_timer_distribution();
  504. check_sig_ign(0);
  505. check_sig_ign(1);
  506. check_rearm();
  507. check_delete();
  508. check_sigev_none(CLOCK_MONOTONIC, "CLOCK_MONOTONIC");
  509. check_sigev_none(CLOCK_PROCESS_CPUTIME_ID, "CLOCK_PROCESS_CPUTIME_ID");
  510. check_gettime(CLOCK_MONOTONIC, "CLOCK_MONOTONIC");
  511. check_gettime(CLOCK_PROCESS_CPUTIME_ID, "CLOCK_PROCESS_CPUTIME_ID");
  512. check_gettime(CLOCK_THREAD_CPUTIME_ID, "CLOCK_THREAD_CPUTIME_ID");
  513. check_overrun(CLOCK_MONOTONIC, "CLOCK_MONOTONIC");
  514. check_overrun(CLOCK_PROCESS_CPUTIME_ID, "CLOCK_PROCESS_CPUTIME_ID");
  515. check_overrun(CLOCK_THREAD_CPUTIME_ID, "CLOCK_THREAD_CPUTIME_ID");
  516. ksft_finished();
  517. }