Skip to content

Commit 4f63642

Browse files
committed
Merge tag 'pm-6.12-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management fix from Rafael Wysocki: "Fix the asymmetric CPU capacity support code in the intel_pstate driver, added during this develompent cycle, to address a corner case in which the capacity of a CPU going online is not updated (Rafael Wysocki)" * tag 'pm-6.12-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: cpufreq: intel_pstate: Update asym capacity for CPUs that were offline initially cpufreq: intel_pstate: Clear hybrid_max_perf_cpu before driver registration
2 parents c7a8f2a + 92447aa commit 4f63642

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

drivers/cpufreq/intel_pstate.c

Lines changed: 23 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;
@@ -2263,6 +2275,11 @@ static void intel_pstate_get_cpu_pstates(struct cpudata *cpu)
22632275
} else {
22642276
cpu->pstate.scaling = perf_ctl_scaling;
22652277
}
2278+
/*
2279+
* If the CPU is going online for the first time and it was
2280+
* offline initially, asym capacity scaling needs to be updated.
2281+
*/
2282+
hybrid_update_capacity(cpu);
22662283
} else {
22672284
cpu->pstate.scaling = perf_ctl_scaling;
22682285
cpu->pstate.max_pstate = pstate_funcs.get_max(cpu->cpu);
@@ -3352,6 +3369,7 @@ static void intel_pstate_driver_cleanup(void)
33523369

33533370
static int intel_pstate_register_driver(struct cpufreq_driver *driver)
33543371
{
3372+
bool refresh_cpu_cap_scaling;
33553373
int ret;
33563374

33573375
if (driver == &intel_pstate)
@@ -3364,6 +3382,8 @@ static int intel_pstate_register_driver(struct cpufreq_driver *driver)
33643382

33653383
arch_set_max_freq_ratio(global.turbo_disabled);
33663384

3385+
refresh_cpu_cap_scaling = hybrid_clear_max_perf_cpu();
3386+
33673387
intel_pstate_driver = driver;
33683388
ret = cpufreq_register_driver(intel_pstate_driver);
33693389
if (ret) {
@@ -3373,7 +3393,7 @@ static int intel_pstate_register_driver(struct cpufreq_driver *driver)
33733393

33743394
global.min_perf_pct = min_perf_pct_min();
33753395

3376-
hybrid_init_cpu_capacity_scaling();
3396+
hybrid_init_cpu_capacity_scaling(refresh_cpu_cap_scaling);
33773397

33783398
return 0;
33793399
}

0 commit comments

Comments
 (0)