public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux PM <linux-pm@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Subject: [PATCH v1 5/6] cpufreq: intel_pstate: Replace three global.turbo_disabled checks
Date: Mon, 25 Mar 2024 18:05:06 +0100	[thread overview]
Message-ID: <3813405.kQq0lBPeGt@kreacher> (raw)
In-Reply-To: <13494237.uLZWGnKmhe@kreacher>

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Replace the global.turbo_disabled in __intel_pstate_update_max_freq() with
a global.no_turbo one to make store_no_turbo() actually update the maximum
CPU frequency on the trubo preference changes, which needs to be consistent
with arch_set_max_freq_ratio() called from there.

For more consistency, replace the global.turbo_disabled checks in
__intel_pstate_cpu_init() and intel_cpufreq_adjust_perf() with
global.no_turbo checks either.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/cpufreq/intel_pstate.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Index: linux-pm/drivers/cpufreq/intel_pstate.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/intel_pstate.c
+++ linux-pm/drivers/cpufreq/intel_pstate.c
@@ -1153,7 +1153,7 @@ static void intel_pstate_update_policies
 static void __intel_pstate_update_max_freq(struct cpudata *cpudata,
 					   struct cpufreq_policy *policy)
 {
-	policy->cpuinfo.max_freq = global.turbo_disabled ?
+	policy->cpuinfo.max_freq = READ_ONCE(global.no_turbo) ?
 			cpudata->pstate.max_freq : cpudata->pstate.turbo_freq;
 	refresh_frequency_limits(policy);
 }
@@ -2704,7 +2704,7 @@ static int __intel_pstate_cpu_init(struc
 
 	/* cpuinfo and default policy values */
 	policy->cpuinfo.min_freq = cpu->pstate.min_freq;
-	policy->cpuinfo.max_freq = global.turbo_disabled ?
+	policy->cpuinfo.max_freq = READ_ONCE(global.no_turbo) ?
 			cpu->pstate.max_freq : cpu->pstate.turbo_freq;
 
 	policy->min = policy->cpuinfo.min_freq;
@@ -2907,8 +2907,9 @@ static void intel_cpufreq_adjust_perf(un
 	int old_pstate = cpu->pstate.current_pstate;
 	int cap_pstate, min_pstate, max_pstate, target_pstate;
 
-	cap_pstate = global.turbo_disabled ? HWP_GUARANTEED_PERF(hwp_cap) :
-					     HWP_HIGHEST_PERF(hwp_cap);
+	cap_pstate = READ_ONCE(global.no_turbo) ?
+					HWP_GUARANTEED_PERF(hwp_cap) :
+					HWP_HIGHEST_PERF(hwp_cap);
 
 	/* Optimization: Avoid unnecessary divisions. */
 




  parent reply	other threads:[~2024-03-25 17:06 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-25 17:00 [PATCH v1 0/6] intel_pstate: Turbo disabled handling rework Rafael J. Wysocki
2024-03-25 17:01 ` [PATCH v1 1/6] cpufreq: intel_pstate: Fold intel_pstate_max_within_limits() into caller Rafael J. Wysocki
2024-04-01 20:06   ` srinivas pandruvada
2024-03-25 17:02 ` [PATCH v1 2/6] cpufreq: intel_pstate: Do not update global.turbo_disabled after initialization Rafael J. Wysocki
2024-06-02  3:21   ` Xi Ruoyao
2024-06-02  4:03     ` srinivas pandruvada
2024-06-02  4:25       ` Xi Ruoyao
2024-06-02 13:40         ` srinivas pandruvada
2024-06-02 16:07           ` Xi Ruoyao
2024-06-02 23:11             ` srinivas pandruvada
2024-06-03 13:12               ` Xi Ruoyao
2024-06-03 17:11                 ` srinivas pandruvada
2024-06-03 17:44                   ` Xi Ruoyao
2024-06-03 18:32                     ` Rafael J. Wysocki
2024-06-03 18:47                       ` srinivas pandruvada
2024-06-04  4:10                         ` srinivas pandruvada
2024-06-04  4:31                         ` srinivas pandruvada
2024-06-04  9:30                           ` Xi Ruoyao
2024-06-04 10:29                             ` srinivas pandruvada
2024-06-04 10:32                               ` Xi Ruoyao
2024-06-04 16:41                                 ` srinivas pandruvada
2024-06-04 16:46                                   ` Rafael J. Wysocki
2024-06-04 16:56                                     ` srinivas pandruvada
2024-06-05  5:21                                       ` Xi Ruoyao
2024-06-05 12:05                                         ` srinivas pandruvada
2024-06-07 15:04                                           ` Rafael J. Wysocki
2024-06-07 15:18                                             ` srinivas pandruvada
2024-06-08  9:30                                               ` Xi Ruoyao
2024-03-25 17:03 ` [PATCH v1 3/6] cpufreq: intel_pstate: Rearrange show_no_turbo() and store_no_turbo() Rafael J. Wysocki
2024-03-25 17:04 ` [PATCH v1 4/6] cpufreq: intel_pstate: Read global.no_turbo under READ_ONCE() Rafael J. Wysocki
2024-03-25 17:05 ` Rafael J. Wysocki [this message]
2024-03-25 17:06 ` [PATCH v1 6/6] cpufreq: intel_pstate: Update the maximum CPU frequency consistently Rafael J. Wysocki
2024-03-27 18:08   ` srinivas pandruvada
2024-03-28 11:26     ` Rafael J. Wysocki
2024-03-28 19:02   ` [PATCH v1.1 " Rafael J. Wysocki
2024-04-02  8:46 ` [PATCH v1 0/6] intel_pstate: Turbo disabled handling rework srinivas pandruvada

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=3813405.kQq0lBPeGt@kreacher \
    --to=rjw@rjwysocki.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --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