linux-stable/kernel/time
Ulf Hansson 6f9b83ac87 cpuidle: Export the next timer expiration for CPUs
To be able to predict the sleep duration for a CPU entering idle, it
is essential to know the expiration time of the next timer.  Both the
teo and the menu cpuidle governors already use this information for
CPU idle state selection.

Moving forward, a similar prediction needs to be made for a group of
idle CPUs rather than for a single one and the following changes
implement a new genpd governor for that purpose.

In order to support that feature, add a new function called
tick_nohz_get_next_hrtimer() that will return the next hrtimer
expiration time of a given CPU to be invoked after deciding
whether or not to stop the scheduler tick on that CPU.

Make the cpuidle core call tick_nohz_get_next_hrtimer() right
before invoking the ->enter() callback provided by the cpuidle
driver for the given state and store its return value in the
per-CPU struct cpuidle_device, so as to make it available to code
outside of cpuidle.

Note that at the point when cpuidle calls tick_nohz_get_next_hrtimer(),
the governor's ->select() callback has already returned and indicated
whether or not the tick should be stopped, so in fact the value
returned by tick_nohz_get_next_hrtimer() always is the next hrtimer
expiration time for the given CPU, possibly including the tick (if
it hasn't been stopped).

Co-developed-by: Lina Iyer <lina.iyer@linaro.org>
Co-developed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
[ rjw: Subject & changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-04-10 00:32:34 +02:00
..
alarmtimer.c time: Remove license boilerplate 2018-11-23 11:51:21 +01:00
clockevents.c hrtimers/tick/clockevents: Remove sloppy license references 2018-11-23 11:51:21 +01:00
clocksource.c time: Remove license boilerplate 2018-11-23 11:51:21 +01:00
hrtimer.c Merge branch 'timers-2038-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2019-03-05 14:08:26 -08:00
itimer.c time: Remove useless filenames in top level comments 2018-11-23 11:51:20 +01:00
jiffies.c time/jiffies: Make refined_jiffies static 2019-03-22 13:38:26 +01:00
Kconfig time: Move CONTEXT_TRACKING to kernel/time/Kconfig 2019-01-15 11:16:41 +01:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ntp.c timex: use __kernel_timex internally 2019-02-07 00:13:27 +01:00
ntp_internal.h timex: use __kernel_timex internally 2019-02-07 00:13:27 +01:00
posix-clock.c timex: use __kernel_timex internally 2019-02-07 00:13:27 +01:00
posix-cpu-timers.c posix-cpu-timers: Remove private interval storage 2019-01-15 16:36:13 +01:00
posix-stubs.c y2038: syscalls: rename y2038 compat syscalls 2019-02-07 00:13:27 +01:00
posix-timers.c y2038: syscalls: rename y2038 compat syscalls 2019-02-07 00:13:27 +01:00
posix-timers.h timex: use __kernel_timex internally 2019-02-07 00:13:27 +01:00
sched_clock.c sched/clock: Remove license boilerplate 2018-11-23 11:51:22 +01:00
test_udelay.c time/debug: Remove license boilerplate 2018-11-23 11:51:21 +01:00
tick-broadcast-hrtimer.c time: Remove useless filenames in top level comments 2018-11-23 11:51:20 +01:00
tick-broadcast.c timers: Mark expected switch fall-throughs 2019-01-29 20:08:42 +01:00
tick-common.c hrtimers/tick/clockevents: Remove sloppy license references 2018-11-23 11:51:21 +01:00
tick-internal.h Revert: Unify CLOCK_MONOTONIC and CLOCK_BOOTTIME 2018-04-26 14:53:32 +02:00
tick-oneshot.c hrtimers/tick/clockevents: Remove sloppy license references 2018-11-23 11:51:21 +01:00
tick-sched.c cpuidle: Export the next timer expiration for CPUs 2019-04-10 00:32:34 +02:00
tick-sched.h nohz: Gather tick_sched booleans under a common flag field 2018-04-09 11:54:57 +02:00
time.c y2038: rename old time and utime syscalls 2019-02-07 00:13:28 +01:00
timeconst.bc time: Add SPDX license identifiers 2018-11-23 11:51:20 +01:00
timeconv.c time: Add SPDX license identifiers 2018-11-23 11:51:20 +01:00
timecounter.c time: Remove license boilerplate 2018-11-23 11:51:21 +01:00
timekeeping.c timex: use __kernel_timex internally 2019-02-07 00:13:27 +01:00
timekeeping.h Revert: Unify CLOCK_MONOTONIC and CLOCK_BOOTTIME 2018-04-26 14:53:32 +02:00
timekeeping_debug.c timekeeping/debug: No need to check return value of debugfs_create functions 2019-01-29 20:08:41 +01:00
timekeeping_internal.h timekeeping/ntp: Constify some function arguments 2018-07-19 17:08:05 -07:00
timer.c Merge branch 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2019-03-05 14:49:11 -08:00
timer_list.c hrtimers/tick/clockevents: Remove sloppy license references 2018-11-23 11:51:21 +01:00