linux/arch/x86
John Stultz 62627bec8a x86: tsc: Fix calibration refinement conditionals to avoid divide by zero
Konrad Wilk reported that the new delayed calibration crashes with a
divide by zero on Xen. The reason is that Xen sets the pmtimer
address, but reading from it returns 0xffffff. That results in the
ref_start and ref_stop value being the same, so the delta is zero
which causes the divide by zero later in the calculation.

The conditional (!hpet && !ref_start && !ref_stop) which sanity checks
the calibration reference values doesn't really make sense. If the
refs are null, but hpet is on, we still want to break out.

The div by zero would be possible to trigger by chance if both reads
from the hardware provided the exact same value (due to hardware
wrapping).

So checking if both the ref values are the same should handle if we
don't have hardware (both null) or if they are the same value (either by
invalid hardware, or by chance), avoiding the div by zero issue.

[ tglx: Applied the same fix to native_calibrate_tsc() where this
  	check was copied from ]

Reported-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: John Stultz <johnstul@us.ibm.com>
LKML-Reference: <1295024788-15619-1-git-send-email-johnstul@us.ibm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2011-01-14 18:28:01 +01:00
..
boot Merge branch 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2011-01-06 10:56:02 -08:00
configs
crypto crypto: ghash-intel - ghash-clmulni-intel_glue needs err.h 2010-12-15 19:44:08 +08:00
ia32 BKL: remove extraneous #include <smp_lock.h> 2010-11-17 08:59:32 -08:00
include/asm x86: Fix Moorestown VRTC fixmap placement 2011-01-11 12:46:16 +01:00
kernel x86: tsc: Fix calibration refinement conditionals to avoid divide by zero 2011-01-14 18:28:01 +01:00
kvm KVM: i8259: initialize isr_ack 2011-01-02 11:52:48 +02:00
lguest x86, mm: Initialize initial_page_table before paravirt jumps 2011-01-04 09:53:50 +01:00
lib
math-emu
mm Merge branch 'x86/numa' into x86/urgent 2011-01-10 09:36:07 +01:00
oprofile Merge branch 'x86-mce-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2011-01-06 11:05:21 -08:00
pci x86: Use PCI method for enabling AMD extended config space before MSR method 2011-01-11 12:43:41 +01:00
platform Merge branch 'linus' into x86/apic-cleanups 2011-01-07 14:14:15 +01:00
power
tools
vdso x86, gcc-4.6: Use gcc -m options when building vdso 2010-12-13 16:08:37 -08:00
video
xen Merge branches 'x86-fixes-for-linus', 'perf-fixes-for-linus' and 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-12-08 06:40:59 -08:00
.gitignore
Kbuild x86: Add platform directory 2010-10-27 14:30:01 +02:00
Kconfig Merge branch 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2011-01-06 11:06:31 -08:00
Kconfig.cpu
Kconfig.debug x86: Add RO/NX protection for loadable kernel modules 2010-11-18 13:32:56 +01:00
Makefile Merge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-10-21 13:06:00 -07:00
Makefile_32.cpu jump label: Add work around to i386 gcc asm goto bug 2010-10-29 14:45:29 -04:00