mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
UPSTREAM: 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
(cherry picked from commit 1dff4156d1)
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 154668398
Change-Id: Ib024363345b8d75ffc78b3e5598a5720926f9358
This commit is contained in:
committed by
Alistair Delva
parent
63bc2c97b7
commit
e8af599d42
@@ -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
|
||||
|
||||
static __always_inline int do_hres(const struct vdso_data *vd, clockid_t clk,
|
||||
struct __kernel_timespec *ts)
|
||||
{
|
||||
@@ -45,6 +52,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 {
|
||||
seq = vdso_read_begin(vd);
|
||||
cycles = __arch_get_hw_counter(vd->clock_mode);
|
||||
|
||||
Reference in New Issue
Block a user