• Vincent Guittot's avatar
    PM-runtime: Switch autosuspend over to using hrtimers · 8234f673
    Vincent Guittot authored
    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	21198846	 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: default avatarVincent Guittot <vincent.guittot@linaro.org>
    Reviewed-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    8234f673
runtime.c 47.2 KB