[PATCH v5] powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE

Naveen N. Rao naveen.n.rao at linux.vnet.ibm.com
Wed Oct 11 19:49:51 AEDT 2017


On 2017/10/11 08:35AM, Santosh Sivaraj wrote:
> Current vDSO64 implementation does not have support for coarse clocks
> (CLOCK_MONOTONIC_COARSE, CLOCK_REALTIME_COARSE), for which it falls back
> to system call, increasing the response time, vDSO implementation reduces
> the cycle time. Below is a benchmark of the difference in execution times.
> 
> (Non-coarse clocks are also included just for completion)
> 
> clock-gettime-realtime: syscall: 172 nsec/call
> clock-gettime-realtime:    libc: 28 nsec/call
> clock-gettime-realtime:    vdso: 22 nsec/call
> clock-gettime-monotonic: syscall: 171 nsec/call
> clock-gettime-monotonic:    libc: 30 nsec/call
> clock-gettime-monotonic:    vdso: 25 nsec/call
> clock-gettime-realtime-coarse: syscall: 153 nsec/call
> clock-gettime-realtime-coarse:    libc: 16 nsec/call
> clock-gettime-realtime-coarse:    vdso: 10 nsec/call
> clock-gettime-monotonic-coarse: syscall: 167 nsec/call
> clock-gettime-monotonic-coarse:    libc: 17 nsec/call
> clock-gettime-monotonic-coarse:    vdso: 11 nsec/call
> 
> CC: Benjamin Herrenschmidt <benh at kernel.crashing.org>
> Signed-off-by: Santosh Sivaraj <santosh at fossix.org>
> ---
> Changelog:
> v1:
> - gettimeofday was moved from asm to C
> - Coarse timer support addition
> v2:
> - Moved Syscall fallback from inline assembly back to its original place in
>   __kernel_clock_gettime
> v3:
> - Based on Ben's input, coarse timer support was added in assembly itself
> - Dropped idea of conversion to C due to the vdso update_count variable
>   being optimized out in C
> v4:
> - Based on Naveen's comments restructured code to avoid a duplicate code
>   block
> v5:
> - Skip creating dependency for registers that are not used for
>   CLOCK_REALTIME_COARSE (Naveen)
> - Reorder instructions to get proper dependency setup (Naveen)
> 
>  arch/powerpc/kernel/asm-offsets.c         |  2 +
>  arch/powerpc/kernel/vdso64/gettimeofday.S | 68 ++++++++++++++++++++++++++-----
>  2 files changed, 59 insertions(+), 11 deletions(-)

Looks good to me.
Reviewed-by: Naveen N. Rao <naveen.n.rao at linux.vnet.ibm.com>



More information about the Linuxppc-dev mailing list