mirror of
https://github.com/torvalds/linux.git
synced 2025-11-01 17:18:25 +02:00
ACPI: processor: perflib: Fix initial _PPC limit application
If the BIOS sets a _PPC frequency limit upfront, it will fail to take
effect due to a call ordering issue. Namely, freq_qos_update_request()
is called before freq_qos_add_request() for the given request causing
the constraint update to be ignored. The call sequence in question is
as follows:
cpufreq_policy_online()
acpi_cpufreq_cpu_init()
acpi_processor_register_performance()
acpi_processor_get_performance_info()
acpi_processor_get_platform_limit()
freq_qos_update_request(&perflib_req) <- inactive QoS request
blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
CPUFREQ_CREATE_POLICY)
acpi_processor_notifier()
acpi_processor_ppc_init()
freq_qos_add_request(&perflib_req) <- QoS request activation
Address this by adding an acpi_processor_get_platform_limit() call
to acpi_processor_ppc_init(), after the perflib_req activation via
freq_qos_add_request(), which causes the initial _PPC limit to be
picked up as appropriate. However, also ensure that the _PPC limit
will not be picked up in the cases when the cpufreq driver does not
call acpi_processor_register_performance() by adding a pr->performance
check to the related_cpus loop in acpi_processor_ppc_init().
Fixes: d15ce41273 ("ACPI: cpufreq: Switch to QoS requests instead of cpufreq notifier")
Signed-off-by: Jiayi Li <lijiayi@kylinos.cn>
Link: https://patch.msgid.link/20250721032606.3459369-1-lijiayi@kylinos.cn
[ rjw: Consolidate pr-related checks in acpi_processor_ppc_init() ]
[ rjw: Subject and changelog adjustments ]
Cc: 5.4+ <stable@vger.kernel.org> # 5.4+: 2d8b39a62a ACPI: processor: Avoid NULL pointer dereferences at init time
Cc: 5.4+ <stable@vger.kernel.org> # 5.4+: 3000ce3c52 cpufreq: Use per-policy frequency QoS
Cc: 5.4+ <stable@vger.kernel.org> # 5.4+: a1bb46c36c ACPI: processor: Add QoS requests for all CPUs
Cc: 5.4+ <stable@vger.kernel.org> # 5.4+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
13edf75392
commit
d33bd88ac0
1 changed files with 9 additions and 1 deletions
|
|
@ -173,11 +173,14 @@ void acpi_processor_ppc_init(struct cpufreq_policy *policy)
|
||||||
{
|
{
|
||||||
unsigned int cpu;
|
unsigned int cpu;
|
||||||
|
|
||||||
|
if (ignore_ppc == 1)
|
||||||
|
return;
|
||||||
|
|
||||||
for_each_cpu(cpu, policy->related_cpus) {
|
for_each_cpu(cpu, policy->related_cpus) {
|
||||||
struct acpi_processor *pr = per_cpu(processors, cpu);
|
struct acpi_processor *pr = per_cpu(processors, cpu);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!pr)
|
if (!pr || !pr->performance)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -193,6 +196,11 @@ void acpi_processor_ppc_init(struct cpufreq_policy *policy)
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
pr_err("Failed to add freq constraint for CPU%d (%d)\n",
|
pr_err("Failed to add freq constraint for CPU%d (%d)\n",
|
||||||
cpu, ret);
|
cpu, ret);
|
||||||
|
|
||||||
|
ret = acpi_processor_get_platform_limit(pr);
|
||||||
|
if (ret)
|
||||||
|
pr_err("Failed to update freq constraint for CPU%d (%d)\n",
|
||||||
|
cpu, ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue