public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Renninger <trenn@suse.de>
To: Borislav Petkov <bp@amd64.org>
Cc: akpm@linux-foundation.org, davej@redhat.com,
	cpufreq@vger.kernel.org, x86@kernel.org,
	linux-kernel@vger.kernel.org, lenb@kernel.org
Subject: Re: [PATCH 5/5] cpufreq: Add support for actual freq
Date: Tue, 23 Mar 2010 16:12:18 +0100	[thread overview]
Message-ID: <201003231612.18907.trenn@suse.de> (raw)
In-Reply-To: <20100323142349.GG16493@aftab>

On Tuesday 23 March 2010 15:23:49 Borislav Petkov wrote:
> From: Thomas Renninger <trenn@suse.de>
> Date: Tue, Mar 23, 2010 at 12:51:18PM +0100
> 
> Hi,
> 
> > scaling_cur freq should show the frequency the kernel/cpufreq
> > subsystem thinks it's in.
> 
> Well, we have also
> /sys/devices/system/cpu/cpu<NUM>/cpufreq/cpuinfo_cur_freq and it reads
> also policy->cur. Why not show the actual frequency in scaling_cur_freq
> then?
> 
> > You show the average freq and the time of the measured average
> > frequency depends on when the cpufreq subsystem called getavg()
> > the last time.
> > Also the time frame of the average freq the cpufreq subsystem
> > gets when calling getavg() now depends on whether and how often
> > userspace calls scaling_cur_freq which influences switching policy.
> > 
> > Latest cpufrequtils (ver 006) supports cpufreq-aperf to check whether
> > cores enter boost mode. Len Brown afaik also has a userspace tool, but
> > if it has any advantages, it should IMO get integrated into cpufrequtils
> > which people know to use when looking at cpufreq.
> > 
> > I once thought about adding scaling_avg_freq which gets an own
> > aperf_mperf counter, but you don't know whether another app read out the
> > average freq in between and your expected measured time frame is wrong then.
> > You could remember aperf/mperf per pid and free the saved aperf/mperf value
> > if the process dies..., but what for if this can be read out in userspace.
> 
> Ah yes, I see what you mean. Yet, I still don't like the idea of having
> to use a special userspace tool just to read the actual frequency. How
> about we hook into <drivers/cpufreq/cpufreq_ondemand.c:dbs_check_cpu()>
> and passively output the freq_avg after being computed in
> 
>                 freq_avg = __cpufreq_driver_getavg(policy, j);
>                 if (freq_avg <= 0)
>                         freq_avg = policy->cur;
> 
> through sysfs. Hmm...?
But what data would you get then? It's defintely not cur_freq.
It's some kind of average, but you don't know the time frame.

I posted a solution with an extra aperf/mperf save for scaling_avg_freq
(or similar).
First read would return nothing valid.
cat scaling_avg_freq > /dev/null
watch -n1 cat scaling_avg_freq
would return the average freq of the last seconds, exactly the same
what you can do with cpufreq-aperf from userspace.
But if another user app does the same, it's messed up.
You can find out the pid of the process doing the cat and remember
aperf/mperf for it if it does not exist yet..., but now it gets to a
point where cpufreq-aperf is really more convenient and straight foward.

Possibly documenting cpufreq-aperf in Documentation/cpu-freq would
be worth it. Also mentioning "boost" somewhere would be great:
grep -i boost Documentation/cpu-freq/ -r
Documentation/cpu-freq/pcc-cpufreq.txt:This is due to "turbo boost" ...

Another idea is to have a separate cpufreq_avg_freq and update it on
every target() call, but that's overhead...


   Thomas


  parent reply	other threads:[~2010-03-23 15:12 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-22 18:38 [PATCH 0/5] powernow-k8: Core Performance Boost and effective frequency support Borislav Petkov
2010-03-22 18:38 ` [PATCH 1/5] cpufreq: Unify sysfs attribute definition macros Borislav Petkov
2010-03-23 11:07   ` Thomas Renninger
2010-03-23 11:44     ` Borislav Petkov
2010-03-23 11:55       ` Thomas Renninger
2010-03-23 12:05         ` Borislav Petkov
2010-03-23 12:30           ` Thomas Renninger
2010-03-22 18:38 ` [PATCH 2/5] powernow-k8: Add core performance boost support Borislav Petkov
2010-03-23 11:17   ` Thomas Renninger
2010-03-23 11:58     ` Borislav Petkov
2010-03-23 13:27       ` Dominik Brodowski
2010-03-23 14:19         ` Borislav Petkov
2010-03-23 14:47           ` Dominik Brodowski
2010-03-23 16:26             ` Borislav Petkov
2010-03-22 18:38 ` [PATCH 3/5] cpufreq: Add APERF/MPERF support for AMD processors Borislav Petkov
2010-03-23 11:26   ` Thomas Renninger
2010-03-23 11:59     ` Borislav Petkov
2010-03-22 18:38 ` [PATCH 4/5] powernow-k8: Fix frequency reporting Borislav Petkov
2010-03-22 18:38 ` [PATCH 5/5] cpufreq: Add support for actual freq Borislav Petkov
2010-03-23 11:51   ` Thomas Renninger
2010-03-23 14:23     ` Borislav Petkov
2010-03-23 14:41       ` Dominik Brodowski
2010-03-23 15:12       ` Thomas Renninger [this message]
2010-03-24 14:02         ` Borislav Petkov

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=201003231612.18907.trenn@suse.de \
    --to=trenn@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=bp@amd64.org \
    --cc=cpufreq@vger.kernel.org \
    --cc=davej@redhat.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox