aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-06 16:18:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-06 16:18:29 -0400
commitb62ad9ab181a67207a4c8c373461b587c4861a68 (patch)
treeace1572964d81f5f9bbc10b7960c1f742832d744 /arch
parentaf390084359a5de20046c901529b2b6a50b941cb (diff)
parentb29230769e3482bbd62a07d6d9485371ee66a18f (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')
-rw-r--r--arch/alpha/Kconfig4
-rw-r--r--arch/arm/Kconfig4
-rw-r--r--arch/avr32/Kconfig3
-rw-r--r--arch/blackfin/Kconfig3
-rw-r--r--arch/cris/Kconfig3
-rw-r--r--arch/frv/Kconfig4
-rw-r--r--arch/h8300/Kconfig4
-rw-r--r--arch/ia64/Kconfig4
-rw-r--r--arch/ia64/kernel/time.c7
-rw-r--r--arch/m32r/Kconfig3
-rw-r--r--arch/m68k/Kconfig3
-rw-r--r--arch/m68knommu/Kconfig4
-rw-r--r--arch/microblaze/Kconfig3
-rw-r--r--arch/mips/Kconfig4
-rw-r--r--arch/mn10300/Kconfig3
-rw-r--r--arch/parisc/Kconfig4
-rw-r--r--arch/powerpc/Kconfig3
-rw-r--r--arch/powerpc/kernel/time.c60
-rw-r--r--arch/s390/Kconfig3
-rw-r--r--arch/s390/kernel/time.c8
-rw-r--r--arch/score/Kconfig3
-rw-r--r--arch/sh/Kconfig3
-rw-r--r--arch/sparc/Kconfig3
-rw-r--r--arch/um/Kconfig.common4
-rw-r--r--arch/um/kernel/time.c16
-rw-r--r--arch/x86/Kconfig5
-rw-r--r--arch/x86/kernel/hpet.c13
-rw-r--r--arch/x86/kernel/tsc.c5
-rw-r--r--arch/x86/kernel/vsyscall_64.c17
-rw-r--r--arch/xtensa/Kconfig3
30 files changed, 65 insertions, 141 deletions
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 3e2e540a0f2a..b9647bb66d13 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -47,10 +47,6 @@ config GENERIC_CALIBRATE_DELAY
47 bool 47 bool
48 default y 48 default y
49 49
50config GENERIC_TIME
51 bool
52 default y
53
54config GENERIC_CMOS_UPDATE 50config GENERIC_CMOS_UPDATE
55 def_bool y 51 def_bool y
56 52
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index e39caa8b0c93..9e10882c81d7 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -43,10 +43,6 @@ config SYS_SUPPORTS_APM_EMULATION
43config GENERIC_GPIO 43config GENERIC_GPIO
44 bool 44 bool
45 45
46config GENERIC_TIME
47 bool
48 default y
49
50config ARCH_USES_GETTIMEOFFSET 46config ARCH_USES_GETTIMEOFFSET
51 bool 47 bool
52 default n 48 default n
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig
index f2b319333184..f51572772e21 100644
--- a/arch/avr32/Kconfig
+++ b/arch/avr32/Kconfig
@@ -45,9 +45,6 @@ config GENERIC_IRQ_PROBE
45config RWSEM_GENERIC_SPINLOCK 45config RWSEM_GENERIC_SPINLOCK
46 def_bool y 46 def_bool y
47 47
48config GENERIC_TIME
49 def_bool y
50
51config GENERIC_CLOCKEVENTS 48config GENERIC_CLOCKEVENTS
52 def_bool y 49 def_bool y
53 50
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index f66294b4f9d2..c88fd3584122 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -614,9 +614,6 @@ comment "Kernel Timer/Scheduler"
614 614
615source kernel/Kconfig.hz 615source kernel/Kconfig.hz
616 616
617config GENERIC_TIME
618 def_bool y
619
620config GENERIC_CLOCKEVENTS 617config GENERIC_CLOCKEVENTS
621 bool "Generic clock events" 618 bool "Generic clock events"
622 default y 619 default y
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index e25bf4440b51..887ef855be2a 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -20,9 +20,6 @@ config RWSEM_GENERIC_SPINLOCK
20config RWSEM_XCHGADD_ALGORITHM 20config RWSEM_XCHGADD_ALGORITHM
21 bool 21 bool
22 22
23config GENERIC_TIME
24 def_bool y
25
26config GENERIC_CMOS_UPDATE 23config GENERIC_CMOS_UPDATE
27 def_bool y 24 def_bool y
28 25
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig
index 4b5830bcbe2e..16399bd24993 100644
--- a/arch/frv/Kconfig
+++ b/arch/frv/Kconfig
@@ -40,10 +40,6 @@ config GENERIC_HARDIRQS_NO__DO_IRQ
40 bool 40 bool
41 default y 41 default y
42 42
43config GENERIC_TIME
44 bool
45 default y
46
47config TIME_LOW_RES 43config TIME_LOW_RES
48 bool 44 bool
49 default y 45 default y
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index 53cc669e6d59..988b6ff34cc4 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -62,10 +62,6 @@ config GENERIC_CALIBRATE_DELAY
62 bool 62 bool
63 default y 63 default y
64 64
65config GENERIC_TIME
66 bool
67 default y
68
69config GENERIC_BUG 65config GENERIC_BUG
70 bool 66 bool
71 depends on BUG 67 depends on BUG
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 95610820041e..8711d13cd79f 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -82,10 +82,6 @@ config GENERIC_CALIBRATE_DELAY
82 bool 82 bool
83 default y 83 default y
84 84
85config GENERIC_TIME
86 bool
87 default y
88
89config GENERIC_TIME_VSYSCALL 85config GENERIC_TIME_VSYSCALL
90 bool 86 bool
91 default y 87 default y
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/m32r/Kconfig b/arch/m32r/Kconfig
index 3a9319f93e89..836abbbc9c04 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -44,9 +44,6 @@ config HZ
44 int 44 int
45 default 100 45 default 100
46 46
47config GENERIC_TIME
48 def_bool y
49
50config ARCH_USES_GETTIMEOFFSET 47config ARCH_USES_GETTIMEOFFSET
51 def_bool y 48 def_bool y
52 49
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 2e3737b92ffc..8030e2481d97 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -59,9 +59,6 @@ config HZ
59 int 59 int
60 default 100 60 default 100
61 61
62config GENERIC_TIME
63 def_bool y
64
65config ARCH_USES_GETTIMEOFFSET 62config ARCH_USES_GETTIMEOFFSET
66 def_bool y 63 def_bool y
67 64
diff --git a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig
index efeb6033fc17..2609c394e1df 100644
--- a/arch/m68knommu/Kconfig
+++ b/arch/m68knommu/Kconfig
@@ -63,10 +63,6 @@ config GENERIC_CALIBRATE_DELAY
63 bool 63 bool
64 default y 64 default y
65 65
66config GENERIC_TIME
67 bool
68 default y
69
70config GENERIC_CMOS_UPDATE 66config GENERIC_CMOS_UPDATE
71 bool 67 bool
72 default y 68 default y
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index 9bd64b4b2b0c..692fdfce2a23 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -51,9 +51,6 @@ config GENERIC_IRQ_PROBE
51config GENERIC_CALIBRATE_DELAY 51config GENERIC_CALIBRATE_DELAY
52 def_bool y 52 def_bool y
53 53
54config GENERIC_TIME
55 def_bool y
56
57config GENERIC_TIME_VSYSCALL 54config GENERIC_TIME_VSYSCALL
58 def_bool n 55 def_bool n
59 56
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 36642df7d5f6..3ad59dde4852 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -758,10 +758,6 @@ config GENERIC_CLOCKEVENTS
758 bool 758 bool
759 default y 759 default y
760 760
761config GENERIC_TIME
762 bool
763 default y
764
765config GENERIC_CMOS_UPDATE 761config GENERIC_CMOS_UPDATE
766 bool 762 bool
767 default y 763 default y
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig
index 1c4565a9102b..444b9f918fdf 100644
--- a/arch/mn10300/Kconfig
+++ b/arch/mn10300/Kconfig
@@ -46,9 +46,6 @@ config GENERIC_FIND_NEXT_BIT
46config GENERIC_HWEIGHT 46config GENERIC_HWEIGHT
47 def_bool y 47 def_bool y
48 48
49config GENERIC_TIME
50 def_bool y
51
52config GENERIC_BUG 49config GENERIC_BUG
53 def_bool y 50 def_bool y
54 51
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 05a366a5c4d5..907417d187e1 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -66,10 +66,6 @@ config GENERIC_CALIBRATE_DELAY
66 bool 66 bool
67 default y 67 default y
68 68
69config GENERIC_TIME
70 bool
71 default y
72
73config TIME_LOW_RES 69config TIME_LOW_RES
74 bool 70 bool
75 depends on SMP 71 depends on SMP
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index e2bf40a2ce5a..631e5a0fb6ab 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -29,9 +29,6 @@ config MMU
29config GENERIC_CMOS_UPDATE 29config GENERIC_CMOS_UPDATE
30 def_bool y 30 def_bool y
31 31
32config GENERIC_TIME
33 def_bool y
34
35config GENERIC_TIME_VSYSCALL 32config GENERIC_TIME_VSYSCALL
36 def_bool y 33 def_bool y
37 34
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
799static inline void update_gtod(u64 new_tb_stamp, u64 new_stamp_xsec, 799void 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
825void 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
851void update_vsyscall_tz(void) 845void update_vsyscall_tz(void)
852{ 846{
853 /* Make userspace gettimeofday spin until we're done. */ 847 /* Make userspace gettimeofday spin until we're done. */
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index bee1c0f794cf..f0777a47e3a5 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -40,9 +40,6 @@ config ARCH_HAS_ILOG2_U64
40config GENERIC_HWEIGHT 40config GENERIC_HWEIGHT
41 def_bool y 41 def_bool y
42 42
43config GENERIC_TIME
44 def_bool y
45
46config GENERIC_TIME_VSYSCALL 43config GENERIC_TIME_VSYSCALL
47 def_bool y 44 def_bool y
48 45
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index 15a7536452d5..2896cac9c14a 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/score/Kconfig b/arch/score/Kconfig
index 55d413e6dcf2..be4a15584751 100644
--- a/arch/score/Kconfig
+++ b/arch/score/Kconfig
@@ -55,9 +55,6 @@ config GENERIC_CALIBRATE_DELAY
55config GENERIC_CLOCKEVENTS 55config GENERIC_CLOCKEVENTS
56 def_bool y 56 def_bool y
57 57
58config GENERIC_TIME
59 def_bool y
60
61config SCHED_NO_NO_OMIT_FRAME_POINTER 58config SCHED_NO_NO_OMIT_FRAME_POINTER
62 def_bool y 59 def_bool y
63 60
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 82868fee21fd..33990fa95af0 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -98,9 +98,6 @@ config GENERIC_CALIBRATE_DELAY
98config GENERIC_IOMAP 98config GENERIC_IOMAP
99 bool 99 bool
100 100
101config GENERIC_TIME
102 def_bool y
103
104config GENERIC_CLOCKEVENTS 101config GENERIC_CLOCKEVENTS
105 def_bool y 102 def_bool y
106 103
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index ba068c833e5d..491e9d6de191 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -67,9 +67,6 @@ config BITS
67 default 32 if SPARC32 67 default 32 if SPARC32
68 default 64 if SPARC64 68 default 64 if SPARC64
69 69
70config GENERIC_TIME
71 def_bool y
72
73config ARCH_USES_GETTIMEOFFSET 70config ARCH_USES_GETTIMEOFFSET
74 bool 71 bool
75 default y if SPARC32 72 default y if SPARC32
diff --git a/arch/um/Kconfig.common b/arch/um/Kconfig.common
index 0d207e73a758..7c8e277f6d34 100644
--- a/arch/um/Kconfig.common
+++ b/arch/um/Kconfig.common
@@ -55,10 +55,6 @@ config GENERIC_BUG
55 default y 55 default y
56 depends on BUG 56 depends on BUG
57 57
58config GENERIC_TIME
59 bool
60 default y
61
62config GENERIC_CLOCKEVENTS 58config GENERIC_CLOCKEVENTS
63 bool 59 bool
64 default y 60 default y
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c
index c8b9c469fcd7..a08d9fab81f2 100644
--- a/arch/um/kernel/time.c
+++ b/arch/um/kernel/time.c
@@ -102,16 +102,16 @@ static void __init setup_itimer(void)
102 clockevents_register_device(&itimer_clockevent); 102 clockevents_register_device(&itimer_clockevent);
103} 103}
104 104
105void __init time_init(void) 105void read_persistent_clock(struct timespec *ts)
106{ 106{
107 long long nsecs; 107 long long nsecs = os_nsecs();
108
109 timer_init();
110 108
111 nsecs = os_nsecs(); 109 set_normalized_timespec(ts, nsecs / NSEC_PER_SEC,
112 set_normalized_timespec(&wall_to_monotonic, -nsecs / NSEC_PER_SEC,
113 -nsecs % NSEC_PER_SEC);
114 set_normalized_timespec(&xtime, nsecs / NSEC_PER_SEC,
115 nsecs % NSEC_PER_SEC); 110 nsecs % NSEC_PER_SEC);
111}
112
113void __init time_init(void)
114{
115 timer_init();
116 late_time_init = setup_itimer; 116 late_time_init = setup_itimer;
117} 117}
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 6f77afa6bca9..baa34e510222 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -73,9 +73,6 @@ config ARCH_DEFCONFIG
73 default "arch/x86/configs/i386_defconfig" if X86_32 73 default "arch/x86/configs/i386_defconfig" if X86_32
74 default "arch/x86/configs/x86_64_defconfig" if X86_64 74 default "arch/x86/configs/x86_64_defconfig" if X86_64
75 75
76config GENERIC_TIME
77 def_bool y
78
79config GENERIC_CMOS_UPDATE 76config GENERIC_CMOS_UPDATE
80 def_bool y 77 def_bool y
81 78
@@ -2047,7 +2044,7 @@ config SCx200
2047 2044
2048config SCx200HR_TIMER 2045config SCx200HR_TIMER
2049 tristate "NatSemi SCx200 27MHz High-Resolution Timer Support" 2046 tristate "NatSemi SCx200 27MHz High-Resolution Timer Support"
2050 depends on SCx200 && GENERIC_TIME 2047 depends on SCx200
2051 default y 2048 default y
2052 ---help--- 2049 ---help---
2053 This driver provides a clocksource built upon the on-chip 2050 This driver provides a clocksource built upon the on-chip
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index ba390d731175..33dbcc4ec5ff 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -16,7 +16,6 @@
16#include <asm/hpet.h> 16#include <asm/hpet.h>
17 17
18#define HPET_MASK CLOCKSOURCE_MASK(32) 18#define HPET_MASK CLOCKSOURCE_MASK(32)
19#define HPET_SHIFT 22
20 19
21/* FSEC = 10^-15 20/* FSEC = 10^-15
22 NSEC = 10^-9 */ 21 NSEC = 10^-9 */
@@ -787,7 +786,6 @@ static struct clocksource clocksource_hpet = {
787 .rating = 250, 786 .rating = 250,
788 .read = read_hpet, 787 .read = read_hpet,
789 .mask = HPET_MASK, 788 .mask = HPET_MASK,
790 .shift = HPET_SHIFT,
791 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 789 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
792 .resume = hpet_resume_counter, 790 .resume = hpet_resume_counter,
793#ifdef CONFIG_X86_64 791#ifdef CONFIG_X86_64
@@ -798,6 +796,7 @@ static struct clocksource clocksource_hpet = {
798static int hpet_clocksource_register(void) 796static int hpet_clocksource_register(void)
799{ 797{
800 u64 start, now; 798 u64 start, now;
799 u64 hpet_freq;
801 cycle_t t1; 800 cycle_t t1;
802 801
803 /* Start the counter */ 802 /* Start the counter */
@@ -832,9 +831,15 @@ static int hpet_clocksource_register(void)
832 * mult = (hpet_period * 2^shift)/10^6 831 * mult = (hpet_period * 2^shift)/10^6
833 * mult = (hpet_period << shift)/FSEC_PER_NSEC 832 * mult = (hpet_period << shift)/FSEC_PER_NSEC
834 */ 833 */
835 clocksource_hpet.mult = div_sc(hpet_period, FSEC_PER_NSEC, HPET_SHIFT);
836 834
837 clocksource_register(&clocksource_hpet); 835 /* Need to convert hpet_period (fsec/cyc) to cyc/sec:
836 *
837 * cyc/sec = FSEC_PER_SEC/hpet_period(fsec/cyc)
838 * cyc/sec = (FSEC_PER_NSEC * NSEC_PER_SEC)/hpet_period
839 */
840 hpet_freq = FSEC_PER_NSEC * NSEC_PER_SEC;
841 do_div(hpet_freq, hpet_period);
842 clocksource_register_hz(&clocksource_hpet, (u32)hpet_freq);
838 843
839 return 0; 844 return 0;
840} 845}
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 9faf91ae1841..ce8e50239332 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -751,7 +751,6 @@ static struct clocksource clocksource_tsc = {
751 .read = read_tsc, 751 .read = read_tsc,
752 .resume = resume_tsc, 752 .resume = resume_tsc,
753 .mask = CLOCKSOURCE_MASK(64), 753 .mask = CLOCKSOURCE_MASK(64),
754 .shift = 22,
755 .flags = CLOCK_SOURCE_IS_CONTINUOUS | 754 .flags = CLOCK_SOURCE_IS_CONTINUOUS |
756 CLOCK_SOURCE_MUST_VERIFY, 755 CLOCK_SOURCE_MUST_VERIFY,
757#ifdef CONFIG_X86_64 756#ifdef CONFIG_X86_64
@@ -845,8 +844,6 @@ __cpuinit int unsynchronized_tsc(void)
845 844
846static void __init init_tsc_clocksource(void) 845static void __init init_tsc_clocksource(void)
847{ 846{
848 clocksource_tsc.mult = clocksource_khz2mult(tsc_khz,
849 clocksource_tsc.shift);
850 if (tsc_clocksource_reliable) 847 if (tsc_clocksource_reliable)
851 clocksource_tsc.flags &= ~CLOCK_SOURCE_MUST_VERIFY; 848 clocksource_tsc.flags &= ~CLOCK_SOURCE_MUST_VERIFY;
852 /* lower the rating if we already know its unstable: */ 849 /* lower the rating if we already know its unstable: */
@@ -854,7 +851,7 @@ static void __init init_tsc_clocksource(void)
854 clocksource_tsc.rating = 0; 851 clocksource_tsc.rating = 0;
855 clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS; 852 clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS;
856 } 853 }
857 clocksource_register(&clocksource_tsc); 854 clocksource_register_khz(&clocksource_tsc, tsc_khz);
858} 855}
859 856
860#ifdef CONFIG_X86_64 857#ifdef CONFIG_X86_64
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index 1c0c6ab9c60f..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}
@@ -169,13 +169,18 @@ int __vsyscall(0) vgettimeofday(struct timeval * tv, struct timezone * tz)
169 * unlikely */ 169 * unlikely */
170time_t __vsyscall(1) vtime(time_t *t) 170time_t __vsyscall(1) vtime(time_t *t)
171{ 171{
172 struct timeval tv; 172 unsigned seq;
173 time_t result; 173 time_t result;
174 if (unlikely(!__vsyscall_gtod_data.sysctl_enabled)) 174 if (unlikely(!__vsyscall_gtod_data.sysctl_enabled))
175 return time_syscall(t); 175 return time_syscall(t);
176 176
177 vgettimeofday(&tv, NULL); 177 do {
178 result = tv.tv_sec; 178 seq = read_seqbegin(&__vsyscall_gtod_data.lock);
179
180 result = __vsyscall_gtod_data.wall_time_sec;
181
182 } while (read_seqretry(&__vsyscall_gtod_data.lock, seq));
183
179 if (t) 184 if (t)
180 *t = result; 185 *t = result;
181 return result; 186 return result;
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index ebe228d02b08..0859bfd8ae93 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -48,9 +48,6 @@ config HZ
48 int 48 int
49 default 100 49 default 100
50 50
51config GENERIC_TIME
52 def_bool y
53
54source "init/Kconfig" 51source "init/Kconfig"
55source "kernel/Kconfig.freezer" 52source "kernel/Kconfig.freezer"
56 53