public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
* cpu clock change latency
@ 2011-09-23 14:39 Marc Dietrich
       [not found] ` <201109231639.33651.marvin24-Mmb7MZpHnFY@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Marc Dietrich @ 2011-09-23 14:39 UTC (permalink / raw)
  To: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
  Cc: Stephen Warren, Olof Johansson, Colin Cross, Allen Martin

Hi,

arch/arm/mach-tegra/cpu-tegra.c (as from nv-tegra.nvidia.com) contains a some 
strange comment:

 493         /* FIXME: what's the actual transition time? */
 494         policy->cpuinfo.transition_latency = 300 * 1000;

The trees on chromeos.org (both, kernel and kernel-next) have:

 392         /* cpu clock change latency: ~400us */
 393         policy->cpuinfo.transition_latency = 400;

because according to 

http://git.chromium.org/gitweb/?p=chromiumos/third_party/kernel.git;a=commitdiff;h=6a4debe346f5946f4fab14b413885896b7cde324

this improves latency of the GUI. Note that the comment said "us", while the cpu 
transition latency is measured in "ns", so 400 * 1000 would be right. 

So either the comment is wrong (should be 400ns) or the patch is wrong (which is 
unlikely, because it improved latency in the testcase).

Can someone comment on this?

Thanks

Marc

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: cpu clock change latency
       [not found] ` <201109231639.33651.marvin24-Mmb7MZpHnFY@public.gmane.org>
@ 2011-09-23 16:44   ` Allen Martin
  2011-09-23 16:49   ` Colin Cross
  1 sibling, 0 replies; 5+ messages in thread
From: Allen Martin @ 2011-09-23 16:44 UTC (permalink / raw)
  To: 'Marc Dietrich',
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
  Cc: Stephen Warren, Olof Johansson, Colin Cross

> this improves latency of the GUI. Note that the comment said "us", while the
> cpu transition latency is measured in "ns", so 400 * 1000 would be right.
> 
> So either the comment is wrong (should be 400ns) or the patch is wrong
> (which is unlikely, because it improved latency in the testcase).
> 

You're right, the patch is wrong.  It should be 400us.  So the original code was much closer to the correct value.

The ondemand governor samples at 1000 times the transition latency, so it's not surprising it works fine with the wrong value at least with ondemand.  The interactive governor in android ignores transition latency.

Perhaps a better fix would be to make the hardcoded LATENCY_MULTIPLIER in the ondemand governor a tunable?

-Allen

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: cpu clock change latency
       [not found] ` <201109231639.33651.marvin24-Mmb7MZpHnFY@public.gmane.org>
  2011-09-23 16:44   ` Allen Martin
@ 2011-09-23 16:49   ` Colin Cross
       [not found]     ` <CAMbhsRTiqLZ2bSefh-DnmDY0RB4JGkSmumh8Tt_7217BsHsa7Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  1 sibling, 1 reply; 5+ messages in thread
From: Colin Cross @ 2011-09-23 16:49 UTC (permalink / raw)
  To: Marc Dietrich
  Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Stephen Warren, Olof Johansson, Allen Martin

On Fri, Sep 23, 2011 at 7:39 AM, Marc Dietrich <marvin24-Mmb7MZpHnFY@public.gmane.org> wrote:
> Hi,
>
> arch/arm/mach-tegra/cpu-tegra.c (as from nv-tegra.nvidia.com) contains a some
> strange comment:
>
>  493         /* FIXME: what's the actual transition time? */
>  494         policy->cpuinfo.transition_latency = 300 * 1000;
>
> The trees on chromeos.org (both, kernel and kernel-next) have:
>
>  392         /* cpu clock change latency: ~400us */
>  393         policy->cpuinfo.transition_latency = 400;
>
> because according to
>
> http://git.chromium.org/gitweb/?p=chromiumos/third_party/kernel.git;a=commitdiff;h=6a4debe346f5946f4fab14b413885896b7cde324
>
> this improves latency of the GUI. Note that the comment said "us", while the cpu
> transition latency is measured in "ns", so 400 * 1000 would be right.
>
> So either the comment is wrong (should be 400ns) or the patch is wrong (which is
> unlikely, because it improved latency in the testcase).
>
> Can someone comment on this?

cpu-tegra.c says latency is 300 uS because relocking the CPU pll has a
udelay(300).  400 nS would just make the ondemand governor sample more
often than it means to.  I doubt changing it to 400 uS makes any
difference.

> Thanks
>
> Marc
> --
> To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: cpu clock change latency
       [not found]     ` <CAMbhsRTiqLZ2bSefh-DnmDY0RB4JGkSmumh8Tt_7217BsHsa7Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2011-09-27 15:30       ` Mark Brown
       [not found]         ` <20110927153021.GA16150-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2011-09-27 15:30 UTC (permalink / raw)
  To: Colin Cross
  Cc: Marc Dietrich,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Stephen Warren, Olof Johansson, Allen Martin

On Fri, Sep 23, 2011 at 09:49:53AM -0700, Colin Cross wrote:

> cpu-tegra.c says latency is 300 uS because relocking the CPU pll has a
> udelay(300).  400 nS would just make the ondemand governor sample more
> often than it means to.  I doubt changing it to 400 uS makes any
> difference.

The interactive effect of a higher transition latency with ondemand can
be rather visible.

It's probably also worth mentioning that if there's regulators used for
voltage scaling the system really ought to be including latency for them
in the estimate, for voltage increases the regulator needs to be updated
prior to the SoC side starting off.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: cpu clock change latency
       [not found]         ` <20110927153021.GA16150-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
@ 2011-09-27 19:31           ` Marc Dietrich
  0 siblings, 0 replies; 5+ messages in thread
From: Marc Dietrich @ 2011-09-27 19:31 UTC (permalink / raw)
  To: Mark Brown
  Cc: Colin Cross, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Stephen Warren, Olof Johansson, Allen Martin

On Tuesday 27 September 2011 17:30:22 Mark Brown wrote:
> On Fri, Sep 23, 2011 at 09:49:53AM -0700, Colin Cross wrote:
> > cpu-tegra.c says latency is 300 uS because relocking the CPU pll has a
> > udelay(300).  400 nS would just make the ondemand governor sample more
> > often than it means to.  I doubt changing it to 400 uS makes any
> > difference.
> 
> The interactive effect of a higher transition latency with ondemand can
> be rather visible.

True, given the 400 µs latency and the multiplier of 1000 we end up having 
a sample_rate of the ondemand scheduler of 0.4 seconds, which is very 
"feelable". My AMD desktop announces a 1 µs latency so the default sampling 
rate is only 10 ms. 

A transition latency of 400 ns will set the sampling_rate to 10 ms (the 
minimum value allowed, so 10 µs would have the same effect). 

So doing an "echo 40000 > 
/sys/devices/system/cpu/cpufreq/ondemand/sampling_rate" is the best we can 
do now and almost produces the same result as 10000. 

We additionaly found that setting io_is_busy=1 improves the transfer rate 
of the mmc by 50%. 

> It's probably also worth mentioning that if there's regulators used for
> voltage scaling the system really ought to be including latency for them
> in the estimate, for voltage increases the regulator needs to be updated
> prior to the SoC side starting off.

which would make things even worse :-(

Marc

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-09-27 19:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-23 14:39 cpu clock change latency Marc Dietrich
     [not found] ` <201109231639.33651.marvin24-Mmb7MZpHnFY@public.gmane.org>
2011-09-23 16:44   ` Allen Martin
2011-09-23 16:49   ` Colin Cross
     [not found]     ` <CAMbhsRTiqLZ2bSefh-DnmDY0RB4JGkSmumh8Tt_7217BsHsa7Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-09-27 15:30       ` Mark Brown
     [not found]         ` <20110927153021.GA16150-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2011-09-27 19:31           ` Marc Dietrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox