Skip to content

Commit a97e293

Browse files
committed
cpufreq: intel_pstate: Clear hybrid_max_perf_cpu before driver registration
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> Link: https://patch.msgid.link/4616631.LvFx2qVVIh@rjwysocki.net
1 parent 59b723c commit a97e293

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

drivers/cpufreq/intel_pstate.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ static void __hybrid_init_cpu_capacity_scaling(void)
10341034
hybrid_update_cpu_capacity_scaling();
10351035
}
10361036

1037-
static void hybrid_init_cpu_capacity_scaling(void)
1037+
static void hybrid_init_cpu_capacity_scaling(bool refresh)
10381038
{
10391039
bool disable_itmt = false;
10401040

@@ -1045,7 +1045,7 @@ static void hybrid_init_cpu_capacity_scaling(void)
10451045
* scaling has been enabled already and the driver is just changing the
10461046
* operation mode.
10471047
*/
1048-
if (hybrid_max_perf_cpu) {
1048+
if (refresh) {
10491049
__hybrid_init_cpu_capacity_scaling();
10501050
goto unlock;
10511051
}
@@ -1071,6 +1071,18 @@ static void hybrid_init_cpu_capacity_scaling(void)
10711071
sched_clear_itmt_support();
10721072
}
10731073

1074+
static bool hybrid_clear_max_perf_cpu(void)
1075+
{
1076+
bool ret;
1077+
1078+
guard(mutex)(&hybrid_capacity_lock);
1079+
1080+
ret = !!hybrid_max_perf_cpu;
1081+
hybrid_max_perf_cpu = NULL;
1082+
1083+
return ret;
1084+
}
1085+
10741086
static void __intel_pstate_get_hwp_cap(struct cpudata *cpu)
10751087
{
10761088
u64 cap;
@@ -3352,6 +3364,7 @@ static void intel_pstate_driver_cleanup(void)
33523364

33533365
static int intel_pstate_register_driver(struct cpufreq_driver *driver)
33543366
{
3367+
bool refresh_cpu_cap_scaling;
33553368
int ret;
33563369

33573370
if (driver == &intel_pstate)
@@ -3364,6 +3377,8 @@ static int intel_pstate_register_driver(struct cpufreq_driver *driver)
33643377

33653378
arch_set_max_freq_ratio(global.turbo_disabled);
33663379

3380+
refresh_cpu_cap_scaling = hybrid_clear_max_perf_cpu();
3381+
33673382
intel_pstate_driver = driver;
33683383
ret = cpufreq_register_driver(intel_pstate_driver);
33693384
if (ret) {
@@ -3373,7 +3388,7 @@ static int intel_pstate_register_driver(struct cpufreq_driver *driver)
33733388

33743389
global.min_perf_pct = min_perf_pct_min();
33753390

3376-
hybrid_init_cpu_capacity_scaling();
3391+
hybrid_init_cpu_capacity_scaling(refresh_cpu_cap_scaling);
33773392

33783393
return 0;
33793394
}

0 commit comments

Comments
 (0)