PM-runtime: Switch autosuspend over to using hrtimers
authorVincent Guittot <vincent.guittot@linaro.org>
Fri, 14 Dec 2018 14:22:25 +0000 (15:22 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 19 Dec 2018 09:31:50 +0000 (10:31 +0100)
commit8234f6734c5d74ac794e5517437f51c57d65f865
tree3aadac1af824e3071283ca9bd008eaa5e0980eb0
parent7566ec393f4161572ba6f11ad5171fd5d59b0fbd
PM-runtime: Switch autosuspend over to using hrtimers

PM-runtime uses the timer infrastructure for autosuspend. This implies
that the minimum time before autosuspending a device is in the range
of 1 tick included to 2 ticks excluded
 -On arm64 this means between 4ms and 8ms with default jiffies
  configuration
 -And on arm, it is between 10ms and 20ms

These values are quite high for embedded systems which sometimes want
the duration to be in the range of 1 ms.

It is possible to switch autosuspend over to using hrtimers to get
finer granularity for short durations and take advantage of slack to
retain some margins and get long timeouts with minimum wakeups.

On an arm64 platform that uses 1ms for autosuspending timeout of its
GPU, idle power is reduced by 10% with hrtimer.

The latency impact on arm64 hikey octo cores is:
 - mark_last_busy: from 1.11 us to 1.25 us
 - rpm_suspend: from 15.54 us to 15.38 us
[Only the code path of rpm_suspend() that starts hrtimer has been
measured.]

arm64 image (arm64 default defconfig) decreases by around 3KB
with following details:

$ size vmlinux-timer
   text    data     bss     dec     hex filename
12034646 6869268  386840 19290754 1265a82 vmlinux

$ size vmlinux-hrtimer
   text    data     bss     dec     hex filename
12030550 6870164  387032 19287746 1264ec2 vmlinux

The latency impact on arm 32bits snowball dual cores is :
 - mark_last_busy: from 0.31 us usec to 0.77 us
 - rpm_suspend: from 6.83 us to 6.67 usec

The increase of the image for snowball platform that I used for
testing performance impact, is neglictable (244B).

$ size vmlinux-timer
   text    data     bss     dec     hex filename
7157961 2119580  264120 9541661  91981d build-ux500/vmlinux

size vmlinux-hrtimer
   text    data     bss     dec     hex filename
7157773 2119884  264248 9541905  919911 vmlinux-hrtimer

And arm 32bits image (multi_v7_defconfig) increases by around 1.7KB
with following details:

$ size vmlinux-timer
   text    data     bss     dec     hex filename
13304443 6803420  402768 20510631 138f7a7 vmlinux

$ size vmlinux-hrtimer
   text    data     bss     dec     hex filename
13304299 6805276  402768 20512343 138fe57 vmlinux

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/base/power/runtime.c
include/linux/pm.h
include/linux/pm_runtime.h