From: Greg Kroah-Hartman Date: Tue, 1 Aug 2023 07:24:16 +0000 (+0200) Subject: 5.10-stable patches X-Git-Tag: v5.15.124~26 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=12dad642bf504f0e7753c39d409c37d33ea20129;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: acpi-processor-perflib-avoid-updating-frequency-qos-unnecessarily.patch acpi-processor-perflib-use-the-no-limit-frequency-qos.patch cpufreq-intel_pstate-drop-acpi-_pss-states-table-patching.patch --- diff --git a/queue-5.10/acpi-processor-perflib-avoid-updating-frequency-qos-unnecessarily.patch b/queue-5.10/acpi-processor-perflib-avoid-updating-frequency-qos-unnecessarily.patch new file mode 100644 index 00000000000..2785da54e18 --- /dev/null +++ b/queue-5.10/acpi-processor-perflib-avoid-updating-frequency-qos-unnecessarily.patch @@ -0,0 +1,67 @@ +From 99387b016022c29234c4ebf9abd34358c6e56532 Mon Sep 17 00:00:00 2001 +From: "Rafael J. Wysocki" +Date: Wed, 28 Dec 2022 22:24:10 +0100 +Subject: ACPI: processor: perflib: Avoid updating frequency QoS unnecessarily + +From: Rafael J. Wysocki + +commit 99387b016022c29234c4ebf9abd34358c6e56532 upstream. + +Modify acpi_processor_get_platform_limit() to avoid updating its +frequency QoS request when the _PPC return value has not changed +by comparing that value to the previous _PPC return value stored in +the performance_platform_limit field of the struct acpi_processor +corresponding to the given CPU. + +While at it, do the _PPC return value check against the state count +earlier, to avoid setting performance_platform_limit to an invalid +value, and make acpi_processor_ppc_init() use FREQ_QOS_MAX_DEFAULT_VALUE +as the "no limit" frequency QoS for consistency. + +Signed-off-by: Rafael J. Wysocki +Tested-by: Hagar Hemdan +Signed-off-by: Greg Kroah-Hartman +--- + drivers/acpi/processor_perflib.c | 18 ++++++++++++++---- + 1 file changed, 14 insertions(+), 4 deletions(-) + +--- a/drivers/acpi/processor_perflib.c ++++ b/drivers/acpi/processor_perflib.c +@@ -79,13 +79,16 @@ 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, + index, index ? "is" : "is not"); + + 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; + + /* +@@ -180,9 +183,16 @@ void acpi_processor_ppc_init(struct cpuf + if (!pr) + continue; + ++ /* ++ * Reset performance_platform_limit in case there is a stale ++ * value in it, so as to make it match the "no limit" QoS value ++ * below. ++ */ ++ pr->performance_platform_limit = 0; ++ + ret = freq_qos_add_request(&policy->constraints, +- &pr->perflib_req, +- FREQ_QOS_MAX, INT_MAX); ++ &pr->perflib_req, FREQ_QOS_MAX, ++ FREQ_QOS_MAX_DEFAULT_VALUE); + if (ret < 0) + pr_err("Failed to add freq constraint for CPU%d (%d)\n", + cpu, ret); diff --git a/queue-5.10/acpi-processor-perflib-use-the-no-limit-frequency-qos.patch b/queue-5.10/acpi-processor-perflib-use-the-no-limit-frequency-qos.patch new file mode 100644 index 00000000000..28ac6e345d3 --- /dev/null +++ b/queue-5.10/acpi-processor-perflib-use-the-no-limit-frequency-qos.patch @@ -0,0 +1,70 @@ +From c02d5feb6e2f60affc6ba8606d8d614c071e2ba6 Mon Sep 17 00:00:00 2001 +From: "Rafael J. Wysocki" +Date: Wed, 28 Dec 2022 22:21:49 +0100 +Subject: ACPI: processor: perflib: Use the "no limit" frequency QoS + +From: Rafael J. Wysocki + +commit c02d5feb6e2f60affc6ba8606d8d614c071e2ba6 upstream. + +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 +Signed-off-by: Rafael J. Wysocki +Reviewed-by: Pratyush Yadav +Tested-by: Pratyush Yadav +Tested-by: Hagar Hemdan +Signed-off-by: Greg Kroah-Hartman +--- + drivers/acpi/processor_perflib.c | 20 ++++++++++++++++---- + 1 file changed, 16 insertions(+), 4 deletions(-) + +--- a/drivers/acpi/processor_perflib.c ++++ b/drivers/acpi/processor_perflib.c +@@ -56,6 +56,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) +@@ -75,17 +77,27 @@ static int acpi_processor_get_platform_l + return -ENODEV; + } + ++ index = ppc; ++ + 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))) + 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); diff --git a/queue-5.10/cpufreq-intel_pstate-drop-acpi-_pss-states-table-patching.patch b/queue-5.10/cpufreq-intel_pstate-drop-acpi-_pss-states-table-patching.patch new file mode 100644 index 00000000000..70966292492 --- /dev/null +++ b/queue-5.10/cpufreq-intel_pstate-drop-acpi-_pss-states-table-patching.patch @@ -0,0 +1,46 @@ +From e8a0e30b742f76ebd0f3b196973df4bf65d8fbbb Mon Sep 17 00:00:00 2001 +From: "Rafael J. Wysocki" +Date: Wed, 28 Dec 2022 22:26:04 +0100 +Subject: cpufreq: intel_pstate: Drop ACPI _PSS states table patching + +From: Rafael J. Wysocki + +commit e8a0e30b742f76ebd0f3b196973df4bf65d8fbbb upstream. + +After making acpi_processor_get_platform_limit() use the "no limit" +value for its frequency QoS request when _PPC returns 0, it is not +necessary to replace the frequency corresponding to the first _PSS +return package entry with the maximum turbo frequency of the given +CPU in intel_pstate_init_acpi_perf_limits() any more, so drop the +code doing that along with the comment explaining it. + +Signed-off-by: Rafael J. Wysocki +Tested-by: Hagar Hemdan +Signed-off-by: Greg Kroah-Hartman +--- + drivers/cpufreq/intel_pstate.c | 14 -------------- + 1 file changed, 14 deletions(-) + +--- a/drivers/cpufreq/intel_pstate.c ++++ b/drivers/cpufreq/intel_pstate.c +@@ -443,20 +443,6 @@ static void intel_pstate_init_acpi_perf_ + (u32) cpu->acpi_perf_data.states[i].control); + } + +- /* +- * The _PSS table doesn't contain whole turbo frequency range. +- * This just contains +1 MHZ above the max non turbo frequency, +- * with control value corresponding to max turbo ratio. But +- * when cpufreq set policy is called, it will call with this +- * max frequency, which will cause a reduced performance as +- * this driver uses real max turbo frequency as the max +- * frequency. So correct this frequency in _PSS table to +- * correct max turbo frequency based on the turbo state. +- * Also need to convert to MHz as _PSS freq is in MHz. +- */ +- if (!global.turbo_disabled) +- cpu->acpi_perf_data.states[0].core_frequency = +- policy->cpuinfo.max_freq / 1000; + cpu->valid_pss_table = true; + pr_debug("_PPC limits will be enforced\n"); + diff --git a/queue-5.10/series b/queue-5.10/series index 20f97d6b748..8a75fdaa052 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -104,3 +104,6 @@ asoc-wm8904-fill-the-cache-for-wm8904_adc_test_0-register.patch ceph-never-send-metrics-if-disable_send_metrics-is-set.patch dm-cache-policy-smq-ensure-io-doesn-t-prevent-cleaner-policy-progress.patch drm-ttm-make-ttm_bo_unpin-more-defensive.patch +acpi-processor-perflib-use-the-no-limit-frequency-qos.patch +acpi-processor-perflib-avoid-updating-frequency-qos-unnecessarily.patch +cpufreq-intel_pstate-drop-acpi-_pss-states-table-patching.patch