diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-06 16:18:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-06 16:18:29 -0400 |
commit | b62ad9ab181a67207a4c8c373461b587c4861a68 (patch) | |
tree | ace1572964d81f5f9bbc10b7960c1f742832d744 /arch/powerpc/kernel | |
parent | af390084359a5de20046c901529b2b6a50b941cb (diff) | |
parent | b29230769e3482bbd62a07d6d9485371ee66a18f (diff) |
Merge branch 'timers-timekeeping-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'timers-timekeeping-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
um: Fix read_persistent_clock fallout
kgdb: Do not access xtime directly
powerpc: Clean up obsolete code relating to decrementer and timebase
powerpc: Rework VDSO gettimeofday to prevent time going backwards
clocksource: Add __clocksource_updatefreq_hz/khz methods
x86: Convert common clocksources to use clocksource_register_hz/khz
timekeeping: Make xtime and wall_to_monotonic static
hrtimer: Cleanup direct access to wall_to_monotonic
um: Convert to use read_persistent_clock
timkeeping: Fix update_vsyscall to provide wall_to_monotonic offset
powerpc: Cleanup xtime usage
powerpc: Simplify update_vsyscall
time: Kill off CONFIG_GENERIC_TIME
time: Implement timespec_add
x86: Fix vtime/file timestamp inconsistencies
Trivial conflicts in Documentation/feature-removal-schedule.txt
Much less trivial conflicts in arch/powerpc/kernel/time.c resolved as
per Thomas' earlier merge commit 47916be4e28c ("Merge branch
'powerpc.cherry-picks' into timers/clocksource")
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r-- | arch/powerpc/kernel/time.c | 60 |
1 files changed, 27 insertions, 33 deletions
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index ccb8759c8532..ce53dfa7130d 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c | |||
@@ -796,10 +796,30 @@ static cycle_t timebase_read(struct clocksource *cs) | |||
796 | return (cycle_t)get_tb(); | 796 | return (cycle_t)get_tb(); |
797 | } | 797 | } |
798 | 798 | ||
799 | static inline void update_gtod(u64 new_tb_stamp, u64 new_stamp_xsec, | 799 | void update_vsyscall(struct timespec *wall_time, struct timespec *wtm, |
800 | u64 new_tb_to_xs, struct timespec *now, | 800 | struct clocksource *clock, u32 mult) |
801 | u32 frac_sec) | ||
802 | { | 801 | { |
802 | u64 new_tb_to_xs, new_stamp_xsec; | ||
803 | u32 frac_sec; | ||
804 | |||
805 | if (clock != &clocksource_timebase) | ||
806 | return; | ||
807 | |||
808 | /* Make userspace gettimeofday spin until we're done. */ | ||
809 | ++vdso_data->tb_update_count; | ||
810 | smp_mb(); | ||
811 | |||
812 | /* XXX this assumes clock->shift == 22 */ | ||
813 | /* 4611686018 ~= 2^(20+64-22) / 1e9 */ | ||
814 | new_tb_to_xs = (u64) mult * 4611686018ULL; | ||
815 | new_stamp_xsec = (u64) wall_time->tv_nsec * XSEC_PER_SEC; | ||
816 | do_div(new_stamp_xsec, 1000000000); | ||
817 | new_stamp_xsec += (u64) wall_time->tv_sec * XSEC_PER_SEC; | ||
818 | |||
819 | BUG_ON(wall_time->tv_nsec >= NSEC_PER_SEC); | ||
820 | /* this is tv_nsec / 1e9 as a 0.32 fraction */ | ||
821 | frac_sec = ((u64) wall_time->tv_nsec * 18446744073ULL) >> 32; | ||
822 | |||
803 | /* | 823 | /* |
804 | * tb_update_count is used to allow the userspace gettimeofday code | 824 | * tb_update_count is used to allow the userspace gettimeofday code |
805 | * to assure itself that it sees a consistent view of the tb_to_xs and | 825 | * to assure itself that it sees a consistent view of the tb_to_xs and |
@@ -811,43 +831,17 @@ static inline void update_gtod(u64 new_tb_stamp, u64 new_stamp_xsec, | |||
811 | * We expect the caller to have done the first increment of | 831 | * We expect the caller to have done the first increment of |
812 | * vdso_data->tb_update_count already. | 832 | * vdso_data->tb_update_count already. |
813 | */ | 833 | */ |
814 | vdso_data->tb_orig_stamp = new_tb_stamp; | 834 | vdso_data->tb_orig_stamp = clock->cycle_last; |
815 | vdso_data->stamp_xsec = new_stamp_xsec; | 835 | vdso_data->stamp_xsec = new_stamp_xsec; |
816 | vdso_data->tb_to_xs = new_tb_to_xs; | 836 | vdso_data->tb_to_xs = new_tb_to_xs; |
817 | vdso_data->wtom_clock_sec = wall_to_monotonic.tv_sec; | 837 | vdso_data->wtom_clock_sec = wtm->tv_sec; |
818 | vdso_data->wtom_clock_nsec = wall_to_monotonic.tv_nsec; | 838 | vdso_data->wtom_clock_nsec = wtm->tv_nsec; |
819 | vdso_data->stamp_xtime = *now; | 839 | vdso_data->stamp_xtime = *wall_time; |
820 | vdso_data->stamp_sec_fraction = frac_sec; | 840 | vdso_data->stamp_sec_fraction = frac_sec; |
821 | smp_wmb(); | 841 | smp_wmb(); |
822 | ++(vdso_data->tb_update_count); | 842 | ++(vdso_data->tb_update_count); |
823 | } | 843 | } |
824 | 844 | ||
825 | void update_vsyscall(struct timespec *wall_time, struct clocksource *clock, | ||
826 | u32 mult) | ||
827 | { | ||
828 | u64 t2x, stamp_xsec; | ||
829 | u32 frac_sec; | ||
830 | |||
831 | if (clock != &clocksource_timebase) | ||
832 | return; | ||
833 | |||
834 | /* Make userspace gettimeofday spin until we're done. */ | ||
835 | ++vdso_data->tb_update_count; | ||
836 | smp_mb(); | ||
837 | |||
838 | /* XXX this assumes clock->shift == 22 */ | ||
839 | /* 4611686018 ~= 2^(20+64-22) / 1e9 */ | ||
840 | t2x = (u64) mult * 4611686018ULL; | ||
841 | stamp_xsec = (u64) wall_time->tv_nsec * XSEC_PER_SEC; | ||
842 | do_div(stamp_xsec, 1000000000); | ||
843 | stamp_xsec += (u64) wall_time->tv_sec * XSEC_PER_SEC; | ||
844 | |||
845 | BUG_ON(wall_time->tv_nsec >= NSEC_PER_SEC); | ||
846 | /* this is tv_nsec / 1e9 as a 0.32 fraction */ | ||
847 | frac_sec = ((u64) wall_time->tv_nsec * 18446744073ULL) >> 32; | ||
848 | update_gtod(clock->cycle_last, stamp_xsec, t2x, wall_time, frac_sec); | ||
849 | } | ||
850 | |||
851 | void update_vsyscall_tz(void) | 845 | void update_vsyscall_tz(void) |
852 | { | 846 | { |
853 | /* Make userspace gettimeofday spin until we're done. */ | 847 | /* Make userspace gettimeofday spin until we're done. */ |