linux-kernel-test/arch/x86
Mikael Pettersson df17b1d990 x86, 32-bit: fix boot failure on TSC-less processors
Booting 2.6.26-rc6 on my 486 DX/4 fails with a "BUG: Int 6"
(invalid opcode) and a kernel halt immediately after the
kernel has been uncompressed. The BUG shows EIP pointing
to an rdtsc instruction in native_read_tsc(), invoked from
native_sched_clock().

(This error occurs so early that not even the serial console
can capture it.)

A bisection showed that this bug first occurs in 2.6.26-rc3-git7,
via commit 9ccc906c97:

>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>

The core reason for this bug is that native_sched_clock() gets
called before tsc_init().

Before the commit above, tsc_32.c used a "tsc_enabled" variable
which defaulted to 0 == disabled, and which only got enabled late
in tsc_init(). Thus early calls to native_sched_clock() would skip
the TSC and use jiffies instead.

After the commit above, tsc_32.c uses a "tsc_disabled" variable
which defaults to 0, meaning that the TSC is Ok to use. Early calls
to native_sched_clock() now erroneously try to use the TSC on
!cpu_has_tsc processors, leading to invalid opcode exceptions.

My proposed fix is to initialise tsc_disabled to a "soft disabled"
state distinct from the hard disabled state set up by the "notsc"
kernel option. This fixes the native_sched_clock() problem. It also
allows tsc_init() to be simplified: instead of setting tsc_disabled = 1
on every error return, we just set tsc_disabled = 0 once when all
checks have succeeded.

I've verified that this lets my 486 boot again. I've also verified
that a Core2 machine still uses the TSC as clocksource after the patch.

Signed-off-by: Mikael Pettersson <mikpe@it.uu.se>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-06-19 10:08:47 +02:00
..
boot x86: fix unused variable 'loops' warning in arch/x86/boot/a20.c 2008-06-12 21:27:05 +02:00
configs x86: add optimized inlining 2008-04-26 17:44:55 +02:00
crypto [CRYPTO] aes-x86-32: Remove unused return code 2008-04-21 10:19:21 +08:00
ia32 signals: x86 TS_RESTORE_SIGMASK 2008-04-30 08:29:37 -07:00
kernel x86, 32-bit: fix boot failure on TSC-less processors 2008-06-19 10:08:47 +02:00
kvm KVM: MMU: Fix is_empty_shadow_page() check 2008-06-06 21:36:33 +03:00
lguest lguest: fix ugly <NULL> in /proc/interrupts 2008-05-30 15:09:43 +10:00
lib x86-64: Fix "bytes left to copy" return value for copy_from_user() 2008-06-17 17:47:50 -07:00
mach-default
mach-es7000
mach-generic x86: coding style fixes to arch/x86/mach-generic/bigsmp.c 2008-04-17 17:40:48 +02:00
mach-rdc321x x86, rdc321x: remove watchdog file 2008-04-17 17:40:50 +02:00
mach-visws x86: fix compilation error in VisWS 2008-04-24 23:15:44 +02:00
mach-voyager x86, voyager: fix ioremap_nocache() 2008-04-30 23:15:34 +02:00
math-emu x86: fix broken math-emu with lazy allocation of fpu area 2008-06-04 13:11:46 +02:00
mm Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2008-06-12 12:55:32 -07:00
oprofile x86: oprofile: remove NR_CPUS arrays in arch/x86/oprofile/nmi_int.c 2008-04-19 19:44:58 +02:00
pci Merge branch 'pci-for-jesse' of git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-tip into for-linus 2008-06-12 13:51:05 -07:00
power x86: coding style fixes to arch/x86/power/cpu_32.c 2008-04-17 17:40:50 +02:00
vdso x86: use explicit copy in vdso_gettimeofday() 2008-05-23 14:08:06 +02:00
video x86: video/fbdev.c: add MODULE_LICENSE 2008-05-04 20:04:46 +02:00
xen common implementation of iterative div/mod 2008-06-12 10:47:56 +02:00
Kconfig PCI/x86: fix up PCI stuff so that PCI_GOANY supports OLPC 2008-06-05 14:29:25 -07:00
Kconfig.cpu x86: CONFIG_X86_ELAN fix 2008-04-30 23:15:35 +02:00
Kconfig.debug x86: fix CONFIG_NONPROMISC_DEVMEM prompt and help text 2008-06-05 14:21:45 -07:00
Makefile x86: add subarch support (for headers) to x86_64 2008-04-17 17:41:01 +02:00
Makefile_32.cpu