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

time: Introduce new GENERIC_TIME_VSYSCALL

Now that we moved everyone over to GENERIC_TIME_VSYSCALL_OLD,
introduce the new declaration and config option for the new
update_vsyscall method.

Cc: Tony Luck <tony.luck@intel.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Paul Turner <pjt@google.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: John Stultz <john.stultz@linaro.org>

+34 -20
+29 -7
include/linux/timekeeper_internal.h
··· 66 66 seqlock_t lock; 67 67 }; 68 68 69 + static inline struct timespec tk_xtime(struct timekeeper *tk) 70 + { 71 + struct timespec ts; 69 72 70 - #ifdef CONFIG_GENERIC_TIME_VSYSCALL_OLD 71 - extern void 72 - update_vsyscall_old(struct timespec *ts, struct timespec *wtm, 73 - struct clocksource *c, u32 mult); 73 + ts.tv_sec = tk->xtime_sec; 74 + ts.tv_nsec = (long)(tk->xtime_nsec >> tk->shift); 75 + return ts; 76 + } 77 + 78 + 79 + #ifdef CONFIG_GENERIC_TIME_VSYSCALL 80 + 81 + extern void update_vsyscall(struct timekeeper *tk); 74 82 extern void update_vsyscall_tz(void); 83 + 84 + #elif defined(CONFIG_GENERIC_TIME_VSYSCALL_OLD) 85 + 86 + extern void update_vsyscall_old(struct timespec *ts, struct timespec *wtm, 87 + struct clocksource *c, u32 mult); 88 + extern void update_vsyscall_tz(void); 89 + 90 + static inline void update_vsyscall(struct timekeeper *tk) 91 + { 92 + struct timespec xt; 93 + 94 + xt = tk_xtime(tk); 95 + update_vsyscall_old(&xt, &tk->wall_to_monotonic, tk->clock, tk->mult); 96 + } 97 + 75 98 #else 76 - static inline void 77 - update_vsyscall_old(struct timespec *ts, struct timespec *wtm, 78 - struct clocksource *c, u32 mult) 99 + 100 + static inline void update_vsyscall(struct timekeeper *tk) 79 101 { 80 102 } 81 103 static inline void update_vsyscall_tz(void)
+4
kernel/time/Kconfig
··· 13 13 bool 14 14 15 15 # Timekeeping vsyscall support 16 + config GENERIC_TIME_VSYSCALL 17 + bool 18 + 19 + # Timekeeping vsyscall support 16 20 config GENERIC_TIME_VSYSCALL_OLD 17 21 bool 18 22
+1 -13
kernel/time/timekeeping.c
··· 42 42 } 43 43 } 44 44 45 - static struct timespec tk_xtime(struct timekeeper *tk) 46 - { 47 - struct timespec ts; 48 - 49 - ts.tv_sec = tk->xtime_sec; 50 - ts.tv_nsec = (long)(tk->xtime_nsec >> tk->shift); 51 - return ts; 52 - } 53 - 54 45 static void tk_set_xtime(struct timekeeper *tk, const struct timespec *ts) 55 46 { 56 47 tk->xtime_sec = ts->tv_sec; ··· 183 192 /* must hold write on timekeeper.lock */ 184 193 static void timekeeping_update(struct timekeeper *tk, bool clearntp) 185 194 { 186 - struct timespec xt; 187 - 188 195 if (clearntp) { 189 196 tk->ntp_error = 0; 190 197 ntp_clear(); 191 198 } 192 - xt = tk_xtime(tk); 193 - update_vsyscall_old(&xt, &tk->wall_to_monotonic, tk->clock, tk->mult); 199 + update_vsyscall(tk); 194 200 } 195 201 196 202 /**