linux/arch/powerpc/platforms
Julius Werner a474a51549 cpuidle: Measure idle state durations with monotonic clock
Many cpuidle drivers measure their time spent in an idle state by
reading the wallclock time before and after idling and calculating the
difference. This leads to erroneous results when the wallclock time gets
updated by another processor in the meantime, adding that clock
adjustment to the idle state's time counter.

If the clock adjustment was negative, the result is even worse due to an
erroneous cast from int to unsigned long long of the last_residency
variable. The negative 32 bit integer will zero-extend and result in a
forward time jump of roughly four billion milliseconds or 1.3 hours on
the idle state residency counter.

This patch changes all affected cpuidle drivers to either use the
monotonic clock for their measurements or make use of the generic time
measurement wrapper in cpuidle.c, which was already working correctly.
Some superfluous CLIs/STIs in the ACPI code are removed (interrupts
should always already be disabled before entering the idle function, and
not get reenabled until the generic wrapper has performed its second
measurement). It also removes the erroneous cast, making sure that
negative residency values are applied correctly even though they should
not appear anymore.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Preeti U Murthy <preeti@linux.vnet.ibm.com>
Tested-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Len Brown <len.brown@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2012-11-27 14:17:58 +01:00
..
8xx Disintegrate asm/system.h for PowerPC 2012-03-28 18:30:02 +01:00
40x sections: fix section conflicts in arch/powerpc 2012-10-06 03:04:39 +09:00
44x powerpc/swiotlb: Enable at early stage and disable if not necessary 2012-09-12 14:57:09 -05:00
52xx Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc 2012-10-06 03:16:12 +09:00
82xx powerpc/82xx: add SPI support for mgcoge 2012-07-10 07:07:20 -05:00
83xx sections: fix section conflicts in arch/powerpc 2012-10-06 03:04:39 +09:00
85xx Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc 2012-10-06 03:16:12 +09:00
86xx powerpc/fsl-pci: Unify pci/pcie initialization code 2012-09-12 14:57:12 -05:00
512x Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc 2012-10-06 03:16:12 +09:00
amigaone pcspkr: Cleanup Kconfig dependencies 2011-06-09 15:01:41 +02:00
cell Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc 2012-10-06 03:16:12 +09:00
chrp powerpc/mpic: Remove duplicate MPIC_WANTS_RESET flag 2012-02-23 10:50:00 +11:00
embedded6xx Disintegrate asm/system.h for PowerPC 2012-03-28 18:30:02 +01:00
maple Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
pasemi powerpc: Remove all includes of <asm/abs_addr.h> 2012-09-05 15:19:33 +10:00
powermac Merge branch 'merge' into next 2012-05-09 10:57:57 +10:00
powernv powerpc/powernv: Remove unused functions 2012-09-17 16:35:16 +10:00
prep powerpc: drop unused Kconfig symbols 2011-10-31 23:39:52 +01:00
ps3 powerpc/mm: Convert virtual address to vpn 2012-09-17 16:31:49 +10:00
pseries cpuidle: Measure idle state durations with monotonic clock 2012-11-27 14:17:58 +01:00
wsp Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
fsl_uli1575.c Disintegrate asm/system.h for PowerPC 2012-03-28 18:30:02 +01:00
Kconfig KVM: PPC: Factor out guest epapr initialization 2012-05-30 11:43:10 +02:00
Kconfig.cputype cputime: Generalize CONFIG_VIRT_CPU_ACCOUNTING 2012-08-17 16:31:08 +02:00
Makefile powerpc: Remove the main legacy iSerie platform code 2012-03-09 10:35:11 +11:00