Commit 7feacd53 authored by Tim Mann's avatar Tim Mann Committed by Linus Torvalds

[PATCH] x86: fix cpu_khz with clock=pit

Fix http://bugzilla.kernel.org/show_bug.cgi?id=5546

The cpu_khz global is not initialized and remains 0 if you boot with
clock=pit, even if the processor does have a TSC.  This may have bad
ramifications since the variable is used in various places scattered around
the kernel, though I didn't check them all to see if they can tolerate cpu_khz
= 0.  You can observe the problem by doing "cat /proc/cpuinfo"; the cpu MHz
line says 0.000.

The fix is trivial; call init_cpu_khz() from init_pit(), just as it's called
from the timers/timer_foo.c:init_foo() for other values of foo.

Cc: john stultz <johnstul@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent e2718208
...@@ -25,8 +25,9 @@ static int __init init_pit(char* override) ...@@ -25,8 +25,9 @@ static int __init init_pit(char* override)
{ {
/* check clock override */ /* check clock override */
if (override[0] && strncmp(override,"pit",3)) if (override[0] && strncmp(override,"pit",3))
printk(KERN_ERR "Warning: clock= override failed. Defaulting to PIT\n"); printk(KERN_ERR "Warning: clock= override failed. Defaulting "
"to PIT\n");
init_cpu_khz();
count_p = LATCH; count_p = LATCH;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment