1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00

Power management fixes for 6.14-rc2

- Fix cpufreq_policy reference counting and prevent max_perf from
    going above the current limit in amd-pstate, and drop a redundant
    goto label from it (Dhananjay Ugwekar).
 
  - Prevent the per-policy boost_enabled flag in amd-pstate from getting
    out of sync with the actual state after boot failures (Lifeng Zheng).
 
  - Fix a recently added possible NULL pointer dereference in the
    cpufreq core (Aboorva Devarajan).
 
  - Fix a build issue related to CONFIG_OF and COMPILE_TEST dependencies
    in the airoha cpufreq driver (Arnd Bergmann).
 
  - Fix a possible memory leak in the power capping subsystem (Joe
    Hattori).
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAmemALgSHHJqd0Byand5
 c29ja2kubmV0AAoJEILEb/54YlRxkRsP/1uITZrmpvL2ikBlY8xvsluMtFc6aCLi
 /3UsAWhpyPhfY7jPQA0JzKGeYTSDbF8R2Qz6uvxHcA0vvVkyt9nYy7O5GjbCWfCK
 XJMCq4ZBVB7scGTolOL+FtLZJOS1xnDepYoJ5YjSvmVME7FiUpQfUKiQIXBe+Fec
 hT4TTL9WkUqkS7V6uKrKzDgKX1mz8W2x8iXzwhI2MRlGaRcsD2RSLvSw5gYBKs2Z
 iAXqXv++0wK9LPDdsS44uurElBPl0/baWGyWeELSA3Vi923SXsg4cCHwPbc3/qHI
 Q6J86nDoTCHkAg/jSp6UPZAD/XwU+fuWmTTMfM6TPNSUX45nvKWxtyIxL5mCuFBk
 +wYMsEYxacM/lIj0sLnkQNp1Bn6+YPgp1DTdGvCzIERtdSsXsWoRgh++rr3lXXY3
 hFiyk2auj8CXGPHFBTY+hCsvwyCH5R18PxLFiAFEVqIlDHCd566IXX+NJ03KzVxo
 Y6gy8mo7TU+N0wHclwdVUgeA/q3pwwTbaguUKUWJaCaGsUCSLdxa+IpK7pJY94vn
 46ZKfCB5Aj1unfhqHbBeHdv6dXjU2nLIACseCvTVa2RgT0aETnkgJ07jXOCBXM3j
 UAqYLWMWKxLzXNoOdznsG9L7o5wSanXGeaozJtbuGMQ0ddgh749/qrd1XcpSEFWv
 rIK8NPUz6xIs
 =/4yQ
 -----END PGP SIGNATURE-----

Merge tag 'pm-6.14-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management fixes from Rafael Wysocki:
 "These fix a handful of issues in the amd-pstate driver, the airoha
  cpufreq driver build, a (recently added) possible NULL pointer
  dereference in the cpufreq code and a possible memory leak in the
  power capping subsystem:

   - Fix cpufreq_policy reference counting and prevent max_perf from
     going above the current limit in amd-pstate, and drop a redundant
     goto label from it (Dhananjay Ugwekar)

   - Prevent the per-policy boost_enabled flag in amd-pstate from
     getting out of sync with the actual state after boot failures
     (Lifeng Zheng)

   - Fix a recently added possible NULL pointer dereference in the
     cpufreq core (Aboorva Devarajan)

   - Fix a build issue related to CONFIG_OF and COMPILE_TEST
     dependencies in the airoha cpufreq driver (Arnd Bergmann)

   - Fix a possible memory leak in the power capping subsystem (Joe
     Hattori)"

* tag 'pm-6.14-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  cpufreq/amd-pstate: Fix cpufreq_policy ref counting
  cpufreq: prevent NULL dereference in cpufreq_online()
  cpufreq: airoha: modify CONFIG_OF dependency
  cpufreq/amd-pstate: Fix max_perf updation with schedutil
  cpufreq/amd-pstate: Remove the goto label in amd_pstate_update_limits
  cpufreq/amd-pstate: Fix per-policy boost flag incorrect when fail
  powercap: call put_device() on an error path in powercap_register_control_type()
This commit is contained in:
Linus Torvalds 2025-02-07 10:34:50 -08:00
commit 1fa9970a4e
4 changed files with 15 additions and 14 deletions

View file

@ -17,7 +17,8 @@ config ARM_ALLWINNER_SUN50I_CPUFREQ_NVMEM
config ARM_AIROHA_SOC_CPUFREQ
tristate "Airoha EN7581 SoC CPUFreq support"
depends on (ARCH_AIROHA && OF) || COMPILE_TEST
depends on ARCH_AIROHA || COMPILE_TEST
depends on OF
select PM_OPP
default ARCH_AIROHA
help

View file

@ -699,7 +699,7 @@ static void amd_pstate_adjust_perf(unsigned int cpu,
if (min_perf < lowest_nonlinear_perf)
min_perf = lowest_nonlinear_perf;
max_perf = cap_perf;
max_perf = cpudata->max_limit_perf;
if (max_perf < min_perf)
max_perf = min_perf;
@ -747,7 +747,6 @@ static int amd_pstate_set_boost(struct cpufreq_policy *policy, int state)
guard(mutex)(&amd_pstate_driver_lock);
ret = amd_pstate_cpu_boost_update(policy, state);
policy->boost_enabled = !ret ? state : false;
refresh_frequency_limits(policy);
return ret;
@ -822,25 +821,28 @@ static void amd_pstate_init_prefcore(struct amd_cpudata *cpudata)
static void amd_pstate_update_limits(unsigned int cpu)
{
struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
struct cpufreq_policy *policy = NULL;
struct amd_cpudata *cpudata;
u32 prev_high = 0, cur_high = 0;
int ret;
bool highest_perf_changed = false;
if (!amd_pstate_prefcore)
return;
policy = cpufreq_cpu_get(cpu);
if (!policy)
return;
cpudata = policy->driver_data;
if (!amd_pstate_prefcore)
return;
guard(mutex)(&amd_pstate_driver_lock);
ret = amd_get_highest_perf(cpu, &cur_high);
if (ret)
goto free_cpufreq_put;
if (ret) {
cpufreq_cpu_put(policy);
return;
}
prev_high = READ_ONCE(cpudata->prefcore_ranking);
highest_perf_changed = (prev_high != cur_high);
@ -850,8 +852,6 @@ static void amd_pstate_update_limits(unsigned int cpu)
if (cur_high < CPPC_MAX_PERF)
sched_set_itmt_core_prio((int)cur_high, cpu);
}
free_cpufreq_put:
cpufreq_cpu_put(policy);
if (!highest_perf_changed)

View file

@ -1571,7 +1571,8 @@ static int cpufreq_online(unsigned int cpu)
policy->cdev = of_cpufreq_cooling_register(policy);
/* Let the per-policy boost flag mirror the cpufreq_driver boost during init */
if (policy->boost_enabled != cpufreq_boost_enabled()) {
if (cpufreq_driver->set_boost &&
policy->boost_enabled != cpufreq_boost_enabled()) {
policy->boost_enabled = cpufreq_boost_enabled();
ret = cpufreq_driver->set_boost(policy, policy->boost_enabled);
if (ret) {

View file

@ -627,8 +627,7 @@ struct powercap_control_type *powercap_register_control_type(
dev_set_name(&control_type->dev, "%s", name);
result = device_register(&control_type->dev);
if (result) {
if (control_type->allocated)
kfree(control_type);
put_device(&control_type->dev);
return ERR_PTR(result);
}
idr_init(&control_type->idr);