Skip to content

Commit 576094b

Browse files
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>
1 parent 7063942 commit 576094b

File tree

3 files changed

+34
-20
lines changed

3 files changed

+34
-20
lines changed

include/linux/timekeeper_internal.h

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,38 @@ struct timekeeper {
6666
seqlock_t lock;
6767
};
6868

69+
static inline struct timespec tk_xtime(struct timekeeper *tk)
70+
{
71+
struct timespec ts;
72+
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);
82+
extern void update_vsyscall_tz(void);
6983

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);
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);
7488
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+
7598
#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)
79101
{
80102
}
81103
static inline void update_vsyscall_tz(void)

kernel/time/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ config CLOCKSOURCE_WATCHDOG
1212
config ARCH_CLOCKSOURCE_DATA
1313
bool
1414

15+
# Timekeeping vsyscall support
16+
config GENERIC_TIME_VSYSCALL
17+
bool
18+
1519
# Timekeeping vsyscall support
1620
config GENERIC_TIME_VSYSCALL_OLD
1721
bool

kernel/time/timekeeping.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,6 @@ static inline void tk_normalize_xtime(struct timekeeper *tk)
4242
}
4343
}
4444

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-
5445
static void tk_set_xtime(struct timekeeper *tk, const struct timespec *ts)
5546
{
5647
tk->xtime_sec = ts->tv_sec;
@@ -192,14 +183,11 @@ static inline s64 timekeeping_get_ns_raw(struct timekeeper *tk)
192183
/* must hold write on timekeeper.lock */
193184
static void timekeeping_update(struct timekeeper *tk, bool clearntp)
194185
{
195-
struct timespec xt;
196-
197186
if (clearntp) {
198187
tk->ntp_error = 0;
199188
ntp_clear();
200189
}
201-
xt = tk_xtime(tk);
202-
update_vsyscall_old(&xt, &tk->wall_to_monotonic, tk->clock, tk->mult);
190+
update_vsyscall(tk);
203191
}
204192

205193
/**

0 commit comments

Comments
 (0)