summaryrefslogtreecommitdiff
path: root/arch/arm64/include
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2019-10-28 13:03:27 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-11-06 14:43:35 +0300
commitc12fc95b876904ef2e8037554eb395609974bbea (patch)
treeb4f7459871bae356210e91396cb0e677fbc2d23c /arch/arm64/include
parent119e9aef452a6b6976d20dac8f35aa2dc3e01348 (diff)
downloadlinux-c12fc95b876904ef2e8037554eb395609974bbea.tar.xz
s390/idle: fix cpu idle time calculation
commit 3d7efa4edd07be5c5c3ffa95ba63e97e070e1f3f upstream. The idle time reported in /proc/stat sometimes incorrectly contains huge values on s390. This is caused by a bug in arch_cpu_idle_time(). The kernel tries to figure out when a different cpu entered idle by accessing its per-cpu data structure. There is an ordering problem: if the remote cpu has an idle_enter value which is not zero, and an idle_exit value which is zero, it is assumed it is idle since "now". The "now" timestamp however is taken before the idle_enter value is read. Which in turn means that "now" can be smaller than idle_enter of the remote cpu. Unconditionally subtracting idle_enter from "now" can thus lead to a negative value (aka large unsigned value). Fix this by moving the get_tod_clock() invocation out of the loop. While at it also make the code a bit more readable. A similar bug also exists for show_idle_time(). Fix this is as well. Cc: <stable@vger.kernel.org> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/arm64/include')
0 files changed, 0 insertions, 0 deletions