android_kernel_samsung_msm8976/kernel/time
Thomas Gleixner 5b2ec0a38d alarmtimer: Rate limit periodic intervals
commit ff86bf0c65f14346bf2440534f9ba5ac232c39a0 upstream.

The alarmtimer code has another source of potentially rearming itself too
fast. Interval timers with a very samll interval have a similar CPU hog
effect as the previously fixed overflow issue.

The reason is that alarmtimers do not implement the normal protection
against this kind of problem which the other posix timer use:

  timer expires -> queue signal -> deliver signal -> rearm timer

This scheme brings the rearming under scheduler control and prevents
permanently firing timers which hog the CPU.

Bringing this scheme to the alarm timer code is a major overhaul because it
lacks all the necessary mechanisms completely.

So for a quick fix limit the interval to one jiffie. This is not
problematic in practice as alarmtimers are usually backed by an RTC for
suspend which have 1 second resolution. It could be therefor argued that
the resolution of this clock should be set to 1 second in general, but
that's outside the scope of this fix.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Kostya Serebryany <kcc@google.com>
Cc: syzkaller <syzkaller@googlegroups.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Dmitry Vyukov <dvyukov@google.com>
Link: http://lkml.kernel.org/r/20170530211655.896767100@linutronix.de
[bwh: Backported to 3.2:
 - Use ktime_to_ns()/ktime_set() as ktime_t is not scalar
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2019-07-27 21:44:49 +02:00
..
Kconfig
Makefile time: Remove CONFIG_TIMER_STATS 2017-04-22 23:02:59 +02:00
alarmtimer.c alarmtimer: Rate limit periodic intervals 2019-07-27 21:44:49 +02:00
clockevents.c This is the 3.10.67 stable release 2015-04-24 18:04:40 -07:00
clocksource.c
jiffies.c
ntp.c ntp: Fixup adjtimex freq validation on 32-bit systems 2015-03-06 14:40:52 -08:00
ntp_internal.h
posix-clock.c posix-clock: Fix return code on the poll method's error path 2016-03-03 15:06:23 -08:00
sched_clock.c Import latest Samsung release 2017-04-18 03:43:52 +02:00
tick-broadcast-hrtimer.c tick: Introduce hrtimer based broadcast 2014-08-15 11:46:52 -07:00
tick-broadcast.c tick/broadcast: Prevent NULL pointer dereference 2019-07-27 21:43:41 +02:00
tick-common.c clockevents: Move the tick_notify() switch case to clockevents_notify() 2014-08-15 11:46:56 -07:00
tick-internal.h time: Change the return type of clockevents_notify() to integer 2014-08-15 17:20:11 -07:00
tick-oneshot.c
tick-sched.c sched: use ktime instead of sched_clock for load tracking 2015-12-16 13:38:12 +05:30
timeconv.c
timekeeping.c time: Always make sure wall_to_monotonic isn't positive 2017-12-19 00:21:52 -08:00
timer_list.c time: Remove CONFIG_TIMER_STATS 2017-04-22 23:02:59 +02:00