diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2008-03-04 23:07:50 +1100 |
---|---|---|
committer | Chris Wright <chrisw@sous-sol.org> | 2008-06-09 11:27:02 -0700 |
commit | cf8ec9fd81d2be5cdcd978ca7ca1977d0548d7cb (patch) | |
tree | e6719049a6d19a5de693c63c83f810da64a22118 /arch | |
parent | 611a6f01f6cf797604dea042a0b64a868fd3170b (diff) |
x86: if we cannot calibrate the TSC, we panic.
upstream commit: 3c2047cd32b1a8c782d7efab72707e7daa251625
The current tsc_init() clears the TSC feature bit if the TSC khz
cannot be calculated, causing us to panic in
arch/x86/kernel/cpu/bugs.c check_config(). We should simply mark it
unstable.
Frankly, someone should take an axe to this code. mark_tsc_unstable()
not only marks it unstable, but sets tsc_enabled to 0, which seems
redundant but is actually important here because means it won't be
used by sched_clock() either. Perhaps a tristate enum "UNUSABLE,
UNSTABLE, OK" would be clearer, and separate mark_tsc_unstable() and
mark_tsc_broken() functions?
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/tsc_32.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/arch/x86/kernel/tsc_32.c b/arch/x86/kernel/tsc_32.c index c2241e04ea5..68657d8526f 100644 --- a/arch/x86/kernel/tsc_32.c +++ b/arch/x86/kernel/tsc_32.c @@ -392,13 +392,15 @@ void __init tsc_init(void) int cpu; if (!cpu_has_tsc) - goto out_no_tsc; + return; cpu_khz = calculate_cpu_khz(); tsc_khz = cpu_khz; - if (!cpu_khz) - goto out_no_tsc; + if (!cpu_khz) { + mark_tsc_unstable("could not calculate TSC khz"); + return; + } printk("Detected %lu.%03lu MHz processor.\n", (unsigned long)cpu_khz / 1000, @@ -431,9 +433,4 @@ void __init tsc_init(void) tsc_enabled = 1; clocksource_register(&clocksource_tsc); - - return; - -out_no_tsc: - setup_clear_cpu_cap(X86_FEATURE_TSC); } |