linux/arch
Salman Qazi 9993bc635d sched/x86: Fix overflow in cyc2ns_offset
When a machine boots up, the TSC generally gets reset.  However,
when kexec is used to boot into a kernel, the TSC value would be
carried over from the previous kernel.  The computation of
cycns_offset in set_cyc2ns_scale is prone to an overflow, if the
machine has been up more than 208 days prior to the kexec.  The
overflow happens when we multiply *scale, even though there is
enough room to store the final answer.

We fix this issue by decomposing tsc_now into the quotient and
remainder of division by CYC2NS_SCALE_FACTOR and then performing
the multiplication separately on the two components.

Refactor code to share the calculation with the previous
fix in __cycles_2_ns().

Signed-off-by: Salman Qazi <sqazi@google.com>
Acked-by: John Stultz <john.stultz@linaro.org>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Turner <pjt@google.com>
Cc: john stultz <johnstul@us.ibm.com>
Link: http://lkml.kernel.org/r/20120310004027.19291.88460.stgit@dungbeetle.mtv.corp.google.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2012-03-13 16:27:51 +01:00
..
alpha alpha: fix 32/64-bit bug in futex support 2012-03-05 15:49:43 -08:00
arm Linux 3.3-rc7 2012-03-13 16:26:52 +01:00
avr32 sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
blackfin sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
c6x C6X: fix KSTK_EIP and KSTK_ESP macros 2012-03-07 11:28:22 -05:00
cris sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
frv sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
h8300 sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
hexagon sched: Cleanup cpu_active madness 2012-03-12 20:43:15 +01:00
ia64 sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
m32r sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
m68k sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
microblaze sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
mips Linux 3.3-rc7 2012-03-13 16:26:52 +01:00
mn10300 sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
openrisc openrisc: Fix up audit_syscall_[entry|exit]() usage 2012-02-17 09:53:12 +01:00
parisc Linux 3.3-rc7 2012-03-13 16:26:52 +01:00
powerpc sched/rt: Document scheduler related skip-resched-check sites 2012-03-01 10:28:04 +01:00
s390 Linux 3.3-rc7 2012-03-13 16:26:52 +01:00
score sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
sh sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
sparc sched/rt: Document scheduler related skip-resched-check sites 2012-03-01 10:28:04 +01:00
tile sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
um Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit 2012-01-17 16:41:31 -08:00
unicore32 Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci 2012-01-11 18:50:26 -08:00
x86 sched/x86: Fix overflow in cyc2ns_offset 2012-03-13 16:27:51 +01:00
xtensa sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
.gitignore
Kconfig mm,x86,um: move CMPXCHG_DOUBLE config option 2012-01-12 20:13:03 -08:00