Power management fix for 5.4-rc6

Fix a recently introduced (mostly theoretical) issue that the requests
 to confine the maximum CPU frequency coming from the platform firmware
 may not be taken into account if multiple CPUs are covered by one
 cpufreq policy on a system with ACPI.
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAl27SPISHHJqd0Byand5
 c29ja2kubmV0AAoJEILEb/54YlRxx/8P/2k+HUgBdNOmWe4I6XRx0cPuROZTS/IO
 aaXB6CiT0jVauG5fsAgSs7Hddzd15S3TQ+Xb1bIWgeB84pLv7lSVTZdJlCO4X3gx
 Hq8hQasRNfuhuk0Y8l8Me9ouY2B/MNtm9nuetU9s0ADAjbGuTU7thfDOtu1a9Bv1
 6Jn+yaHhkq4oA9kkJH0A/jIACe8xVUygsPimzedPfLEQzri/5Y/USNmGefn8HF5D
 pwLeQf6H1KIQcyP1XqzFPTGG4iRzdrPyBbYdFnrKVoUrNSug6zDzuXktiJgcLhHC
 LKCpyoINM2N5mKc7JDEWfp+FbVy44Hz6LlZayS36uLRlemNNlGnXP43J1GLmEg6J
 fX//EBVF3NwZ+Ms1v6kUy4Yev/ElS/S2t+6SxAeP5JcMLRXNPj+gCDMCfYMPbHAg
 jFTQ4svJ20PqMSRFVfEi63RwHWzSuXzPtu4Hj+3Q6NP9Hir0z1GRwc7QdNUwtHKn
 fEhSEAQHl/M8PrPUHkYYz5kyzuwdF/XARsRT5tOtSuVU0iXxLyd0pGy23018lKk1
 JQKSBghmianHHhcO5AeTnRG9fIEqPD+JAPnjlMGssgmXsEn5E4yvev0S5ouaQRJg
 y9yvjQZmNQZbcYsCxyeViFH4sgBf5F9OFo8Xz957UoKFnaQrx27+HpcZy/30md9k
 htXCZbeItcc+
 =dPAj
 -----END PGP SIGNATURE-----

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

Pull power management fix from Rafael Wysocki:
 "Fix a recently introduced (mostly theoretical) issue that the requests
  to confine the maximum CPU frequency coming from the platform firmware
  may not be taken into account if multiple CPUs are covered by one
  cpufreq policy on a system with ACPI"

* tag 'pm-5.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  ACPI: processor: Add QoS requests for all CPUs
This commit is contained in:
Linus Torvalds 2019-11-01 09:30:48 -07:00
commit 65a5bf1c79
2 changed files with 42 additions and 26 deletions

View File

@ -159,26 +159,34 @@ void acpi_processor_ignore_ppc_init(void)
void acpi_processor_ppc_init(struct cpufreq_policy *policy)
{
int cpu = policy->cpu;
struct acpi_processor *pr = per_cpu(processors, cpu);
int ret;
unsigned int cpu;
if (!pr)
return;
for_each_cpu(cpu, policy->related_cpus) {
struct acpi_processor *pr = per_cpu(processors, cpu);
int ret;
ret = freq_qos_add_request(&policy->constraints, &pr->perflib_req,
FREQ_QOS_MAX, INT_MAX);
if (ret < 0)
pr_err("Failed to add freq constraint for CPU%d (%d)\n", cpu,
ret);
if (!pr)
continue;
ret = freq_qos_add_request(&policy->constraints,
&pr->perflib_req,
FREQ_QOS_MAX, INT_MAX);
if (ret < 0)
pr_err("Failed to add freq constraint for CPU%d (%d)\n",
cpu, ret);
}
}
void acpi_processor_ppc_exit(struct cpufreq_policy *policy)
{
struct acpi_processor *pr = per_cpu(processors, policy->cpu);
unsigned int cpu;
if (pr)
freq_qos_remove_request(&pr->perflib_req);
for_each_cpu(cpu, policy->related_cpus) {
struct acpi_processor *pr = per_cpu(processors, cpu);
if (pr)
freq_qos_remove_request(&pr->perflib_req);
}
}
static int acpi_processor_get_performance_control(struct acpi_processor *pr)

View File

@ -127,26 +127,34 @@ static int cpufreq_set_cur_state(unsigned int cpu, int state)
void acpi_thermal_cpufreq_init(struct cpufreq_policy *policy)
{
int cpu = policy->cpu;
struct acpi_processor *pr = per_cpu(processors, cpu);
int ret;
unsigned int cpu;
if (!pr)
return;
for_each_cpu(cpu, policy->related_cpus) {
struct acpi_processor *pr = per_cpu(processors, cpu);
int ret;
ret = freq_qos_add_request(&policy->constraints, &pr->thermal_req,
FREQ_QOS_MAX, INT_MAX);
if (ret < 0)
pr_err("Failed to add freq constraint for CPU%d (%d)\n", cpu,
ret);
if (!pr)
continue;
ret = freq_qos_add_request(&policy->constraints,
&pr->thermal_req,
FREQ_QOS_MAX, INT_MAX);
if (ret < 0)
pr_err("Failed to add freq constraint for CPU%d (%d)\n",
cpu, ret);
}
}
void acpi_thermal_cpufreq_exit(struct cpufreq_policy *policy)
{
struct acpi_processor *pr = per_cpu(processors, policy->cpu);
unsigned int cpu;
if (pr)
freq_qos_remove_request(&pr->thermal_req);
for_each_cpu(cpu, policy->related_cpus) {
struct acpi_processor *pr = per_cpu(processors, policy->cpu);
if (pr)
freq_qos_remove_request(&pr->thermal_req);
}
}
#else /* ! CONFIG_CPU_FREQ */
static int cpufreq_get_max_state(unsigned int cpu)