Skip to contentSkip to conversation

Fix booting pentium+ with dodgy TSC

PATCH In review Rusty Russell 3 participants 4 messages Apr 6, 2008 – Apr 11, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix booting pentium+ with dodgy TSC

Linus please apply. Almost by definition this patch can't make things worse.

We handle a broken tsc these days, so no need to panic. We clear the TSC bit when tsc_init decides it's unreliable (eg. under lguest w/ bad host TSC), leading to bogus panic.

arch/x86/kernel/cpu/bugs.c +0 -8
diff -r 5e0a39f4d07b arch/x86/kernel/cpu/bugs.c
@@ -143,14 +143,6 @@ static void __init check_config(void)
 #endif
 
 /*
- * If we configured ourselves for a TSC, we'd better have one!
- */
-#ifdef CONFIG_X86_TSC
-	if (!cpu_has_tsc)
-		panic("Kernel compiled for Pentium+, requires TSC feature!");
-#endif
-
-/*
  * If we were told we had a good local APIC, check for buggy Pentia,
  * i.e. all B steppings and the C2 stepping of P54C when using their
  * integrated APIC (see 11AP erratum in "Pentium Processor
Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · Rusty Russell

Linus please apply. Almost by definition this patch can't make things worse.

well, while i agree with the patch it could make things worse. In this case it can cause code that has been compiled to rely on TSC to malfunction. For if sched_clock() was using cpu_has_tsc it could return 0 all the time, breaking the scheduler without the user having a clear idea why it broke. It isnt, and sched_clock() will work fine, but still, your "this cant make things worse" statement is not completely correct.

In any case:

and i've also queued it up into the for-.25 queue of x86.git.

Ingo

#2 lore raw
Quoted 10 lines · On Sunday 06 April 2008 21:22:08 Ingo Molnar wrote:
Quoted 2 lines · Rusty Russell

Linus please apply. Almost by definition this patch can't make things worse.

well, while i agree with the patch it could make things worse. In this case it can cause code that has been compiled to rely on TSC to malfunction. For if sched_clock() was using cpu_has_tsc it could return 0 all the time, breaking the scheduler without the user having a clear idea why it broke. It isnt, and sched_clock() will work fine, but still, your "this cant make things worse" statement is not completely correct.

Hence the "almost". It can't break machines, but it could make the problem harder to diagnose. Given that it will unbreak at least one machine, I'm reasonably confident it's a win :)

Quoted 1 line

Thanks!
Rusty.

#3 lore raw
In reply to Rusty Russell
Quoted 12 lines · Rusty Russell

Linus please apply. Almost by definition this patch can't make things worse.

We handle a broken tsc these days, so no need to panic. We clear the TSC bit when tsc_init decides it's unreliable (eg. under lguest w/ bad host TSC), leading to bogus panic.

diff -r 5e0a39f4d07b arch/x86/kernel/cpu/bugs.c

arch/x86/kernel/cpu/bugs.c static void __init check_config(void) · line 152

Quoted 10 lines
arch/x86/kernel/cpu/bugs.c +0 -7
@@ -143,14 +143,6 @@ static void __init check_config(void)
 #endif
 
 /*
- * If we configured ourselves for a TSC, we'd better have one!
- */
-#ifdef CONFIG_X86_TSC
-	if (!cpu_has_tsc)
-		panic("Kernel compiled for Pentium+, requires TSC feature!");
-#endif
-

CONFIG_X86_TSC means 'cpu has _some_ tsc, rdmsr will work'. If you are confident noone will read broken tsc, please also remove the config option. It is meaningless after your patch.
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html