* [PATCH v1 0/2] cpufreq: intel_pstate: Compute capacity for CPUs that are offline initially
@ 2024-11-04 18:46 Rafael J. Wysocki
2024-11-04 18:51 ` [PATCH v1 1/2] cpufreq: intel_pstate: Clear hybrid_max_perf_cpu before driver registration Rafael J. Wysocki
2024-11-04 18:53 ` [PATCH v1 2/2] cpufreq: intel_pstate: Update asym capacity for CPUs that were offline initially Rafael J. Wysocki
0 siblings, 2 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2024-11-04 18:46 UTC (permalink / raw)
To: Linux PM; +Cc: LKML, Srinivas Pandruvada, Ricardo Neri
Hi Everyone,
The asymmetric CPU scaling support added earlier in this cycle
does not cover the case when some CPUs are offline to start with
and go online after initialization.
Patch [2/2] adds this missing support and patch [1/2] is preparatory.
Please refer to the individual patch changelogs for details.
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v1 1/2] cpufreq: intel_pstate: Clear hybrid_max_perf_cpu before driver registration
2024-11-04 18:46 [PATCH v1 0/2] cpufreq: intel_pstate: Compute capacity for CPUs that are offline initially Rafael J. Wysocki
@ 2024-11-04 18:51 ` Rafael J. Wysocki
2024-11-04 18:53 ` [PATCH v1 2/2] cpufreq: intel_pstate: Update asym capacity for CPUs that were offline initially Rafael J. Wysocki
1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2024-11-04 18:51 UTC (permalink / raw)
To: Linux PM; +Cc: LKML, Srinivas Pandruvada, Ricardo Neri
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Modify intel_pstate_register_driver() to clear hybrid_max_perf_cpu
before calling cpufreq_register_driver(), so that asymmetric CPU
capacity scaling is not updated until hybrid_init_cpu_capacity_scaling()
runs down the road. This is done in preparation for a subsequent
change adding asymmetric CPU capacity computation to the CPU init path
to handle CPUs that are initially offline.
The information on whether or not hybrid_max_perf_cpu was NULL before
it has been cleared is passed to hybrid_init_cpu_capacity_scaling(),
so full initialization of CPU capacity scaling can be skipped if it
has been carried out already.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/cpufreq/intel_pstate.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
Index: linux-pm/drivers/cpufreq/intel_pstate.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/intel_pstate.c
+++ linux-pm/drivers/cpufreq/intel_pstate.c
@@ -1034,7 +1034,7 @@ static void __hybrid_init_cpu_capacity_s
hybrid_update_cpu_capacity_scaling();
}
-static void hybrid_init_cpu_capacity_scaling(void)
+static void hybrid_init_cpu_capacity_scaling(bool refresh)
{
bool disable_itmt = false;
@@ -1045,7 +1045,7 @@ static void hybrid_init_cpu_capacity_sca
* scaling has been enabled already and the driver is just changing the
* operation mode.
*/
- if (hybrid_max_perf_cpu) {
+ if (refresh) {
__hybrid_init_cpu_capacity_scaling();
goto unlock;
}
@@ -1071,6 +1071,18 @@ unlock:
sched_clear_itmt_support();
}
+static bool hybrid_clear_max_perf_cpu(void)
+{
+ bool ret;
+
+ guard(mutex)(&hybrid_capacity_lock);
+
+ ret = !!hybrid_max_perf_cpu;
+ hybrid_max_perf_cpu = NULL;
+
+ return ret;
+}
+
static void __intel_pstate_get_hwp_cap(struct cpudata *cpu)
{
u64 cap;
@@ -3352,6 +3364,7 @@ static void intel_pstate_driver_cleanup(
static int intel_pstate_register_driver(struct cpufreq_driver *driver)
{
+ bool refresh_cpu_cap_scaling;
int ret;
if (driver == &intel_pstate)
@@ -3364,6 +3377,8 @@ static int intel_pstate_register_driver(
arch_set_max_freq_ratio(global.turbo_disabled);
+ refresh_cpu_cap_scaling = hybrid_clear_max_perf_cpu();
+
intel_pstate_driver = driver;
ret = cpufreq_register_driver(intel_pstate_driver);
if (ret) {
@@ -3373,7 +3388,7 @@ static int intel_pstate_register_driver(
global.min_perf_pct = min_perf_pct_min();
- hybrid_init_cpu_capacity_scaling();
+ hybrid_init_cpu_capacity_scaling(refresh_cpu_cap_scaling);
return 0;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v1 2/2] cpufreq: intel_pstate: Update asym capacity for CPUs that were offline initially
2024-11-04 18:46 [PATCH v1 0/2] cpufreq: intel_pstate: Compute capacity for CPUs that are offline initially Rafael J. Wysocki
2024-11-04 18:51 ` [PATCH v1 1/2] cpufreq: intel_pstate: Clear hybrid_max_perf_cpu before driver registration Rafael J. Wysocki
@ 2024-11-04 18:53 ` Rafael J. Wysocki
1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2024-11-04 18:53 UTC (permalink / raw)
To: Linux PM; +Cc: LKML, Srinivas Pandruvada, Ricardo Neri
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Commit 929ebc93ccaa ("cpufreq: intel_pstate: Set asymmetric CPU
capacity on hybrid systems") overlooked a corner case in which some
CPUs may be offline to start with and brought back online later,
after the intel_pstate driver has been registered, so their asymmetric
capacity will not be set.
Address this by calling hybrid_update_capacity() in the CPU
initialization path that is executed instead of the online path
for those CPUs.
Note that this asymmetric capacity update will be skipped during
driver initialization and mode switches because hybrid_max_perf_cpu
is NULL in those cases.
Fixes: 929ebc93ccaa ("cpufreq: intel_pstate: Set asymmetric CPU capacity on hybrid systems")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/cpufreq/intel_pstate.c | 5 +++++
1 file changed, 5 insertions(+)
Index: linux-pm/drivers/cpufreq/intel_pstate.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/intel_pstate.c
+++ linux-pm/drivers/cpufreq/intel_pstate.c
@@ -2275,6 +2275,11 @@ static void intel_pstate_get_cpu_pstates
} else {
cpu->pstate.scaling = perf_ctl_scaling;
}
+ /*
+ * If the CPU is going online for the first time and it was
+ * offline initially, asym capacity scaling needs to be updated.
+ */
+ hybrid_update_capacity(cpu);
} else {
cpu->pstate.scaling = perf_ctl_scaling;
cpu->pstate.max_pstate = pstate_funcs.get_max(cpu->cpu);
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-11-04 19:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-04 18:46 [PATCH v1 0/2] cpufreq: intel_pstate: Compute capacity for CPUs that are offline initially Rafael J. Wysocki
2024-11-04 18:51 ` [PATCH v1 1/2] cpufreq: intel_pstate: Clear hybrid_max_perf_cpu before driver registration Rafael J. Wysocki
2024-11-04 18:53 ` [PATCH v1 2/2] cpufreq: intel_pstate: Update asym capacity for CPUs that were offline initially Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®