diff options
author | John Stultz <johnstul@us.ibm.com> | 2010-07-13 20:56:21 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2010-07-27 06:40:54 -0400 |
commit | b0797b60d0067fe437baa97a743c7d9de98fd769 (patch) | |
tree | 65aa0c890ad3fa0b19554b6d0c6326dfb186270e /arch/powerpc/kernel/time.c | |
parent | 592913ecb87a9e06f98ddb55b298f1a66bf94c6b (diff) |
powerpc: Simplify update_vsyscall
Currently powerpc's update_vsyscall calls an inline update_gtod.
However, both are straightforward, and there are no other users,
so this patch merges update_gtod into update_vsyscall.
Signed-off-by: John Stultz <johnstul@us.ibm.com>
Cc: Anton Blanchard <anton@samba.org>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1279068988-21864-5-git-send-email-johnstul@us.ibm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/powerpc/kernel/time.c')
-rw-r--r-- | arch/powerpc/kernel/time.c | 55 |
1 files changed, 25 insertions, 30 deletions
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index 0441bbdadbd1..6fcd64886d1b 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c | |||
@@ -423,30 +423,6 @@ void udelay(unsigned long usecs) | |||
423 | } | 423 | } |
424 | EXPORT_SYMBOL(udelay); | 424 | EXPORT_SYMBOL(udelay); |
425 | 425 | ||
426 | static inline void update_gtod(u64 new_tb_stamp, u64 new_stamp_xsec, | ||
427 | u64 new_tb_to_xs) | ||
428 | { | ||
429 | /* | ||
430 | * tb_update_count is used to allow the userspace gettimeofday code | ||
431 | * to assure itself that it sees a consistent view of the tb_to_xs and | ||
432 | * stamp_xsec variables. It reads the tb_update_count, then reads | ||
433 | * tb_to_xs and stamp_xsec and then reads tb_update_count again. If | ||
434 | * the two values of tb_update_count match and are even then the | ||
435 | * tb_to_xs and stamp_xsec values are consistent. If not, then it | ||
436 | * loops back and reads them again until this criteria is met. | ||
437 | * We expect the caller to have done the first increment of | ||
438 | * vdso_data->tb_update_count already. | ||
439 | */ | ||
440 | vdso_data->tb_orig_stamp = new_tb_stamp; | ||
441 | vdso_data->stamp_xsec = new_stamp_xsec; | ||
442 | vdso_data->tb_to_xs = new_tb_to_xs; | ||
443 | vdso_data->wtom_clock_sec = wall_to_monotonic.tv_sec; | ||
444 | vdso_data->wtom_clock_nsec = wall_to_monotonic.tv_nsec; | ||
445 | vdso_data->stamp_xtime = xtime; | ||
446 | smp_wmb(); | ||
447 | ++(vdso_data->tb_update_count); | ||
448 | } | ||
449 | |||
450 | #ifdef CONFIG_SMP | 426 | #ifdef CONFIG_SMP |
451 | unsigned long profile_pc(struct pt_regs *regs) | 427 | unsigned long profile_pc(struct pt_regs *regs) |
452 | { | 428 | { |
@@ -876,7 +852,7 @@ static cycle_t timebase_read(struct clocksource *cs) | |||
876 | void update_vsyscall(struct timespec *wall_time, struct clocksource *clock, | 852 | void update_vsyscall(struct timespec *wall_time, struct clocksource *clock, |
877 | u32 mult) | 853 | u32 mult) |
878 | { | 854 | { |
879 | u64 t2x, stamp_xsec; | 855 | u64 new_tb_to_xs, new_stamp_xsec; |
880 | 856 | ||
881 | if (clock != &clocksource_timebase) | 857 | if (clock != &clocksource_timebase) |
882 | return; | 858 | return; |
@@ -887,11 +863,30 @@ void update_vsyscall(struct timespec *wall_time, struct clocksource *clock, | |||
887 | 863 | ||
888 | /* XXX this assumes clock->shift == 22 */ | 864 | /* XXX this assumes clock->shift == 22 */ |
889 | /* 4611686018 ~= 2^(20+64-22) / 1e9 */ | 865 | /* 4611686018 ~= 2^(20+64-22) / 1e9 */ |
890 | t2x = (u64) mult * 4611686018ULL; | 866 | new_tb_to_xs = (u64) mult * 4611686018ULL; |
891 | stamp_xsec = (u64) xtime.tv_nsec * XSEC_PER_SEC; | 867 | new_stamp_xsec = (u64) xtime.tv_nsec * XSEC_PER_SEC; |
892 | do_div(stamp_xsec, 1000000000); | 868 | do_div(new_stamp_xsec, 1000000000); |
893 | stamp_xsec += (u64) xtime.tv_sec * XSEC_PER_SEC; | 869 | new_stamp_xsec += (u64) xtime.tv_sec * XSEC_PER_SEC; |
894 | update_gtod(clock->cycle_last, stamp_xsec, t2x); | 870 | |
871 | /* | ||
872 | * tb_update_count is used to allow the userspace gettimeofday code | ||
873 | * to assure itself that it sees a consistent view of the tb_to_xs and | ||
874 | * stamp_xsec variables. It reads the tb_update_count, then reads | ||
875 | * tb_to_xs and stamp_xsec and then reads tb_update_count again. If | ||
876 | * the two values of tb_update_count match and are even then the | ||
877 | * tb_to_xs and stamp_xsec values are consistent. If not, then it | ||
878 | * loops back and reads them again until this criteria is met. | ||
879 | * We expect the caller to have done the first increment of | ||
880 | * vdso_data->tb_update_count already. | ||
881 | */ | ||
882 | vdso_data->tb_orig_stamp = clock->cycle_last; | ||
883 | vdso_data->stamp_xsec = new_stamp_xsec; | ||
884 | vdso_data->tb_to_xs = new_tb_to_xs; | ||
885 | vdso_data->wtom_clock_sec = wall_to_monotonic.tv_sec; | ||
886 | vdso_data->wtom_clock_nsec = wall_to_monotonic.tv_nsec; | ||
887 | vdso_data->stamp_xtime = xtime; | ||
888 | smp_wmb(); | ||
889 | ++(vdso_data->tb_update_count); | ||
895 | } | 890 | } |
896 | 891 | ||
897 | void update_vsyscall_tz(void) | 892 | void update_vsyscall_tz(void) |