Commit 65a5bf1c authored by Linus Torvalds's avatar Linus Torvalds

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
parents 4252a1a9 e82b7457
...@@ -159,26 +159,34 @@ void acpi_processor_ignore_ppc_init(void) ...@@ -159,26 +159,34 @@ void acpi_processor_ignore_ppc_init(void)
void acpi_processor_ppc_init(struct cpufreq_policy *policy) void acpi_processor_ppc_init(struct cpufreq_policy *policy)
{ {
int cpu = policy->cpu; unsigned int cpu;
struct acpi_processor *pr = per_cpu(processors, cpu);
int ret;
if (!pr) for_each_cpu(cpu, policy->related_cpus) {
return; struct acpi_processor *pr = per_cpu(processors, cpu);
int ret;
if (!pr)
continue;
ret = freq_qos_add_request(&policy->constraints, &pr->perflib_req, ret = freq_qos_add_request(&policy->constraints,
FREQ_QOS_MAX, INT_MAX); &pr->perflib_req,
if (ret < 0) FREQ_QOS_MAX, INT_MAX);
pr_err("Failed to add freq constraint for CPU%d (%d)\n", cpu, if (ret < 0)
ret); pr_err("Failed to add freq constraint for CPU%d (%d)\n",
cpu, ret);
}
} }
void acpi_processor_ppc_exit(struct cpufreq_policy *policy) void acpi_processor_ppc_exit(struct cpufreq_policy *policy)
{ {
struct acpi_processor *pr = per_cpu(processors, policy->cpu); unsigned int cpu;
if (pr) for_each_cpu(cpu, policy->related_cpus) {
freq_qos_remove_request(&pr->perflib_req); 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) static int acpi_processor_get_performance_control(struct acpi_processor *pr)
......
...@@ -127,26 +127,34 @@ static int cpufreq_set_cur_state(unsigned int cpu, int state) ...@@ -127,26 +127,34 @@ static int cpufreq_set_cur_state(unsigned int cpu, int state)
void acpi_thermal_cpufreq_init(struct cpufreq_policy *policy) void acpi_thermal_cpufreq_init(struct cpufreq_policy *policy)
{ {
int cpu = policy->cpu; unsigned int cpu;
struct acpi_processor *pr = per_cpu(processors, cpu);
int ret;
if (!pr) for_each_cpu(cpu, policy->related_cpus) {
return; struct acpi_processor *pr = per_cpu(processors, cpu);
int ret;
if (!pr)
continue;
ret = freq_qos_add_request(&policy->constraints, &pr->thermal_req, ret = freq_qos_add_request(&policy->constraints,
FREQ_QOS_MAX, INT_MAX); &pr->thermal_req,
if (ret < 0) FREQ_QOS_MAX, INT_MAX);
pr_err("Failed to add freq constraint for CPU%d (%d)\n", cpu, if (ret < 0)
ret); pr_err("Failed to add freq constraint for CPU%d (%d)\n",
cpu, ret);
}
} }
void acpi_thermal_cpufreq_exit(struct cpufreq_policy *policy) void acpi_thermal_cpufreq_exit(struct cpufreq_policy *policy)
{ {
struct acpi_processor *pr = per_cpu(processors, policy->cpu); unsigned int cpu;
for_each_cpu(cpu, policy->related_cpus) {
struct acpi_processor *pr = per_cpu(processors, policy->cpu);
if (pr) if (pr)
freq_qos_remove_request(&pr->thermal_req); freq_qos_remove_request(&pr->thermal_req);
}
} }
#else /* ! CONFIG_CPU_FREQ */ #else /* ! CONFIG_CPU_FREQ */
static int cpufreq_get_max_state(unsigned int cpu) static int cpufreq_get_max_state(unsigned int cpu)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment