aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/i386/kernel/tsc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/arch/i386/kernel/tsc.c b/arch/i386/kernel/tsc.c
index 0e65f7ab63a2..6cb8f5336732 100644
--- a/arch/i386/kernel/tsc.c
+++ b/arch/i386/kernel/tsc.c
@@ -18,6 +18,8 @@
18 18
19#include "mach_timer.h" 19#include "mach_timer.h"
20 20
21static int tsc_enabled;
22
21/* 23/*
22 * On some systems the TSC frequency does not 24 * On some systems the TSC frequency does not
23 * change with the cpu frequency. So we need 25 * change with the cpu frequency. So we need
@@ -105,7 +107,7 @@ unsigned long long sched_clock(void)
105 /* 107 /*
106 * Fall back to jiffies if there's no TSC available: 108 * Fall back to jiffies if there's no TSC available:
107 */ 109 */
108 if (tsc_unstable || unlikely(tsc_disable)) 110 if (unlikely(!tsc_enabled))
109 /* No locking but a rare wrong value is not a big deal: */ 111 /* No locking but a rare wrong value is not a big deal: */
110 return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ); 112 return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ);
111 113
@@ -283,6 +285,7 @@ void mark_tsc_unstable(void)
283{ 285{
284 if (!tsc_unstable) { 286 if (!tsc_unstable) {
285 tsc_unstable = 1; 287 tsc_unstable = 1;
288 tsc_enabled = 0;
286 /* Can be called before registration */ 289 /* Can be called before registration */
287 if (clocksource_tsc.mult) 290 if (clocksource_tsc.mult)
288 clocksource_change_rating(&clocksource_tsc, 0); 291 clocksource_change_rating(&clocksource_tsc, 0);
@@ -383,7 +386,9 @@ void __init tsc_init(void)
383 if (check_tsc_unstable()) { 386 if (check_tsc_unstable()) {
384 clocksource_tsc.rating = 0; 387 clocksource_tsc.rating = 0;
385 clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS; 388 clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS;
386 } 389 } else
390 tsc_enabled = 1;
391
387 clocksource_register(&clocksource_tsc); 392 clocksource_register(&clocksource_tsc);
388 393
389 return; 394 return;