From: Viresh Kumar <viresh.kumar@linaro.org>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Linux PM <linux-pm@vger.kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Zhang Rui <rui.zhang@intel.com>,
LKML <linux-kernel@vger.kernel.org>,
Doug Smythies <dsmythies@telus.net>
Subject: Re: [PATCH v2 4/4] cpufreq: intel_pstate: Take CPUFREQ_GOV_FLAG_STRICT_TARGET into account
Date: Tue, 10 Nov 2020 08:18:04 +0530 [thread overview]
Message-ID: <20201110024804.j6wrzq7bne7pmwzv@vireshk-i7> (raw)
In-Reply-To: <2345253.LYi3vV7ftd@kreacher>
On 09-11-20, 17:55, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Make intel_pstate take the new CPUFREQ_GOV_FLAG_STRICT_TARGET
> governor flag into account when it operates in the passive mode with
> HWP enabled, so as to fix the "powersave" governor behavior in that
> case (currently, HWP is allowed to scale the performance all the way
> up to the policy max limit when the "powersave" governor is used,
> but it should be constrained to the policy min limit then).
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> drivers/cpufreq/intel_pstate.c | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> Index: linux-pm/drivers/cpufreq/intel_pstate.c
> ===================================================================
> --- linux-pm.orig/drivers/cpufreq/intel_pstate.c
> +++ linux-pm/drivers/cpufreq/intel_pstate.c
> @@ -2527,7 +2527,7 @@ static void intel_cpufreq_trace(struct c
> }
>
> static void intel_cpufreq_adjust_hwp(struct cpudata *cpu, u32 target_pstate,
> - bool fast_switch)
> + bool strict, bool fast_switch)
> {
> u64 prev = READ_ONCE(cpu->hwp_req_cached), value = prev;
>
> @@ -2539,7 +2539,7 @@ static void intel_cpufreq_adjust_hwp(str
> * field in it, so opportunistically update the max too if needed.
> */
> value &= ~HWP_MAX_PERF(~0L);
> - value |= HWP_MAX_PERF(cpu->max_perf_ratio);
> + value |= HWP_MAX_PERF(strict ? target_pstate : cpu->max_perf_ratio);
>
> if (value == prev)
> return;
> @@ -2562,14 +2562,16 @@ static void intel_cpufreq_adjust_perf_ct
> pstate_funcs.get_val(cpu, target_pstate));
> }
>
> -static int intel_cpufreq_update_pstate(struct cpudata *cpu, int target_pstate,
> - bool fast_switch)
> +static int intel_cpufreq_update_pstate(struct cpufreq_policy *policy,
> + int target_pstate, bool fast_switch)
> {
> + struct cpudata *cpu = all_cpu_data[policy->cpu];
> int old_pstate = cpu->pstate.current_pstate;
>
> target_pstate = intel_pstate_prepare_request(cpu, target_pstate);
> if (hwp_active) {
> - intel_cpufreq_adjust_hwp(cpu, target_pstate, fast_switch);
> + intel_cpufreq_adjust_hwp(cpu, target_pstate,
> + policy->strict_target, fast_switch);
> cpu->pstate.current_pstate = target_pstate;
> } else if (target_pstate != old_pstate) {
> intel_cpufreq_adjust_perf_ctl(cpu, target_pstate, fast_switch);
> @@ -2609,7 +2611,7 @@ static int intel_cpufreq_target(struct c
> break;
> }
>
> - target_pstate = intel_cpufreq_update_pstate(cpu, target_pstate, false);
> + target_pstate = intel_cpufreq_update_pstate(policy, target_pstate, false);
>
> freqs.new = target_pstate * cpu->pstate.scaling;
>
> @@ -2628,7 +2630,7 @@ static unsigned int intel_cpufreq_fast_s
>
> target_pstate = DIV_ROUND_UP(target_freq, cpu->pstate.scaling);
>
> - target_pstate = intel_cpufreq_update_pstate(cpu, target_pstate, true);
> + target_pstate = intel_cpufreq_update_pstate(policy, target_pstate, true);
>
> return target_pstate * cpu->pstate.scaling;
> }
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
viresh
next prev parent reply other threads:[~2020-11-10 2:48 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-09 16:49 [PATCH v2 0/4] cpufreq: intel_pstate: Handle powersave governor correctly in the passive mode with HWP Rafael J. Wysocki
2020-11-09 16:51 ` [PATCH v2 1/4] cpufreq: Introduce governor flags Rafael J. Wysocki
2020-11-10 2:41 ` Viresh Kumar
2020-11-10 12:36 ` Rafael J. Wysocki
2020-11-09 16:52 ` [PATCH v2 2/4] cpufreq: Introduce CPUFREQ_GOV_FLAG_STRICT_TARGET Rafael J. Wysocki
2020-11-10 2:41 ` Viresh Kumar
2020-11-09 16:53 ` [PATCH v2 3/4] cpufreq: Add strict_target to struct cpufreq_policy Rafael J. Wysocki
2020-11-10 2:47 ` Viresh Kumar
2020-11-10 12:37 ` Rafael J. Wysocki
2020-11-09 16:55 ` [PATCH v2 4/4] cpufreq: intel_pstate: Take CPUFREQ_GOV_FLAG_STRICT_TARGET into account Rafael J. Wysocki
2020-11-10 2:48 ` Viresh Kumar [this message]
2020-11-10 17:21 ` [PATCH v3 0/4] cpufreq: intel_pstate: Handle powersave governor correctly in the passive mode with HWP Rafael J. Wysocki
2020-11-10 17:25 ` [PATCH v3 1/4] cpufreq: Introduce governor flags Rafael J. Wysocki
2020-11-10 17:26 ` [PATCH v3 2/4] cpufreq: Introduce CPUFREQ_GOV_STRICT_TARGET Rafael J. Wysocki
2020-11-10 17:26 ` [PATCH v3 3/4] cpufreq: Add strict_target to struct cpufreq_policy Rafael J. Wysocki
2020-11-10 17:27 ` [PATCH v3 4/4] cpufreq: intel_pstate: Take CPUFREQ_GOV_STRICT_TARGET into account Rafael J. Wysocki
2020-11-10 21:37 ` [PATCH v3 0/4] cpufreq: intel_pstate: Handle powersave governor correctly in the passive mode with HWP Doug Smythies
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=20201110024804.j6wrzq7bne7pmwzv@vireshk-i7 \
--to=viresh.kumar@linaro.org \
--cc=dsmythies@telus.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=rjw@rjwysocki.net \
--cc=rui.zhang@intel.com \
--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).