arm64: vdso: Fix clock_getres() for CLOCK_REALTIME
authorVincenzo Frascino <vincenzo.frascino@arm.com>
Tue, 16 Apr 2019 16:14:30 +0000 (17:14 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 31 May 2019 13:46:21 +0000 (06:46 -0700)
commitb0f6ac8c81e078a2a8277fc4a6e62322d12b39fa
treee5876c30b9dd2cf04b418a87c295f0c3d2f30357
parent9082058b549ac2a5755370a333289905959d1c39
arm64: vdso: Fix clock_getres() for CLOCK_REALTIME

[ Upstream commit 81fb8736dd81da3fe94f28968dac60f392ec6746 ]

clock_getres() in the vDSO library has to preserve the same behaviour
of posix_get_hrtimer_res().

In particular, posix_get_hrtimer_res() does:

    sec = 0;
    ns = hrtimer_resolution;

where 'hrtimer_resolution' depends on whether or not high resolution
timers are enabled, which is a runtime decision.

The vDSO incorrectly returns the constant CLOCK_REALTIME_RES. Fix this
by exposing 'hrtimer_resolution' in the vDSO datapage and returning that
instead.

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
[will: Use WRITE_ONCE(), move adr off COARSE path, renumber labels, use 'w' reg]
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/arm64/include/asm/vdso_datapage.h
arch/arm64/kernel/asm-offsets.c
arch/arm64/kernel/vdso.c
arch/arm64/kernel/vdso/gettimeofday.S