All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpufreq: intel_pstate: fix pstate limits enforcement for adjust_perf call back
@ 2024-02-17 21:30 Doug Smythies
  2024-02-22 19:13 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Doug Smythies @ 2024-02-17 21:30 UTC (permalink / raw)
  To: srinivas.pandruvada, rafael, lenb
  Cc: linux-kernel, linux-pm, vincent.guittot, dsmythies

There is a loophole in pstate limit clamping for the intel_cpufreq CPU
frequency scaling driver (intel_pstate in passive mode), schedutil CPU
frequency scaling governor, HWP (HardWare Pstate) control enabled, when
the adjust_perf call back path is used.

Fix it.

Signed-off-by: Doug Smythies <dsmythies@telus.net>
---
 drivers/cpufreq/intel_pstate.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index ca94e60e705a..79619227ea51 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -2987,6 +2987,9 @@ static void intel_cpufreq_adjust_perf(unsigned int cpunum,
 	if (min_pstate < cpu->min_perf_ratio)
 		min_pstate = cpu->min_perf_ratio;
 
+	if (min_pstate > cpu->max_perf_ratio)
+		min_pstate = cpu->max_perf_ratio;
+
 	max_pstate = min(cap_pstate, cpu->max_perf_ratio);
 	if (max_pstate < min_pstate)
 		max_pstate = min_pstate;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cpufreq: intel_pstate: fix pstate limits enforcement for adjust_perf call back
  2024-02-17 21:30 [PATCH] cpufreq: intel_pstate: fix pstate limits enforcement for adjust_perf call back Doug Smythies
@ 2024-02-22 19:13 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2024-02-22 19:13 UTC (permalink / raw)
  To: Doug Smythies
  Cc: srinivas.pandruvada, rafael, lenb, linux-kernel, linux-pm,
	vincent.guittot

On Sat, Feb 17, 2024 at 10:30 PM Doug Smythies <dsmythies@telus.net> wrote:
>
> There is a loophole in pstate limit clamping for the intel_cpufreq CPU
> frequency scaling driver (intel_pstate in passive mode), schedutil CPU
> frequency scaling governor, HWP (HardWare Pstate) control enabled, when
> the adjust_perf call back path is used.
>
> Fix it.
>
> Signed-off-by: Doug Smythies <dsmythies@telus.net>
> ---
>  drivers/cpufreq/intel_pstate.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
> index ca94e60e705a..79619227ea51 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -2987,6 +2987,9 @@ static void intel_cpufreq_adjust_perf(unsigned int cpunum,
>         if (min_pstate < cpu->min_perf_ratio)
>                 min_pstate = cpu->min_perf_ratio;
>
> +       if (min_pstate > cpu->max_perf_ratio)
> +               min_pstate = cpu->max_perf_ratio;
> +
>         max_pstate = min(cap_pstate, cpu->max_perf_ratio);
>         if (max_pstate < min_pstate)
>                 max_pstate = min_pstate;
> --

Applied as 6.9 material, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-22 19:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-17 21:30 [PATCH] cpufreq: intel_pstate: fix pstate limits enforcement for adjust_perf call back Doug Smythies
2024-02-22 19:13 ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.