diff options
Diffstat (limited to 'arch/x86/kernel/tsc_sync.c')
-rw-r--r-- | arch/x86/kernel/tsc_sync.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/arch/x86/kernel/tsc_sync.c b/arch/x86/kernel/tsc_sync.c index 9125efe66a0..0577825cf89 100644 --- a/arch/x86/kernel/tsc_sync.c +++ b/arch/x86/kernel/tsc_sync.c | |||
@@ -46,7 +46,7 @@ static __cpuinit void check_tsc_warp(void) | |||
46 | cycles_t start, now, prev, end; | 46 | cycles_t start, now, prev, end; |
47 | int i; | 47 | int i; |
48 | 48 | ||
49 | start = get_cycles_sync(); | 49 | start = get_cycles(); |
50 | /* | 50 | /* |
51 | * The measurement runs for 20 msecs: | 51 | * The measurement runs for 20 msecs: |
52 | */ | 52 | */ |
@@ -61,18 +61,18 @@ static __cpuinit void check_tsc_warp(void) | |||
61 | */ | 61 | */ |
62 | __raw_spin_lock(&sync_lock); | 62 | __raw_spin_lock(&sync_lock); |
63 | prev = last_tsc; | 63 | prev = last_tsc; |
64 | now = get_cycles_sync(); | 64 | now = get_cycles(); |
65 | last_tsc = now; | 65 | last_tsc = now; |
66 | __raw_spin_unlock(&sync_lock); | 66 | __raw_spin_unlock(&sync_lock); |
67 | 67 | ||
68 | /* | 68 | /* |
69 | * Be nice every now and then (and also check whether | 69 | * Be nice every now and then (and also check whether |
70 | * measurement is done [we also insert a 100 million | 70 | * measurement is done [we also insert a 10 million |
71 | * loops safety exit, so we dont lock up in case the | 71 | * loops safety exit, so we dont lock up in case the |
72 | * TSC readout is totally broken]): | 72 | * TSC readout is totally broken]): |
73 | */ | 73 | */ |
74 | if (unlikely(!(i & 7))) { | 74 | if (unlikely(!(i & 7))) { |
75 | if (now > end || i > 100000000) | 75 | if (now > end || i > 10000000) |
76 | break; | 76 | break; |
77 | cpu_relax(); | 77 | cpu_relax(); |
78 | touch_nmi_watchdog(); | 78 | touch_nmi_watchdog(); |
@@ -87,7 +87,11 @@ static __cpuinit void check_tsc_warp(void) | |||
87 | nr_warps++; | 87 | nr_warps++; |
88 | __raw_spin_unlock(&sync_lock); | 88 | __raw_spin_unlock(&sync_lock); |
89 | } | 89 | } |
90 | 90 | } | |
91 | if (!(now-start)) { | ||
92 | printk("Warning: zero tsc calibration delta: %Ld [max: %Ld]\n", | ||
93 | now-start, end-start); | ||
94 | WARN_ON(1); | ||
91 | } | 95 | } |
92 | } | 96 | } |
93 | 97 | ||
@@ -129,24 +133,24 @@ void __cpuinit check_tsc_sync_source(int cpu) | |||
129 | while (atomic_read(&stop_count) != cpus-1) | 133 | while (atomic_read(&stop_count) != cpus-1) |
130 | cpu_relax(); | 134 | cpu_relax(); |
131 | 135 | ||
132 | /* | ||
133 | * Reset it - just in case we boot another CPU later: | ||
134 | */ | ||
135 | atomic_set(&start_count, 0); | ||
136 | |||
137 | if (nr_warps) { | 136 | if (nr_warps) { |
138 | printk("\n"); | 137 | printk("\n"); |
139 | printk(KERN_WARNING "Measured %Ld cycles TSC warp between CPUs," | 138 | printk(KERN_WARNING "Measured %Ld cycles TSC warp between CPUs," |
140 | " turning off TSC clock.\n", max_warp); | 139 | " turning off TSC clock.\n", max_warp); |
141 | mark_tsc_unstable("check_tsc_sync_source failed"); | 140 | mark_tsc_unstable("check_tsc_sync_source failed"); |
142 | nr_warps = 0; | ||
143 | max_warp = 0; | ||
144 | last_tsc = 0; | ||
145 | } else { | 141 | } else { |
146 | printk(" passed.\n"); | 142 | printk(" passed.\n"); |
147 | } | 143 | } |
148 | 144 | ||
149 | /* | 145 | /* |
146 | * Reset it - just in case we boot another CPU later: | ||
147 | */ | ||
148 | atomic_set(&start_count, 0); | ||
149 | nr_warps = 0; | ||
150 | max_warp = 0; | ||
151 | last_tsc = 0; | ||
152 | |||
153 | /* | ||
150 | * Let the target continue with the bootup: | 154 | * Let the target continue with the bootup: |
151 | */ | 155 | */ |
152 | atomic_inc(&stop_count); | 156 | atomic_inc(&stop_count); |