]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
s390/time: fix sched_clock() overflow
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Mon, 14 Jan 2013 15:55:55 +0000 (16:55 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Wed, 16 Jan 2013 14:57:52 +0000 (15:57 +0100)
commited4f20943cd4c7b55105c04daedf8d63ab6d499c
tree3737b2efcd486670eac2cbf5a93bb8fb90964b05
parent7bdc229fad1d42beda70f1966042262470660082
s390/time: fix sched_clock() overflow

Converting a 64 Bit TOD format value to nanoseconds means that the value
must be divided by 4.096. In order to achieve that we multiply with 125
and divide by 512.
When used within sched_clock() this triggers an overflow after appr.
417 days. Resulting in a sched_clock() return value that is much smaller
than previously and therefore may cause all sort of weird things in
subsystems that rely on a monotonic sched_clock() behaviour.

To fix this implement a tod_to_ns() helper function which converts TOD
values without overflow and call this function from both places that
open coded the conversion: sched_clock() and kvm_s390_handle_wait().

Cc: stable@kernel.org
Reviewed-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/include/asm/timex.h
arch/s390/kernel/time.c
arch/s390/kvm/interrupt.c