[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <50A4C963.9060808@linaro.org>
Date: Thu, 15 Nov 2012 11:52:19 +0100
From: Daniel Lezcano <daniel.lezcano@...aro.org>
To: Julius Werner <jwerner@...omium.org>
CC: linux-kernel@...r.kernel.org, Len Brown <lenb@...nel.org>,
"Rafael J. Wysocki" <rjw@...k.pl>, Kevin Hilman <khilman@...com>,
Andrew Morton <akpm@...ux-foundation.org>,
"Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>,
linux-acpi@...r.kernel.org, linux-pm@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org,
Deepthi Dharwar <deepthi@...ux.vnet.ibm.com>,
Trinabh Gupta <g.trinabh@...il.com>,
Sameer Nanda <snanda@...omium.org>,
Lists Linaro-dev <linaro-dev@...ts.linaro.org>
Subject: Re: [PATCH] cpuidle: Measure idle state durations with monotonic
clock
On 11/15/2012 02:56 AM, Julius Werner wrote:
> 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@...omium.org>
Tested on a Core 2 Duo (processor_idle driver).
Tested-by: Daniel Lezcano <daniel.lezcano@...aro.org>
Acked-by: Daniel Lezcano <daniel.lezcano@...aro.org>
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists