Skip to content

Commit c02d5fe

Browse files
committed
ACPI: processor: perflib: Use the "no limit" frequency QoS
When _PPC returns 0, it means that the CPU frequency is not limited by the platform firmware, so make acpi_processor_get_platform_limit() update the frequency QoS request used by it to "no limit" in that case. This addresses a problem with limiting CPU frequency artificially on some systems after CPU offline/online to the frequency that corresponds to the first entry in the _PSS return package. Reported-by: Pratyush Yadav <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Pratyush Yadav <[email protected]> Tested-by: Pratyush Yadav <[email protected]>
1 parent fbf757e commit c02d5fe

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

drivers/acpi/processor_perflib.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
5353
{
5454
acpi_status status = 0;
5555
unsigned long long ppc = 0;
56+
s32 qos_value;
57+
int index;
5658
int ret;
5759

5860
if (!pr)
@@ -72,17 +74,27 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
7274
}
7375
}
7476

77+
index = ppc;
78+
7579
pr_debug("CPU %d: _PPC is %d - frequency %s limited\n", pr->id,
76-
(int)ppc, ppc ? "" : "not");
80+
index, index ? "is" : "is not");
7781

78-
pr->performance_platform_limit = (int)ppc;
82+
pr->performance_platform_limit = index;
7983

8084
if (ppc >= pr->performance->state_count ||
8185
unlikely(!freq_qos_request_active(&pr->perflib_req)))
8286
return 0;
8387

84-
ret = freq_qos_update_request(&pr->perflib_req,
85-
pr->performance->states[ppc].core_frequency * 1000);
88+
/*
89+
* If _PPC returns 0, it means that all of the available states can be
90+
* used ("no limit").
91+
*/
92+
if (index == 0)
93+
qos_value = FREQ_QOS_MAX_DEFAULT_VALUE;
94+
else
95+
qos_value = pr->performance->states[index].core_frequency * 1000;
96+
97+
ret = freq_qos_update_request(&pr->perflib_req, qos_value);
8698
if (ret < 0) {
8799
pr_warn("Failed to update perflib freq constraint: CPU%d (%d)\n",
88100
pr->id, ret);

0 commit comments

Comments
 (0)