Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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



authored by

Christophe Leroy and committed by
Thomas Gleixner
ae12e085 2d6b01bd

+9 -2
+9 -2
lib/vdso/gettimeofday.c
··· 46 46 } 47 47 #endif 48 48 49 + #ifndef vdso_clocksource_ok 50 + static inline bool vdso_clocksource_ok(const struct vdso_data *vd) 51 + { 52 + return vd->clock_mode != VDSO_CLOCKMODE_NONE; 53 + } 54 + #endif 55 + 49 56 #ifdef CONFIG_TIME_NS 50 57 static int do_hres_timens(const struct vdso_data *vdns, clockid_t clk, 51 58 struct __kernel_timespec *ts) ··· 73 66 do { 74 67 seq = vdso_read_begin(vd); 75 68 76 - if (unlikely(vd->clock_mode == VDSO_CLOCKMODE_NONE)) 69 + if (unlikely(!vdso_clocksource_ok(vd))) 77 70 return -1; 78 71 79 72 cycles = __arch_get_hw_counter(vd->clock_mode); ··· 141 134 } 142 135 smp_rmb(); 143 136 144 - if (unlikely(vd->clock_mode == VDSO_CLOCKMODE_NONE)) 137 + if (unlikely(!vdso_clocksource_ok(vd))) 145 138 return -1; 146 139 147 140 cycles = __arch_get_hw_counter(vd->clock_mode);