From: Daniel Lezcano <daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: Julius Werner <jwerner-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Cc: Kevin Hilman <khilman-l0cyMroinI0@public.gmane.org>,
Deepthi Dharwar
<deepthi-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>,
Trinabh Gupta <g.trinabh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Lists Linaro-dev
<linaro-dev-cunTk1MwBs8s++Sfvej+rw@public.gmane.org>,
linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
"Rafael J. Wysocki" <rjw-KKrjLPT3xs0@public.gmane.org>,
linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
"Srivatsa S. Bhat"
<srivatsa.bhat-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>,
Andrew Morton
<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
Sameer Nanda <snanda-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
Len Brown <lenb-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Subject: Re: [PATCH] cpuidle: Measure idle state durations with monotonic clock
Date: Thu, 15 Nov 2012 11:52:19 +0100 [thread overview]
Message-ID: <50A4C963.9060808@linaro.org> (raw)
In-Reply-To: <1352944590-8776-1-git-send-email-jwerner-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
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@chromium.org>
Tested on a Core 2 Duo (processor_idle driver).
Tested-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.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
_______________________________________________
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev
WARNING: multiple messages have this Message-ID (diff)
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Julius Werner <jwerner@chromium.org>
Cc: Kevin Hilman <khilman@ti.com>,
Deepthi Dharwar <deepthi@linux.vnet.ibm.com>,
Trinabh Gupta <g.trinabh@gmail.com>,
Lists Linaro-dev <linaro-dev@lists.linaro.org>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
"Rafael J. Wysocki" <rjw@sisk.pl>,
linux-acpi@vger.kernel.org,
"Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>,
linuxppc-dev@lists.ozlabs.org, Sameer Nanda <snanda@chromium.org>,
Len Brown <lenb@kernel.org>
Subject: Re: [PATCH] cpuidle: Measure idle state durations with monotonic clock
Date: Thu, 15 Nov 2012 11:52:19 +0100 [thread overview]
Message-ID: <50A4C963.9060808@linaro.org> (raw)
In-Reply-To: <1352944590-8776-1-git-send-email-jwerner@chromium.org>
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@chromium.org>
Tested on a Core 2 Duo (processor_idle driver).
Tested-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.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
WARNING: multiple messages have this Message-ID (diff)
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Julius Werner <jwerner@chromium.org>
Cc: linux-kernel@vger.kernel.org, Len Brown <lenb@kernel.org>,
"Rafael J. Wysocki" <rjw@sisk.pl>, Kevin Hilman <khilman@ti.com>,
Andrew Morton <akpm@linux-foundation.org>,
"Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>,
linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org,
Deepthi Dharwar <deepthi@linux.vnet.ibm.com>,
Trinabh Gupta <g.trinabh@gmail.com>,
Sameer Nanda <snanda@chromium.org>,
Lists Linaro-dev <linaro-dev@lists.linaro.org>
Subject: Re: [PATCH] cpuidle: Measure idle state durations with monotonic clock
Date: Thu, 15 Nov 2012 11:52:19 +0100 [thread overview]
Message-ID: <50A4C963.9060808@linaro.org> (raw)
In-Reply-To: <1352944590-8776-1-git-send-email-jwerner@chromium.org>
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@chromium.org>
Tested on a Core 2 Duo (processor_idle driver).
Tested-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.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
next prev parent reply other threads:[~2012-11-15 10:52 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-13 21:52 [PATCH] cpuidle: Measure idle state durations with monotonic clock Julius Werner
2012-11-13 21:52 ` Julius Werner
2012-11-14 9:06 ` Deepthi Dharwar
2012-11-14 9:06 ` Deepthi Dharwar
2012-11-14 10:57 ` Daniel Lezcano
2012-11-14 10:57 ` Daniel Lezcano
2012-11-14 10:57 ` Daniel Lezcano
2012-11-14 11:05 ` Daniel Lezcano
2012-11-14 11:05 ` Daniel Lezcano
2012-11-14 17:15 ` Julius Werner
2012-11-14 17:15 ` Julius Werner
2012-11-15 1:56 ` Julius Werner
2012-11-15 1:56 ` Julius Werner
2012-11-15 9:04 ` Preeti Murthy
2012-11-15 9:04 ` Preeti Murthy
2012-11-27 6:14 ` Len Brown
2012-11-27 6:14 ` Len Brown
[not found] ` <1352944590-8776-1-git-send-email-jwerner-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2012-11-15 10:52 ` Daniel Lezcano [this message]
2012-11-15 10:52 ` Daniel Lezcano
2012-11-15 10:52 ` Daniel Lezcano
2012-11-21 0:17 ` Rafael J. Wysocki
2012-11-21 0:17 ` Rafael J. Wysocki
2012-11-27 6:15 ` Len Brown
2012-11-27 6:15 ` Len Brown
2012-11-27 19:12 ` Rafael J. Wysocki
2012-11-27 19:12 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50A4C963.9060808@linaro.org \
--to=daniel.lezcano-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
--cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
--cc=deepthi-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
--cc=g.trinabh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=jwerner-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=khilman-l0cyMroinI0@public.gmane.org \
--cc=lenb-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=linaro-dev-cunTk1MwBs8s++Sfvej+rw@public.gmane.org \
--cc=linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=rjw-KKrjLPT3xs0@public.gmane.org \
--cc=snanda-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=srivatsa.bhat-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.