linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Linux PM list <linux-pm@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Subject: Re: [PATCH] cpufreq: stats: Make the stats code non-modular
Date: Mon, 30 May 2016 10:23:48 +0530	[thread overview]
Message-ID: <20160530045348.GA26787@vireshk-i7> (raw)
In-Reply-To: <5665576.VhylybbIm6@vostro.rjw.lan>

On 28-05-16, 15:15, Rafael J. Wysocki wrote:
> It does, but there's a problem.
> 
> If fast frequency switching is in use, the stats attributes just sit there
> full of zeros (because the stats are not updated then) which is confusing.
> 
> Of course, the ultimate solution here would be to make the stats actually
> work with fast frequency switching, but that requires some major surgery of
> the stats code, so for now I'd like to simply make those attributes return
> nothing if fast frequency switching is enabled for the policy (returning
> -EBUSY from there, which would have been cleaner, unfortunately breaks
> powertop).

What's stopping us from doing that? Sorry I don't remember that well :(

I mean, why can't we call cpufreq_stats_record_transition() somehow via that
code ?

> Updated patch is below.
> 
> ---
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Subject: [PATCH] cpufreq: stats: Make the stats code non-modular
> 
> The modularity of cpufreq_stats is quite problematic.
> 
> First off, the usage of policy notifiers for the initialization
> and cleanup in the cpufreq_stats module is inherently racy with
> respect to CPU offline/online and the initialization and cleanup
> of the cpufreq driver.
> 
> Second, fast frequency switching (used by the schedutil governor)
> cannot be enabled if any transition notifiers are registered, so
> if the cpufreq_stats module (that registers a transition notifier
> for updating transition statistics) is loaded, the schedutil governor
> cannot use fast frequency switching.
> 
> On the other hand, allowing cpufreq_stats to be built as a module
> doesn't really add much value.  Arguably, there's not much reason
> for that code to be modular at all.
> 
> For the above reasons, make the cpufreq stats code non-modular,
> modify the core to invoke functions provided by that code directly
> and drop the notifiers from it.
> 
> Make the stats sysfs attributes appear empty if fast frequency
> switching is enabled as the statistics will not be updated in that
> case anyway (and returning -EBUSY from those attributes breaks
> powertop).
> 
> While at it, clean up Kconfig help for the CPU_FREQ_STAT and
> CPU_FREQ_STAT_DETAILS options.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>  drivers/cpufreq/Kconfig         |   13 +--
>  drivers/cpufreq/cpufreq.c       |    4 +
>  drivers/cpufreq/cpufreq_stats.c |  152 +++++-----------------------------------
>  include/linux/cpufreq.h         |   12 +++
>  4 files changed, 40 insertions(+), 141 deletions(-)

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh

  reply	other threads:[~2016-05-30  4:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-25 22:23 [PATCH] cpufreq: stats: Make the stats code non-modular Rafael J. Wysocki
2016-05-26  4:59 ` Viresh Kumar
2016-05-28 13:15   ` Rafael J. Wysocki
2016-05-30  4:53     ` Viresh Kumar [this message]
2016-05-30 13:43       ` Rafael J. Wysocki
2016-05-31 10:44     ` Viresh Kumar
2016-05-31 20:47       ` 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=20160530045348.GA26787@vireshk-i7 \
    --to=viresh.kumar@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=srinivas.pandruvada@linux.intel.com \
    /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).