kernel_optimize_test/arch/s390
Heiko Carstens 3d7efa4edd 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>
2019-10-31 17:26:48 +01:00
..
appldata
boot s390/kaslr: add support for R_390_GLOB_DAT relocation type 2019-10-22 17:55:51 +02:00
configs s390: update defconfigs 2019-10-04 16:37:33 +02:00
crypto Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2019-09-18 12:11:14 -07:00
hypfs Merge branch 'work.mount3' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2019-09-24 12:33:34 -07:00
include s390/unwind: fix mixing regs and sp 2019-10-31 17:26:48 +01:00
kernel s390/idle: fix cpu idle time calculation 2019-10-31 17:26:48 +01:00
kvm KVM: s390: mark __insn32_query() as __always_inline 2019-10-05 13:51:22 +02:00
lib s390 updates for the 5.4 merge window 2019-09-17 14:04:43 -07:00
mm s390/cmm: fix information leak in cmm_timeout_handler() 2019-10-31 17:26:48 +01:00
net
numa
oprofile
pci s390/pci: mark function(s) __always_inline 2019-10-04 16:37:33 +02:00
purgatory
scripts
tools s390: add support for IBM z15 machines 2019-09-13 12:19:14 +02:00
Kbuild
Kconfig Merge branch 'next-lockdown' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security 2019-09-28 08:14:15 -07:00
Kconfig.debug
Makefile s390: add support for IBM z15 machines 2019-09-13 12:19:14 +02:00