• Thomas Gleixner's avatar
    posix-cpu-timers: Unbreak timer rearming · 93ad0fc0
    Thomas Gleixner authored
    The recent commit which prevented a division by 0 issue in the alarm timer
    code broke posix CPU timers as an unwanted side effect.
    
    The reason is that the common rearm code checks for timer->it_interval
    being 0 now. What went unnoticed is that the posix cpu timer setup does not
    initialize timer->it_interval as it stores the interval in CPU timer
    specific storage. The reason for the separate storage is historical as the
    posix CPU timers always had a 64bit nanoseconds representation internally
    while timer->it_interval is type ktime_t which used to be a modified
    timespec representation on 32bit machines.
    
    Instead of reverting the offending commit and fixing the alarmtimer issue
    in the alarmtimer code, store the interval in timer->it_interval at CPU
    timer setup time so the common code check works. This also repairs the
    existing inconistency of the posix CPU timer code which kept a single shot
    timer armed despite of the interval being 0.
    
    The separate storage can be removed in mainline, but that needs to be a
    separate commit as the current one has to be backported to stable kernels.
    
    Fixes: 0e334db6 ("posix-timers: Fix division by zero bug")
    Reported-by: H.J. Lu's avatarH.J. Lu <hjl.tools@gmail.com>
    Signed-off-by: 's avatarThomas Gleixner <tglx@linutronix.de>
    Cc: John Stultz <john.stultz@linaro.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190111133500.840117406@linutronix.de
    93ad0fc0
Name
Last commit
Last update
..
Kconfig Loading commit data...
Makefile Loading commit data...
alarmtimer.c Loading commit data...
clockevents.c Loading commit data...
clocksource.c Loading commit data...
hrtimer.c Loading commit data...
itimer.c Loading commit data...
jiffies.c Loading commit data...
ntp.c Loading commit data...
ntp_internal.h Loading commit data...
posix-clock.c Loading commit data...
posix-cpu-timers.c Loading commit data...
posix-stubs.c Loading commit data...
posix-timers.c Loading commit data...
posix-timers.h Loading commit data...
sched_clock.c Loading commit data...
test_udelay.c Loading commit data...
tick-broadcast-hrtimer.c Loading commit data...
tick-broadcast.c Loading commit data...
tick-common.c Loading commit data...
tick-internal.h Loading commit data...
tick-oneshot.c Loading commit data...
tick-sched.c Loading commit data...
tick-sched.h Loading commit data...
time.c Loading commit data...
timeconst.bc Loading commit data...
timeconv.c Loading commit data...
timecounter.c Loading commit data...
timekeeping.c Loading commit data...
timekeeping.h Loading commit data...
timekeeping_debug.c Loading commit data...
timekeeping_internal.h Loading commit data...
timer.c Loading commit data...
timer_list.c Loading commit data...