summaryrefslogtreecommitdiff
path: root/arch/nds32/kernel/vdso
diff options
context:
space:
mode:
authorVincenzo Frascino <vincenzo.frascino@arm.com>2019-04-01 12:51:51 +0100
committerGreentime Hu <greentime@andestech.com>2019-05-16 15:07:08 +0800
commitaf9abd65983cf3602c03ef3d16fe549ba1f3eeed (patch)
tree165b6a5c5fa21f59a9d89724ae24573d16f106f7 /arch/nds32/kernel/vdso
parent63e07e202997ca01336ac93bf45dfd2c3a6ec512 (diff)
nds32: Fix vDSO clock_getres()
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; and hrtimer_resolution depends on the enablement of the high resolution timers that can happen either at compile or at run time. Fix the nds32 vdso implementation of clock_getres keeping a copy of hrtimer_resolution in vdso data and using that directly. Cc: Greentime Hu <green.hu@gmail.com> Cc: Vincent Chen <deanbo422@gmail.com> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com> Signed-off-by: Greentime Hu <greentime@andestech.com>
Diffstat (limited to 'arch/nds32/kernel/vdso')
-rw-r--r--arch/nds32/kernel/vdso/gettimeofday.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/nds32/kernel/vdso/gettimeofday.c b/arch/nds32/kernel/vdso/gettimeofday.c
index 038721af40e3..b02581891c33 100644
--- a/arch/nds32/kernel/vdso/gettimeofday.c
+++ b/arch/nds32/kernel/vdso/gettimeofday.c
@@ -208,6 +208,8 @@ static notrace int clock_getres_fallback(clockid_t _clk_id,
notrace int __vdso_clock_getres(clockid_t clk_id, struct timespec *res)
{
+ struct vdso_data *vdata = __get_datapage();
+
if (res == NULL)
return 0;
switch (clk_id) {
@@ -215,7 +217,7 @@ notrace int __vdso_clock_getres(clockid_t clk_id, struct timespec *res)
case CLOCK_MONOTONIC:
case CLOCK_MONOTONIC_RAW:
res->tv_sec = 0;
- res->tv_nsec = CLOCK_REALTIME_RES;
+ res->tv_nsec = vdata->hrtimer_res;
break;
case CLOCK_REALTIME_COARSE:
case CLOCK_MONOTONIC_COARSE: