linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/2] ACPI: processor: perflib: Use the "no limit" frequency QoS
@ 2022-12-27 19:51 Rafael J. Wysocki
  2022-12-27 19:52 ` [PATCH v1 2/2] cpufreq: intel_pstate: Drop ACPI _PSS states table patching Rafael J. Wysocki
                   ` (5 more replies)
  0 siblings, 6 replies; 17+ messages in thread
From: Rafael J. Wysocki @ 2022-12-27 19:51 UTC (permalink / raw)
  To: Linux PM; +Cc: Pratyush Yadav, LKML, Linux ACPI, Srinivas Pandruvada

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

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
and avoid updating the QoS request when the _PPC return value has not
changed.

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.

While at it, move the _PPC return value check against the state count
earlier to avoid setting performance_platform_limit to an invalid value.

Reported-by: Pratyush Yadav <ptyadav@amazon.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/processor_perflib.c |   27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

Index: linux-pm/drivers/acpi/processor_perflib.c
===================================================================
--- linux-pm.orig/drivers/acpi/processor_perflib.c
+++ linux-pm/drivers/acpi/processor_perflib.c
@@ -53,6 +53,8 @@ static int acpi_processor_get_platform_l
 {
 	acpi_status status = 0;
 	unsigned long long ppc = 0;
+	s32 qos_value;
+	int index;
 	int ret;
 
 	if (!pr)
@@ -72,17 +74,30 @@ static int acpi_processor_get_platform_l
 		}
 	}
 
+	index = ppc;
+
+	if (pr->performance_platform_limit == index ||
+	    ppc >= pr->performance->state_count)
+		return 0;
+
 	pr_debug("CPU %d: _PPC is %d - frequency %s limited\n", pr->id,
-		       (int)ppc, ppc ? "" : "not");
+		 index, index ? "is" : "is not");
 
-	pr->performance_platform_limit = (int)ppc;
+	pr->performance_platform_limit = index;
 
-	if (ppc >= pr->performance->state_count ||
-	    unlikely(!freq_qos_request_active(&pr->perflib_req)))
+	if (unlikely(!freq_qos_request_active(&pr->perflib_req)))
 		return 0;
 
-	ret = freq_qos_update_request(&pr->perflib_req,
-			pr->performance->states[ppc].core_frequency * 1000);
+	/*
+	 * If _PPC returns 0, it means that all of the available states can be
+	 * used ("no limit").
+	 */
+	if (index == 0)
+		qos_value = FREQ_QOS_MAX_DEFAULT_VALUE;
+	else
+		qos_value = pr->performance->states[index].core_frequency * 1000;
+
+	ret = freq_qos_update_request(&pr->perflib_req, qos_value);
 	if (ret < 0) {
 		pr_warn("Failed to update perflib freq constraint: CPU%d (%d)\n",
 			pr->id, ret);




^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2023-02-14 14:41 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-27 19:51 [PATCH v1 1/2] ACPI: processor: perflib: Use the "no limit" frequency QoS Rafael J. Wysocki
2022-12-27 19:52 ` [PATCH v1 2/2] cpufreq: intel_pstate: Drop ACPI _PSS states table patching Rafael J. Wysocki
2022-12-27 20:40 ` [PATCH v1 1/2] ACPI: processor: perflib: Use the "no limit" frequency QoS srinivas pandruvada
2022-12-28 20:41   ` Rafael J. Wysocki
2022-12-28 14:22 ` Pratyush Yadav
2022-12-28 21:21 ` [PATCH v2 1/3] " Rafael J. Wysocki
2022-12-29 12:58   ` Pratyush Yadav
2022-12-29 19:26     ` Rafael J. Wysocki
2023-01-30 14:17       ` Pratyush Yadav
2023-01-30 14:58         ` Rafael J. Wysocki
2023-01-30 15:23           ` Pratyush Yadav
2023-02-14 13:40           ` srinivas pandruvada
2023-02-14 13:57             ` Rafael J. Wysocki
2023-02-14 14:25               ` srinivas pandruvada
2023-02-14 14:41                 ` Rafael J. Wysocki
2022-12-28 21:24 ` [PATCH v2 2/3] ACPI: processor: perflib: Avoid updating frequency QoS unnecessarily Rafael J. Wysocki
2022-12-28 21:26 ` [PATCH v2 3/3] cpufreq: intel_pstate: Drop ACPI _PSS states table patching Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).