diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2019-10-28 13:03:27 +0300 |
---|---|---|
committer | Vasily Gorbik <gor@linux.ibm.com> | 2019-10-31 19:26:48 +0300 |
commit | 3d7efa4edd07be5c5c3ffa95ba63e97e070e1f3f (patch) | |
tree | 7b086d413d56374438633850d74f14bf82846581 /security | |
parent | a1d863ac3e1085e1fea9caafd87252d08731de2e (diff) | |
download | linux-3d7efa4edd07be5c5c3ffa95ba63e97e070e1f3f.tar.xz |
s390/idle: fix cpu idle time calculation
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>
Diffstat (limited to 'security')
0 files changed, 0 insertions, 0 deletions