Skip to content

alarmtimers/posixtimers: Bug fixes and spec conformity changes

Thomas Gleixner lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest26 patches 9 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/26alarmtimer: Prevent overflow of relative timerskernel/time/alarmtimer.c+3 -30 replies
2/26alarmtimer: Rate limit periodic intervalskernel/time/alarmtimer.c+8 -00 replies
3/26alarmtimer: Remove pointless config conditionalkernel/time/alarmtimer.c+1 -20 replies
4/26posix-timers: Remove unused export of posix_timer_event()kernel/time/posix-timers.c+0 -10 replies
5/26posix-clocks: Remove interval timer facility and mmap/fasync callbacksinclude/linux/posix-clock.h kernel/time/posix-clock.c+0 -1351 reply
6/26posix-timers: Avoid gazillions of forward declarationskernel/time/posix-timers.c+89 -1010 replies
7/26posix-timers: Cleanup struct k_itimerinclude/linux/posix-timers.h+40 -210 replies
8/26posix-timers: Move posix-timer internals to coreinclude/linux/posix-timers.h kernel/time/alarmtimer.c kernel/time/posix-clock.c +3 more+16 -111 reply
9/26posix-timers: Unify overrun/requeue_pending handlingkernel/time/posix-cpu-timers.c kernel/time/posix-timers.c+15 -180 replies
10/26posix-timers: Move interval out of the unioninclude/linux/posix-timers.h kernel/time/alarmtimer.c kernel/time/posix-timers.c+18 -190 replies
11/26posix-timers: Store k_clock pointer in k_itimerinclude/linux/posix-timers.h kernel/time/posix-cpu-timers.c kernel/time/posix-timers.c+8 -30 replies
12/26posix-timers: Add timer_rearm() callbackinclude/linux/posix-timers.h+20 -160 replies
13/26posix-timers: Rename do_schedule_next_timerinclude/asm-generic/siginfo.h kernel/signal.c kernel/time/posix-cpu-timers.c +1 more+8 -83 replies
14/26posix-timers: Use timer_rearm() callback in posixtimer_rearm()kernel/time/posix-cpu-timers.c kernel/time/posix-timers.c kernel/time/posix-timers.h+11 -100 replies
15/26posix-timers: Add active flag to k_itimerinclude/linux/posix-timers.h kernel/time/posix-timers.c+9 -10 replies
16/26posix-timers: Add forward/remaining callbacksinclude/linux/posix-timers.h+2 -00 replies
17/26posix-timers: Make use of forward/remaining callbackskernel/time/posix-timers.c+49 -150 replies
18/26posix-timers: Zero settings value in common codekernel/time/posix-cpu-timers.c kernel/time/posix-timers.c+2 -64 replies
19/26posix-timers: Add cancel/arm callbacksinclude/linux/posix-timers.h+3 -00 replies
20/26posix-timers: Make use of cancel/arm callbackskernel/time/posix-timers.c+100 -810 replies
21/26alarmtimer: Implement timer_rearm() callbackkernel/time/alarmtimer.c+14 -10 replies
22/26alarmtimer: Implement forward callbackkernel/time/alarmtimer.c+13 -00 replies
23/26alarmtimer: Implement remaining callbackkernel/time/alarmtimer.c+22 -90 replies
24/26alarmtimer: Implement try_to_cancel callbackkernel/time/alarmtimer.c+10 -00 replies
25/26alarmtimer: Implement arm callbackkernel/time/alarmtimer.c+22 -00 replies
26/26alarmtimer: Switch over to generic set/get/rearm routinekernel/time/alarmtimer.c kernel/time/posix-timers.c kernel/time/posix-timers.h+29 -1100 replies

Reviews trailers per patch

1 of 26 patches has a Reviewed-by or Acked-by.

PatchRichard Cochran
1/26
2/26
3/26
4/26
5/26A-b
6/26
7/26
8/26
9/26
10/26
11/26
12/26
13/26
14/26
15/26
16/26
17/26
18/26
19/26
20/26
21/26
22/26
23/26
24/26
25/26
26/26

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [patch 00/26] alarmtimers/posixtimers: Bug fixes and spec conformity changes

The syzkaller folks reported an RCU stall while fuzzing the posix timer interface with CLOCK_ALARMTIMER_*.

While fixing this issue, I noticed that the posix timer implementation of alarm timers lacks quite some of the features of the regular hrtimer based posix timers.

That makes alarm timer bases posix timer not conform to the spec and also the unconditional self rearming of those timer is suboptimal.

Instead of copying the posix timer hrtimer based mechanism over to alarm timers with the risk of getting out of sync sooner than later, I decided to add a few callbacks to the kclock struct which describes the different posix timer clocks, so the existing and proven to be correct implementation can be reused and we have only one implementation to maintain, aside of the special magic which handles the CPU/PROCESS/THREAD clock ids.

Patch 1/2 are the bugfixes addressing the reported problem (#1) and a similar one (#2) which I detected in review.

Patch 3-8 are cleanups which I put in front of the actual rework, including the removal of unused and prone to be implemnted wrong posix timer callbacks for the dynamic posix clocks.

Patch 9-20 prepare the code in posix-timer.c for sharing and reuse and the remaining patches 21-26 switch the alarm timers over.

Passes LTP and GLIBC tests and a few other test cases I have around.

Thanks,

tglx

---
 b/kernel/time/posix-timers.h   |   13 +
 include/asm-generic/siginfo.h  |    2 
 include/linux/posix-clock.h    |   22 --
 include/linux/posix-timers.h   |  117 ++++++-----
 kernel/signal.c                |    2 
 kernel/time/alarmtimer.c       |  200 +++++++++-----------
 kernel/time/posix-clock.c      |  115 -----------
 kernel/time/posix-cpu-timers.c |   36 +--
 kernel/time/posix-timers.c     |  410 ++++++++++++++++++++++-------------------
 9 files changed, 429 insertions(+), 488 deletions(-)