linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saravana Kannan <skannan@codeaurora.org>
To: Thomas Renninger <trenn@suse.de>, Dave Jones <davej@redhat.com>
Cc: cpufreq <cpufreq@vger.kernel.org>,
	linux-arm-msm <linux-arm-msm@vger.kernel.org>
Subject: Re: CPUfreq - udelay() interaction issues
Date: Thu, 22 Apr 2010 16:37:52 -0700	[thread overview]
Message-ID: <4BD0DDD0.2070604@codeaurora.org> (raw)
In-Reply-To: <201004230118.32147.trenn@suse.de>

Looks like our emails just crossed each other.

Thomas Renninger wrote:
> On Thursday 22 April 2010 11:22:20 pm Saravana Kannan wrote:
>> Dave, Venkatesh and other maintainers,
>>
>> Any comments?
> From adjust_jiffies in cpufreq.c:
>  * adjust_jiffies - adjust the system "loops_per_jiffy"
>  *
>  * This function alters the system "loops_per_jiffy" for the clock
>  * speed change. Note that loops_per_jiffy cannot be updated on SMP
>  * systems as each CPU might be scaled differently. So, use the arch
>  * per-CPU loops_per_jiffy value wherever possible.
> For SMP case adjust_jiffies is just empty.
> 
> udelay on x86 uses the per cpu loops_per_jiffy:
> cpu_data(raw_smp_processor_id()).loops_per_jiffy
> 
> which does not get adjusted via adjust_jiffies()

Yes. That's why one of my questions/assumptions in my prev email was 
about adjusting jiffies in SMP case.

So, can I get a confirmation on the following from the maintainers?
* For proper operation in SMP case, CPUfreq core expects the CPUfreq 
driver to adjust the per-CPU jiffies.

Without that confirmation, I really can't claim to have found any 
issues. Although, if the above is not the expectation, then turning on 
CPUfreq should mandate booting up at the highest freq (see next point) 
-- which is not realistic.

> For me it looks as udelay is always wrong and sleeps too long
> on lower frequencies, but I may oversee something.

Not only that, but if the boot up freq is not the highest freq, then 
udelay is going to sleep shorter than the requested period on any freq 
higher than the boot up freq.

> It shouldn't be that hard to test this with a tiny test module
> which is measuring real udelay sleep times via tsc reads on a x86 machine
> with stable tsc. Doing that in a loop, print out the diff to how long
> it should have slept and doing that under lowered freq or whatever bad
> circumstances, should show worst cases after some time.

I'm not sure there is a real need to test here. If the maintainers can 
confirm that the cpufreq core expects the cpufreq drivers to handle the 
jiffy adjusting for SMP cases, then it's clear that there are a few bugs.

Also, for the "context switch issue" (issue 1), it's going to be hard to 
produce the exact scenario during testing and we may never hit it, but 
it would still be an issue.

Any comments on the "CPU affinity issue"?

Thanks,
Saravana

  reply	other threads:[~2010-04-22 23:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-22  3:34 CPUfreq - udelay() interaction issues Saravana Kannan
2010-04-22 21:22 ` Saravana Kannan
2010-04-22 23:18   ` Thomas Renninger
2010-04-22 23:37     ` Saravana Kannan [this message]
2010-04-22 23:21 ` Saravana Kannan
2010-04-23 18:40   ` Mathieu Desnoyers
2010-04-23 19:22     ` Arjan van de Ven
2010-04-23 19:55       ` Mathieu Desnoyers
2010-04-24 18:56         ` Arjan van de Ven
2010-04-24 21:00           ` Mathieu Desnoyers
2010-04-24 23:20             ` Arjan van de Ven
2010-04-24  2:57       ` Saravana Kannan
2010-04-24  2:49     ` Saravana Kannan
2010-04-24  5:56       ` Pavel Machek
2010-04-24 13:58       ` Mathieu Desnoyers
2010-04-27 23:41         ` Saravana Kannan

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=4BD0DDD0.2070604@codeaurora.org \
    --to=skannan@codeaurora.org \
    --cc=cpufreq@vger.kernel.org \
    --cc=davej@redhat.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=trenn@suse.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).