提交 ae12e085 编写于 作者: C Christophe Leroy 提交者: Thomas Gleixner

lib/vdso: Allow fixed clock mode

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: NChristophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
Tested-by: NVincenzo Frascino <vincenzo.frascino@arm.com>
Reviewed-by: NVincenzo Frascino <vincenzo.frascino@arm.com>
Link: https://lkml.kernel.org/r/20200207124403.748756829@linutronix.de

上级 2d6b01bd
...@@ -46,6 +46,13 @@ static inline bool __arch_vdso_hres_capable(void) ...@@ -46,6 +46,13 @@ static inline bool __arch_vdso_hres_capable(void)
} }
#endif #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 #ifdef CONFIG_TIME_NS
static int do_hres_timens(const struct vdso_data *vdns, clockid_t clk, static int do_hres_timens(const struct vdso_data *vdns, clockid_t clk,
struct __kernel_timespec *ts) struct __kernel_timespec *ts)
...@@ -66,7 +73,7 @@ static int do_hres_timens(const struct vdso_data *vdns, clockid_t clk, ...@@ -66,7 +73,7 @@ static int do_hres_timens(const struct vdso_data *vdns, clockid_t clk,
do { do {
seq = vdso_read_begin(vd); seq = vdso_read_begin(vd);
if (unlikely(vd->clock_mode == VDSO_CLOCKMODE_NONE)) if (unlikely(!vdso_clocksource_ok(vd)))
return -1; return -1;
cycles = __arch_get_hw_counter(vd->clock_mode); cycles = __arch_get_hw_counter(vd->clock_mode);
...@@ -134,7 +141,7 @@ static __always_inline int do_hres(const struct vdso_data *vd, clockid_t clk, ...@@ -134,7 +141,7 @@ static __always_inline int do_hres(const struct vdso_data *vd, clockid_t clk,
} }
smp_rmb(); smp_rmb();
if (unlikely(vd->clock_mode == VDSO_CLOCKMODE_NONE)) if (unlikely(!vdso_clocksource_ok(vd)))
return -1; return -1;
cycles = __arch_get_hw_counter(vd->clock_mode); cycles = __arch_get_hw_counter(vd->clock_mode);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册