aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Stultz <johnstul@us.ibm.com>2010-07-13 20:56:23 -0400
committerThomas Gleixner <tglx@linutronix.de>2010-07-27 06:40:54 -0400
commit7615856ebfee52b080c22d263ca4debbd0df0ac1 (patch)
treebeb06e60af7560c28d5bad41f03a5238636e91fc
parent06d518e3dfb25334282c7e38b4d7a4eada215f6d (diff)
timkeeping: Fix update_vsyscall to provide wall_to_monotonic offset
update_vsyscall() did not provide the wall_to_monotoinc offset, so arch specific implementations tend to reference wall_to_monotonic directly. This limits future cleanups in the timekeeping core, so this patch fixes the update_vsyscall interface to provide wall_to_monotonic, allowing wall_to_monotonic to be made static as planned in Documentation/feature-removal-schedule.txt Signed-off-by: John Stultz <johnstul@us.ibm.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Anton Blanchard <anton@samba.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Tony Luck <tony.luck@intel.com> LKML-Reference: <1279068988-21864-7-git-send-email-johnstul@us.ibm.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--arch/ia64/kernel/time.c7
-rw-r--r--arch/powerpc/kernel/time.c8
-rw-r--r--arch/s390/kernel/time.c8
-rw-r--r--arch/x86/kernel/vsyscall_64.c6
-rw-r--r--include/linux/clocksource.h6
-rw-r--r--kernel/time/timekeeping.c9
6 files changed, 25 insertions, 19 deletions
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index 653b3c46ea82..ed6f22eb5b12 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -471,7 +471,8 @@ void update_vsyscall_tz(void)
471{ 471{
472} 472}
473 473
474void update_vsyscall(struct timespec *wall, struct clocksource *c, u32 mult) 474void update_vsyscall(struct timespec *wall, struct timespec *wtm,
475 struct clocksource *c, u32 mult)
475{ 476{
476 unsigned long flags; 477 unsigned long flags;
477 478
@@ -487,9 +488,9 @@ void update_vsyscall(struct timespec *wall, struct clocksource *c, u32 mult)
487 /* copy kernel time structures */ 488 /* copy kernel time structures */
488 fsyscall_gtod_data.wall_time.tv_sec = wall->tv_sec; 489 fsyscall_gtod_data.wall_time.tv_sec = wall->tv_sec;
489 fsyscall_gtod_data.wall_time.tv_nsec = wall->tv_nsec; 490 fsyscall_gtod_data.wall_time.tv_nsec = wall->tv_nsec;
490 fsyscall_gtod_data.monotonic_time.tv_sec = wall_to_monotonic.tv_sec 491 fsyscall_gtod_data.monotonic_time.tv_sec = wtm->tv_sec
491 + wall->tv_sec; 492 + wall->tv_sec;
492 fsyscall_gtod_data.monotonic_time.tv_nsec = wall_to_monotonic.tv_nsec 493 fsyscall_gtod_data.monotonic_time.tv_nsec = wtm->tv_nsec
493 + wall->tv_nsec; 494 + wall->tv_nsec;
494 495
495 /* normalize */ 496 /* normalize */
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 0711d60f40b0..e215f76bba1c 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -849,8 +849,8 @@ static cycle_t timebase_read(struct clocksource *cs)
849 return (cycle_t)get_tb(); 849 return (cycle_t)get_tb();
850} 850}
851 851
852void update_vsyscall(struct timespec *wall_time, struct clocksource *clock, 852void update_vsyscall(struct timespec *wall_time, struct timespec *wtm,
853 u32 mult) 853 struct clocksource *clock, u32 mult)
854{ 854{
855 u64 new_tb_to_xs, new_stamp_xsec; 855 u64 new_tb_to_xs, new_stamp_xsec;
856 856
@@ -882,8 +882,8 @@ void update_vsyscall(struct timespec *wall_time, struct clocksource *clock,
882 vdso_data->tb_orig_stamp = clock->cycle_last; 882 vdso_data->tb_orig_stamp = clock->cycle_last;
883 vdso_data->stamp_xsec = new_stamp_xsec; 883 vdso_data->stamp_xsec = new_stamp_xsec;
884 vdso_data->tb_to_xs = new_tb_to_xs; 884 vdso_data->tb_to_xs = new_tb_to_xs;
885 vdso_data->wtom_clock_sec = wall_to_monotonic.tv_sec; 885 vdso_data->wtom_clock_sec = wtm->tv_sec;
886 vdso_data->wtom_clock_nsec = wall_to_monotonic.tv_nsec; 886 vdso_data->wtom_clock_nsec = wtm->tv_nsec;
887 vdso_data->stamp_xtime = *wall_time; 887 vdso_data->stamp_xtime = *wall_time;
888 smp_wmb(); 888 smp_wmb();
889 ++(vdso_data->tb_update_count); 889 ++(vdso_data->tb_update_count);
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index a2163c95eb98..aeb30c6f279c 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -207,8 +207,8 @@ struct clocksource * __init clocksource_default_clock(void)
207 return &clocksource_tod; 207 return &clocksource_tod;
208} 208}
209 209
210void update_vsyscall(struct timespec *wall_time, struct clocksource *clock, 210void update_vsyscall(struct timespec *wall_time, struct timespec *wtm,
211 u32 mult) 211 struct clocksource *clock, u32 mult)
212{ 212{
213 if (clock != &clocksource_tod) 213 if (clock != &clocksource_tod)
214 return; 214 return;
@@ -219,8 +219,8 @@ void update_vsyscall(struct timespec *wall_time, struct clocksource *clock,
219 vdso_data->xtime_tod_stamp = clock->cycle_last; 219 vdso_data->xtime_tod_stamp = clock->cycle_last;
220 vdso_data->xtime_clock_sec = wall_time->tv_sec; 220 vdso_data->xtime_clock_sec = wall_time->tv_sec;
221 vdso_data->xtime_clock_nsec = wall_time->tv_nsec; 221 vdso_data->xtime_clock_nsec = wall_time->tv_nsec;
222 vdso_data->wtom_clock_sec = wall_to_monotonic.tv_sec; 222 vdso_data->wtom_clock_sec = wtm->tv_sec;
223 vdso_data->wtom_clock_nsec = wall_to_monotonic.tv_nsec; 223 vdso_data->wtom_clock_nsec = wtm->tv_nsec;
224 vdso_data->ntp_mult = mult; 224 vdso_data->ntp_mult = mult;
225 smp_wmb(); 225 smp_wmb();
226 ++vdso_data->tb_update_count; 226 ++vdso_data->tb_update_count;
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index dce0c3c5a787..dcbb28c4b694 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
@@ -73,8 +73,8 @@ void update_vsyscall_tz(void)
73 write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags); 73 write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags);
74} 74}
75 75
76void update_vsyscall(struct timespec *wall_time, struct clocksource *clock, 76void update_vsyscall(struct timespec *wall_time, struct timespec *wtm,
77 u32 mult) 77 struct clocksource *clock, u32 mult)
78{ 78{
79 unsigned long flags; 79 unsigned long flags;
80 80
@@ -87,7 +87,7 @@ void update_vsyscall(struct timespec *wall_time, struct clocksource *clock,
87 vsyscall_gtod_data.clock.shift = clock->shift; 87 vsyscall_gtod_data.clock.shift = clock->shift;
88 vsyscall_gtod_data.wall_time_sec = wall_time->tv_sec; 88 vsyscall_gtod_data.wall_time_sec = wall_time->tv_sec;
89 vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec; 89 vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec;
90 vsyscall_gtod_data.wall_to_monotonic = wall_to_monotonic; 90 vsyscall_gtod_data.wall_to_monotonic = *wtm;
91 vsyscall_gtod_data.wall_time_coarse = __current_kernel_time(); 91 vsyscall_gtod_data.wall_time_coarse = __current_kernel_time();
92 write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags); 92 write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags);
93} 93}
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 5ea3c60c160c..21677d99a161 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -313,11 +313,13 @@ clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec)
313 313
314#ifdef CONFIG_GENERIC_TIME_VSYSCALL 314#ifdef CONFIG_GENERIC_TIME_VSYSCALL
315extern void 315extern void
316update_vsyscall(struct timespec *ts, struct clocksource *c, u32 mult); 316update_vsyscall(struct timespec *ts, struct timespec *wtm,
317 struct clocksource *c, u32 mult);
317extern void update_vsyscall_tz(void); 318extern void update_vsyscall_tz(void);
318#else 319#else
319static inline void 320static inline void
320update_vsyscall(struct timespec *ts, struct clocksource *c, u32 mult) 321update_vsyscall(struct timespec *ts, struct timespec *wtm,
322 struct clocksource *c, u32 mult)
321{ 323{
322} 324}
323 325
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 73edd4074b50..b15c3acafd5a 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -170,7 +170,8 @@ void timekeeping_leap_insert(int leapsecond)
170{ 170{
171 xtime.tv_sec += leapsecond; 171 xtime.tv_sec += leapsecond;
172 wall_to_monotonic.tv_sec -= leapsecond; 172 wall_to_monotonic.tv_sec -= leapsecond;
173 update_vsyscall(&xtime, timekeeper.clock, timekeeper.mult); 173 update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock,
174 timekeeper.mult);
174} 175}
175 176
176/** 177/**
@@ -326,7 +327,8 @@ int do_settimeofday(struct timespec *tv)
326 timekeeper.ntp_error = 0; 327 timekeeper.ntp_error = 0;
327 ntp_clear(); 328 ntp_clear();
328 329
329 update_vsyscall(&xtime, timekeeper.clock, timekeeper.mult); 330 update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock,
331 timekeeper.mult);
330 332
331 write_sequnlock_irqrestore(&xtime_lock, flags); 333 write_sequnlock_irqrestore(&xtime_lock, flags);
332 334
@@ -809,7 +811,8 @@ void update_wall_time(void)
809 } 811 }
810 812
811 /* check to see if there is a new clocksource to use */ 813 /* check to see if there is a new clocksource to use */
812 update_vsyscall(&xtime, timekeeper.clock, timekeeper.mult); 814 update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock,
815 timekeeper.mult);
813} 816}
814 817
815/** 818/**