aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2008-05-13 06:31:00 -0400
committerThomas Gleixner <tglx@linutronix.de>2008-05-23 08:08:06 -0400
commit9ccc906c97e34fd91dc6aaf5b69b52d824386910 (patch)
treef494f852fbbc4aef95ab92ca45dfdd14c819fc72 /arch
parentb6db80ee1331e7beaeb91b4b3d946dd16c72e388 (diff)
x86: distangle user disabled TSC from unstable
tsc_enabled is set to 0 from the command line switch "notsc" and from the mark_tsc_unstable code. Seperate those functionalities and replace tsc_enable with tsc_disable. This makes also the native_sched_clock() decision when to use TSC understandable. Preparatory patch to solve the sched_clock() issue on 32 bit. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/tsc_32.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/arch/x86/kernel/tsc_32.c b/arch/x86/kernel/tsc_32.c
index e4790728b224..b087d691f165 100644
--- a/arch/x86/kernel/tsc_32.c
+++ b/arch/x86/kernel/tsc_32.c
@@ -14,7 +14,7 @@
14 14
15#include "mach_timer.h" 15#include "mach_timer.h"
16 16
17static int tsc_enabled; 17static int tsc_disabled;
18 18
19/* 19/*
20 * On some systems the TSC frequency does not 20 * On some systems the TSC frequency does not
@@ -28,8 +28,8 @@ EXPORT_SYMBOL_GPL(tsc_khz);
28static int __init tsc_setup(char *str) 28static int __init tsc_setup(char *str)
29{ 29{
30 printk(KERN_WARNING "notsc: Kernel compiled with CONFIG_X86_TSC, " 30 printk(KERN_WARNING "notsc: Kernel compiled with CONFIG_X86_TSC, "
31 "cannot disable TSC completely.\n"); 31 "cannot disable TSC completely.\n");
32 mark_tsc_unstable("user disabled TSC"); 32 tsc_disabled = 1;
33 return 1; 33 return 1;
34} 34}
35#else 35#else
@@ -120,7 +120,7 @@ unsigned long long native_sched_clock(void)
120 * very important for it to be as fast as the platform 120 * very important for it to be as fast as the platform
121 * can achive it. ) 121 * can achive it. )
122 */ 122 */
123 if (unlikely(!tsc_enabled && !tsc_unstable)) 123 if (unlikely(tsc_disabled))
124 /* No locking but a rare wrong value is not a big deal: */ 124 /* No locking but a rare wrong value is not a big deal: */
125 return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ); 125 return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ);
126 126
@@ -322,7 +322,6 @@ void mark_tsc_unstable(char *reason)
322{ 322{
323 if (!tsc_unstable) { 323 if (!tsc_unstable) {
324 tsc_unstable = 1; 324 tsc_unstable = 1;
325 tsc_enabled = 0;
326 printk("Marking TSC unstable due to: %s.\n", reason); 325 printk("Marking TSC unstable due to: %s.\n", reason);
327 /* Can be called before registration */ 326 /* Can be called before registration */
328 if (clocksource_tsc.mult) 327 if (clocksource_tsc.mult)
@@ -336,7 +335,7 @@ EXPORT_SYMBOL_GPL(mark_tsc_unstable);
336static int __init dmi_mark_tsc_unstable(const struct dmi_system_id *d) 335static int __init dmi_mark_tsc_unstable(const struct dmi_system_id *d)
337{ 336{
338 printk(KERN_NOTICE "%s detected: marking TSC unstable.\n", 337 printk(KERN_NOTICE "%s detected: marking TSC unstable.\n",
339 d->ident); 338 d->ident);
340 tsc_unstable = 1; 339 tsc_unstable = 1;
341 return 0; 340 return 0;
342} 341}
@@ -403,8 +402,11 @@ void __init tsc_init(void)
403{ 402{
404 int cpu; 403 int cpu;
405 404
406 if (!cpu_has_tsc) 405 if (!cpu_has_tsc || tsc_disabled) {
406 /* Disable the TSC in case of !cpu_has_tsc */
407 tsc_disabled = 1;
407 return; 408 return;
409 }
408 410
409 cpu_khz = calculate_cpu_khz(); 411 cpu_khz = calculate_cpu_khz();
410 tsc_khz = cpu_khz; 412 tsc_khz = cpu_khz;
@@ -441,8 +443,6 @@ void __init tsc_init(void)
441 if (check_tsc_unstable()) { 443 if (check_tsc_unstable()) {
442 clocksource_tsc.rating = 0; 444 clocksource_tsc.rating = 0;
443 clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS; 445 clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS;
444 } else 446 }
445 tsc_enabled = 1;
446
447 clocksource_register(&clocksource_tsc); 447 clocksource_register(&clocksource_tsc);
448} 448}