public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Jason Baron <jbaron@akamai.com>
Cc: viresh.kumar@linaro.org, cpufreq@vger.kernel.org,
	linux-pm@vger.kernel.org,
	Dirk Brandewie <dirk.j.brandewie@intel.com>,
	dirk.brandewie@gmail.com
Subject: Re: [PATCH] cpufreq: Apply default governor for setpolicy drivers
Date: Wed, 18 Dec 2013 22:38:38 +0100	[thread overview]
Message-ID: <1451068.r0h0sa1DaG@vostro.rjw.lan> (raw)
In-Reply-To: <20131218203102.9F9692036@prod-mail-relay06.akamai.com>

On Wednesday, December 18, 2013 08:31:02 PM Jason Baron wrote:
> When configuring a default governor (via CONFIG_CPU_FREQ_DEFAULT_*) with the
> 'intel_pstate' driver, I found that the default is not honored. For example,
> configure 'CONFIG_CPU_FREQ_GOV_PERFORMANCE', and then do:

intel_pstate doesn't use any cpufreq governors, so all of this is pointless
for that particular driver anyway.

Thanks!

> # cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
> powersave
> 
> However, I can do:
> 
> echo "performance" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
> 
> and it takes properly.
> 
> Fix by setting the default governor, if its either 'powersave' or 'performance'.
> Otherwise, fall back to what the driver originally set via its 'init' routine.
> 
> Signed-off-by: Jason Baron <jbaron@akamai.com>
> ---
>  drivers/cpufreq/cpufreq.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 02d534d..931fa67 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -826,8 +826,19 @@ static void cpufreq_init_policy(struct cpufreq_policy *policy)
>  {
>  	struct cpufreq_policy new_policy;
>  	int ret = 0;
> +	int init_policy;
>  
>  	memcpy(&new_policy, policy, sizeof(*policy));
> +
> +	/* honor the default governor policy, unless its invalid */
> +	if (cpufreq_driver->setpolicy) {
> +		init_policy = new_policy.policy;
> +		if (cpufreq_parse_governor(policy->governor->name,
> +				&new_policy.policy, &new_policy.governor)) {
> +			new_policy.policy = init_policy;
> +		}
> +	}
> +
>  	/* assure that the starting sequence is run in cpufreq_set_policy */
>  	policy->governor = NULL;
>  
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

  reply	other threads:[~2013-12-18 21:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-18 20:31 [PATCH] cpufreq: Apply default governor for setpolicy drivers Jason Baron
2013-12-18 21:38 ` Rafael J. Wysocki [this message]
2013-12-18 21:35   ` Jason Baron
2013-12-18 23:33     ` Rafael J. Wysocki
2013-12-19  3:51       ` Jason Baron
2013-12-19 13:18         ` Rafael J. Wysocki
2013-12-19  5:27       ` Viresh Kumar
2013-12-19 13:16         ` 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=1451068.r0h0sa1DaG@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=cpufreq@vger.kernel.org \
    --cc=dirk.brandewie@gmail.com \
    --cc=dirk.j.brandewie@intel.com \
    --cc=jbaron@akamai.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=viresh.kumar@linaro.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