arm+arm64: vdso: Add support for CLOCK_BOOTTIME
Subsystems (2)
PATCH v2 10/10 arm+arm64: vdso: Add support for CLOCK_BOOTTIME
Add a case for CLOCK_BOOTTIME as it is popular for measuring relative time on systems expected to suspend() or hibernate().
Signed-off-by Mark Salyzyn <[email protected]>
v2: rebased and changed from 3/3 to 10/10, fortified commit message.
--- arch/arm/include/asm/vdso_datapage.h | 1 + arch/arm/kernel/vdso.c | 1 + arch/arm/vdso/vgettimeofday.c | 56 ++++++++++++++++++++++++++++++++++ arch/arm64/include/asm/vdso_datapage.h | 1 + arch/arm64/kernel/vdso.c | 1 + 5 files changed, 60 insertions(+)
arch/arm/include/asm/vdso_datapage.h +1 -0
@@ -47,6 +47,7 @@ struct vdso_data {u32 tz_minuteswest;/* timezone info for gettimeofday(2) */ u32 tz_dsttime; +u64 btm_nsec;/* monotonic to boot time */ u32 cs_raw_mult;/* Raw clocksource multipler */ u32 raw_time_sec;/* Raw time */ u32 raw_time_nsec;
arch/arm/kernel/vdso.c +1 -0
@@ -347,6 +347,7 @@ void update_vsyscall(struct timekeeper *tk)/* tkr_mono.shift == tkr_raw.shift */ vdso_data->cs_shift = tk->tkr_mono.shift; vdso_data->cs_mask = tk->tkr_mono.mask; + vdso_data->btm_nsec =ktime_to_ns (tk->offs_boot); }vdso_write_end (vdso_data);
arch/arm/vdso/vgettimeofday.c +56 -0
80 lines not on this page · raw message
arch/arm64/include/asm/vdso_datapage.h +1 -0
@@ -30,6 +30,7 @@ struct vdso_data {__u64 xtime_coarse_nsec;__u64 wtm_clock_sec;/* Wall to monotonic time */ __u64 wtm_clock_nsec; +__u64 btm_nsec;/* monotonic to boot time */ __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 */
arch/arm64/kernel/vdso.c +1 -0
@@ -243,6 +243,7 @@ void update_vsyscall(struct timekeeper *tk) vdso_data->cs_raw_mult = tk->tkr_raw.mult;/* tkr_mono.shift == tkr_raw.shift */ vdso_data->cs_shift = tk->tkr_mono.shift; + vdso_data->btm_nsec =ktime_to_ns (tk->offs_boot); }smp_wmb ();
Signature · 1 line
2.15.0.rc0.271.g36b669edcc-goog
Hi Mark,
Quoted 5 lines · Mark Salyzyn
Add a case for
CLOCK_BOOTTIMEas it is popular for measuring relative time on systems expected tosuspend()orhibernate().Signed-off-by Mark Salyzyn <[email protected]>
Quoted 8 lines
v2: rebased and changed from 3/3 to 10/10, fortified commit message.
--- arch/arm/include/asm/vdso_datapage.h | 1 + arch/arm/kernel/vdso.c | 1 + arch/arm/vdso/vgettimeofday.c | 56 ++++++++++++++++++++++++++++++++++ arch/arm64/include/asm/vdso_datapage.h | 1 + arch/arm64/kernel/vdso.c | 1 + 5 files changed, 60 insertions(+)
Can you elaborate a bit on the use-case for CLOCK_BOOTTIME, please, so that we can justify accelerating it in the vDSO?
Thanks,
Will