summaryrefslogtreecommitdiff
path: root/lib/vdso
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2020-02-07 13:38:50 +0100
committerThomas Gleixner <tglx@linutronix.de>2020-02-17 14:40:20 +0100
commit1dff4156d1f63b525c54aea7f097a657cbbbf837 (patch)
treef337a9758f5a7f446ee75cea7db6d47febb61838 /lib/vdso
parent78560d41064ad3d377e3d1a1ee87526301f4e946 (diff)
lib/vdso: Allow the high resolution parts to be compiled out
If the architecture knows at compile time that there is no VDSO capable clocksource supported it makes sense to optimize the guts of the high resolution parts of the VDSO out at build time. Add a helper function to check whether the VDSO should be high resolution capable and provide a stub which can be overridden by an architecture. 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/20200207124402.530143168@linutronix.de
Diffstat (limited to 'lib/vdso')
-rw-r--r--lib/vdso/gettimeofday.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c
index f8b8ec5e63ac..5804e4e168e7 100644
--- a/lib/vdso/gettimeofday.c
+++ b/lib/vdso/gettimeofday.c
@@ -38,6 +38,13 @@ u64 vdso_calc_delta(u64 cycles, u64 last, u64 mask, u32 mult)
}
#endif
+#ifndef __arch_vdso_hres_capable
+static inline bool __arch_vdso_hres_capable(void)
+{
+ return true;
+}
+#endif
+
#ifdef CONFIG_TIME_NS
static int do_hres_timens(const struct vdso_data *vdns, clockid_t clk,
struct __kernel_timespec *ts)
@@ -101,6 +108,10 @@ static __always_inline int do_hres(const struct vdso_data *vd, clockid_t clk,
u64 cycles, last, sec, ns;
u32 seq;
+ /* Allows to compile the high resolution parts out */
+ if (!__arch_vdso_hres_capable())
+ return -1;
+
do {
/*
* Open coded to handle VCLOCK_TIMENS. Time namespace