timkeeping: Fix update_vsyscall to provide wall_to_monotonic offset
authorJohn Stultz <johnstul@us.ibm.com>
Wed, 14 Jul 2010 00:56:23 +0000 (17:56 -0700)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 27 Jul 2010 10:40:54 +0000 (12:40 +0200)
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>
arch/ia64/kernel/time.c
arch/powerpc/kernel/time.c
arch/s390/kernel/time.c
arch/x86/kernel/vsyscall_64.c
include/linux/clocksource.h
kernel/time/timekeeping.c

index 653b3c46ea82a86bb2e5092538bc5e094165a3f6..ed6f22eb5b12adcd647abb384a44ff55e4e14604 100644 (file)
@@ -471,7 +471,8 @@ void update_vsyscall_tz(void)
 {
 }
 
-void update_vsyscall(struct timespec *wall, struct clocksource *c, u32 mult)
+void update_vsyscall(struct timespec *wall, struct timespec *wtm,
+                       struct clocksource *c, u32 mult)
 {
         unsigned long flags;
 
@@ -487,9 +488,9 @@ void update_vsyscall(struct timespec *wall, struct clocksource *c, u32 mult)
        /* copy kernel time structures */
         fsyscall_gtod_data.wall_time.tv_sec = wall->tv_sec;
         fsyscall_gtod_data.wall_time.tv_nsec = wall->tv_nsec;
-        fsyscall_gtod_data.monotonic_time.tv_sec = wall_to_monotonic.tv_sec
+       fsyscall_gtod_data.monotonic_time.tv_sec = wtm->tv_sec
                                                        + wall->tv_sec;
-        fsyscall_gtod_data.monotonic_time.tv_nsec = wall_to_monotonic.tv_nsec
+       fsyscall_gtod_data.monotonic_time.tv_nsec = wtm->tv_nsec
                                                        + wall->tv_nsec;
 
        /* normalize */
index 0711d60f40b07eefa42102391b4d088ca4dd5bf8..e215f76bba1cab1b9c4ca2636abaea518a96be60 100644 (file)
@@ -849,8 +849,8 @@ static cycle_t timebase_read(struct clocksource *cs)
        return (cycle_t)get_tb();
 }
 
-void update_vsyscall(struct timespec *wall_time, struct clocksource *clock,
-                    u32 mult)
+void update_vsyscall(struct timespec *wall_time, struct timespec *wtm,
+                       struct clocksource *clock, u32 mult)
 {
        u64 new_tb_to_xs, new_stamp_xsec;
 
@@ -882,8 +882,8 @@ void update_vsyscall(struct timespec *wall_time, struct clocksource *clock,
        vdso_data->tb_orig_stamp = clock->cycle_last;
        vdso_data->stamp_xsec = new_stamp_xsec;
        vdso_data->tb_to_xs = new_tb_to_xs;
-       vdso_data->wtom_clock_sec = wall_to_monotonic.tv_sec;
-       vdso_data->wtom_clock_nsec = wall_to_monotonic.tv_nsec;
+       vdso_data->wtom_clock_sec = wtm->tv_sec;
+       vdso_data->wtom_clock_nsec = wtm->tv_nsec;
        vdso_data->stamp_xtime = *wall_time;
        smp_wmb();
        ++(vdso_data->tb_update_count);
index a2163c95eb9845ffac908bf09b7af1bb5084cf3c..aeb30c6f279c0ae51aaead5b832d50a5ad4eea24 100644 (file)
@@ -207,8 +207,8 @@ struct clocksource * __init clocksource_default_clock(void)
        return &clocksource_tod;
 }
 
-void update_vsyscall(struct timespec *wall_time, struct clocksource *clock,
-                    u32 mult)
+void update_vsyscall(struct timespec *wall_time, struct timespec *wtm,
+                       struct clocksource *clock, u32 mult)
 {
        if (clock != &clocksource_tod)
                return;
@@ -219,8 +219,8 @@ void update_vsyscall(struct timespec *wall_time, struct clocksource *clock,
        vdso_data->xtime_tod_stamp = clock->cycle_last;
        vdso_data->xtime_clock_sec = wall_time->tv_sec;
        vdso_data->xtime_clock_nsec = wall_time->tv_nsec;
-       vdso_data->wtom_clock_sec = wall_to_monotonic.tv_sec;
-       vdso_data->wtom_clock_nsec = wall_to_monotonic.tv_nsec;
+       vdso_data->wtom_clock_sec = wtm->tv_sec;
+       vdso_data->wtom_clock_nsec = wtm->tv_nsec;
        vdso_data->ntp_mult = mult;
        smp_wmb();
        ++vdso_data->tb_update_count;
index dce0c3c5a787b51b8d9c6900110c62ff4bb67bd4..dcbb28c4b69461723147e2b863919301083b68b5 100644 (file)
@@ -73,8 +73,8 @@ void update_vsyscall_tz(void)
        write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags);
 }
 
-void update_vsyscall(struct timespec *wall_time, struct clocksource *clock,
-                    u32 mult)
+void update_vsyscall(struct timespec *wall_time, struct timespec *wtm,
+                       struct clocksource *clock, u32 mult)
 {
        unsigned long flags;
 
@@ -87,7 +87,7 @@ void update_vsyscall(struct timespec *wall_time, struct clocksource *clock,
        vsyscall_gtod_data.clock.shift = clock->shift;
        vsyscall_gtod_data.wall_time_sec = wall_time->tv_sec;
        vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec;
-       vsyscall_gtod_data.wall_to_monotonic = wall_to_monotonic;
+       vsyscall_gtod_data.wall_to_monotonic = *wtm;
        vsyscall_gtod_data.wall_time_coarse = __current_kernel_time();
        write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags);
 }
index 5ea3c60c160c2df2d6e0010a33d9c8e01281b1f9..21677d99a161c321cfad89bd96a76a3e34b40fc7 100644 (file)
@@ -313,11 +313,13 @@ clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec)
 
 #ifdef CONFIG_GENERIC_TIME_VSYSCALL
 extern void
-update_vsyscall(struct timespec *ts, struct clocksource *c, u32 mult);
+update_vsyscall(struct timespec *ts, struct timespec *wtm,
+                       struct clocksource *c, u32 mult);
 extern void update_vsyscall_tz(void);
 #else
 static inline void
-update_vsyscall(struct timespec *ts, struct clocksource *c, u32 mult)
+update_vsyscall(struct timespec *ts, struct timespec *wtm,
+                       struct clocksource *c, u32 mult)
 {
 }
 
index 73edd4074b500970920fe0daee28ad760f768c83..b15c3acafd5a9cd88ec08b540eac59eaf307d33d 100644 (file)
@@ -170,7 +170,8 @@ void timekeeping_leap_insert(int leapsecond)
 {
        xtime.tv_sec += leapsecond;
        wall_to_monotonic.tv_sec -= leapsecond;
-       update_vsyscall(&xtime, timekeeper.clock, timekeeper.mult);
+       update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock,
+                       timekeeper.mult);
 }
 
 /**
@@ -326,7 +327,8 @@ int do_settimeofday(struct timespec *tv)
        timekeeper.ntp_error = 0;
        ntp_clear();
 
-       update_vsyscall(&xtime, timekeeper.clock, timekeeper.mult);
+       update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock,
+                               timekeeper.mult);
 
        write_sequnlock_irqrestore(&xtime_lock, flags);
 
@@ -809,7 +811,8 @@ void update_wall_time(void)
        }
 
        /* check to see if there is a new clocksource to use */
-       update_vsyscall(&xtime, timekeeper.clock, timekeeper.mult);
+       update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock,
+                               timekeeper.mult);
 }
 
 /**