mirror of
https://github.com/torvalds/linux.git
synced 2024-12-27 05:11:48 +00:00
49eea433b3
So far the arm64 clock_gettime() vDSO implementation only supported the following clocks, falling back to the syscall for the others: - CLOCK_REALTIME{,_COARSE} - CLOCK_MONOTONIC{,_COARSE} This patch adds support for the CLOCK_MONOTONIC_RAW clock, taking advantage of the recent refactoring of the vDSO time functions. Like the non-_COARSE clocks, this only works when the "arch_sys_counter" clocksource is in use (allowing us to read the current time from the virtual counter register), otherwise we also have to fall back to the syscall. Most of the data is shared with CLOCK_MONOTONIC, and the algorithm is similar. The reference implementation in kernel/time/timekeeping.c shows that: - CLOCK_MONOTONIC = tk->wall_to_monotonic + tk->xtime_sec + timekeeping_get_ns(&tk->tkr_mono) - CLOCK_MONOTONIC_RAW = tk->raw_time + timekeeping_get_ns(&tk->tkr_raw) - tkr_mono and tkr_raw are identical (in particular, same clocksource), except these members: * mult (only mono's multiplier is NTP-adjusted) * xtime_nsec (always 0 for raw) Therefore, tk->raw_time and tkr_raw->mult are now also stored in the vDSO data page. Cc: Ali Saidi <ali.saidi@arm.com> Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com> Reviewed-by: Dave Martin <dave.martin@arm.com> Acked-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
48 lines
1.5 KiB
C
48 lines
1.5 KiB
C
/*
|
|
* Copyright (C) 2012 ARM Limited
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
#ifndef __ASM_VDSO_DATAPAGE_H
|
|
#define __ASM_VDSO_DATAPAGE_H
|
|
|
|
#ifdef __KERNEL__
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
struct vdso_data {
|
|
__u64 cs_cycle_last; /* Timebase at clocksource init */
|
|
__u64 raw_time_sec; /* Raw time */
|
|
__u64 raw_time_nsec;
|
|
__u64 xtime_clock_sec; /* Kernel time */
|
|
__u64 xtime_clock_nsec;
|
|
__u64 xtime_coarse_sec; /* Coarse time */
|
|
__u64 xtime_coarse_nsec;
|
|
__u64 wtm_clock_sec; /* Wall to monotonic time */
|
|
__u64 wtm_clock_nsec;
|
|
__u32 tb_seq_count; /* Timebase sequence counter */
|
|
/* cs_* members must be adjacent and in this order (ldp accesses) */
|
|
__u32 cs_mono_mult; /* NTP-adjusted clocksource multiplier */
|
|
__u32 cs_shift; /* Clocksource shift (mono = raw) */
|
|
__u32 cs_raw_mult; /* Raw clocksource multiplier */
|
|
__u32 tz_minuteswest; /* Whacky timezone stuff */
|
|
__u32 tz_dsttime;
|
|
__u32 use_syscall;
|
|
};
|
|
|
|
#endif /* !__ASSEMBLY__ */
|
|
|
|
#endif /* __KERNEL__ */
|
|
|
|
#endif /* __ASM_VDSO_DATAPAGE_H */
|