[PATCH 07/27] arm64: Substitute gettimeofday with C implementation
From: vincenzo.frascino@arm.com (Vincenzo Frascino)
Date: 2018-11-14 10:22:52
Also in:
linux-arch
Hi David, thank you for reviewing my code. On 10/11/2018 00:29, David Miller wrote:
From: Vincenzo Frascino <vincenzo.frascino@arm.com> Date: Fri, 9 Nov 2018 12:37:10 +0000quoted
To take advantage of the commonly defined vdso interface for gettimeofday the architectural code requires an adaptation. This patch re-implements the gettimeofday vdso in C in order to use lib/vdso. With the new implementation arm64 gains support for CLOCK_BOOTTIME, CLOCK_TAI and __kernel_time. Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <redacted> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>What is the performance penalty for going to C from ASM like this? I like the vDSO consolidation, but actually I think it makes a lot of sense to implement these things in assembler with some C implementation as guidance or for architectures that haven't optimized into an ASM version yet. I'd also like to see if we can somehow make PowerPC's optimizations in this area usable in more places. It defines a reciprocal in order to use a multiply instead of a divide after capturing the time values.quoted
I say all of this because I want to do something similar on sparc, andhaving a generic implementation of all of the math would make that easier for me and other architecture maintainers who might want to do the same.
I did run some benchmarks on arm64 with both vdsotest-bench (I added a script to the vdsotest implementation that can be used to replicate the results) and an ad-hoc test that stresses the vdso library and the differences in terms of performance penalty are very little (~1%) to none in some cases. -- Regards, Vincenzo