lkml.org 
[lkml]   [2020]   [Feb]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch V2 15/17] lib/vdso: Allow fixed clock mode
From: Christophe Leroy <christophe.leroy@c-s.fr>

Some architectures have a fixed clocksource which is known at compile time
and cannot be replaced or disabled at runtime, e.g. timebase on
PowerPC. For such cases the clock mode check in the VDSO code is pointless.

Move the check for a VDSO capable clocksource into an inline function and
allow architectures to redefine it via a macro.

[ tglx: Removed the #ifdef mess ]

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
lib/vdso/gettimeofday.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

--- a/lib/vdso/gettimeofday.c
+++ b/lib/vdso/gettimeofday.c
@@ -46,6 +46,13 @@ static inline bool __arch_vdso_hres_capa
}
#endif

+#ifndef vdso_clocksource_ok
+static inline bool vdso_clocksource_ok(const struct vdso_data *vd)
+{
+ return vd->clock_mode != VDSO_CLOCKMODE_NONE;
+}
+#endif
+
#ifdef CONFIG_TIME_NS
static int do_hres_timens(const struct vdso_data *vdns, clockid_t clk,
struct __kernel_timespec *ts)
@@ -66,7 +73,7 @@ static int do_hres_timens(const struct v
do {
seq = vdso_read_begin(vd);

- if (unlikely(vd->clock_mode == VDSO_CLOCKMODE_NONE))
+ if (unlikely(!vdso_clocksource_ok(vd)))
return -1;

cycles = __arch_get_hw_counter(vd->clock_mode);
@@ -134,7 +141,7 @@ static __always_inline int do_hres(const
}
smp_rmb();

- if (unlikely(vd->clock_mode == VDSO_CLOCKMODE_NONE))
+ if (unlikely(!vdso_clocksource_ok(vd)))
return -1;

cycles = __arch_get_hw_counter(vd->clock_mode);
\
 
 \ /
  Last update: 2020-02-07 14:27    [W:0.352 / U:0.620 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site