Power management fix for 6.12-rc7

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).
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAmcuaw8SHHJqd0Byand5
 c29ja2kubmV0AAoJEILEb/54YlRxWPgQALSAV2W7oQxQEbEDvRusqM4jaVCGtEQN
 HUjmJy3iNZkJivpdUzXFl1ot5ptqVi5Ww0oqfp013tA2EkH+u8Cl18ukF0Epfj23
 ZpV6JxXN8AqpRURJItZkw6YcmO57ZLz6it22/4M1GjfyxGzy4ibRXiVydDMsSTMr
 VupM/iU8c+PfB3WCCbymXiEjkGHYsisDTVA6tE1dgIlgalXckGoK7ZRuSOt2z1La
 0oViyopDM9At/A+JeZtgLoHMyX+d1QN9Dud1br6g7MU9PQHgn20Qxw02mqGzmbfa
 3JiJgaeCqePNRLQoyIoUCJNMd01Nebhmvk2rXAyvBFlhmuy1rTAa/TrV9CEZcjZN
 gAKh4HwubhYYwb3Kcf/wf6OT0KdPO0FmIdjsj4cQgbKO8188RQ1X9PDuHnd+3maK
 fYTJW9bVehEw5B3ebm2nwqlSFffDiPZb4IXIq6BAD2k8JdAuoZALODAT6agVkWFe
 pE5EGlenGO43SOfMyPLgvySJHi/3Cow2s+o7bNzaKwNlvW4zldTVnvlPXH9sGEjL
 VeArSFwcAyluQQ4scXRNnOsC2/kMYhGphAUCxcJsHYTZKFfuRgO2BbUpfd6uCZqM
 i2a4Qa1OFcXUWmucQTcBowIdBtJTAPtIBonMcg/IcFpd8aH2Q8O9ceGZIbxhsVhX
 Y5bDHHlniRuw
 =4Ngn
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2024-11-08 13:13:54 -10:00
commit 4f63642c09

View File

@ -1034,7 +1034,7 @@ static void __hybrid_init_cpu_capacity_scaling(void)
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_scaling(void)
* 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 @@ static void hybrid_init_cpu_capacity_scaling(void)
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;
@ -2263,6 +2275,11 @@ static void intel_pstate_get_cpu_pstates(struct cpudata *cpu)
} 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);
@ -3352,6 +3369,7 @@ static void intel_pstate_driver_cleanup(void)
static int intel_pstate_register_driver(struct cpufreq_driver *driver)
{
bool refresh_cpu_cap_scaling;
int ret;
if (driver == &intel_pstate)
@ -3364,6 +3382,8 @@ static int intel_pstate_register_driver(struct cpufreq_driver *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 +3393,7 @@ static int intel_pstate_register_driver(struct cpufreq_driver *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;
}