]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 1 Aug 2023 07:24:00 +0000 (09:24 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 1 Aug 2023 07:24:00 +0000 (09:24 +0200)
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

queue-5.4/acpi-processor-perflib-avoid-updating-frequency-qos-unnecessarily.patch [new file with mode: 0644]
queue-5.4/acpi-processor-perflib-use-the-no-limit-frequency-qos.patch [new file with mode: 0644]
queue-5.4/cpufreq-intel_pstate-drop-acpi-_pss-states-table-patching.patch [new file with mode: 0644]
queue-5.4/series

diff --git a/queue-5.4/acpi-processor-perflib-avoid-updating-frequency-qos-unnecessarily.patch b/queue-5.4/acpi-processor-perflib-avoid-updating-frequency-qos-unnecessarily.patch
new file mode 100644 (file)
index 0000000..2785da5
--- /dev/null
@@ -0,0 +1,67 @@
+From 99387b016022c29234c4ebf9abd34358c6e56532 Mon Sep 17 00:00:00 2001
+From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
+Date: Wed, 28 Dec 2022 22:24:10 +0100
+Subject: ACPI: processor: perflib: Avoid updating frequency QoS unnecessarily
+
+From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+
+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 <rafael.j.wysocki@intel.com>
+Tested-by: Hagar Hemdan <hagarhem@amazon.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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.4/acpi-processor-perflib-use-the-no-limit-frequency-qos.patch b/queue-5.4/acpi-processor-perflib-use-the-no-limit-frequency-qos.patch
new file mode 100644 (file)
index 0000000..28ac6e3
--- /dev/null
@@ -0,0 +1,70 @@
+From c02d5feb6e2f60affc6ba8606d8d614c071e2ba6 Mon Sep 17 00:00:00 2001
+From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
+Date: Wed, 28 Dec 2022 22:21:49 +0100
+Subject: ACPI: processor: perflib: Use the "no limit" frequency QoS
+
+From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+
+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 <ptyadav@amazon.de>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Reviewed-by: Pratyush Yadav <ptyadav@amazon.de>
+Tested-by: Pratyush Yadav <ptyadav@amazon.de>
+Tested-by: Hagar Hemdan <hagarhem@amazon.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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.4/cpufreq-intel_pstate-drop-acpi-_pss-states-table-patching.patch b/queue-5.4/cpufreq-intel_pstate-drop-acpi-_pss-states-table-patching.patch
new file mode 100644 (file)
index 0000000..f402280
--- /dev/null
@@ -0,0 +1,46 @@
+From e8a0e30b742f76ebd0f3b196973df4bf65d8fbbb Mon Sep 17 00:00:00 2001
+From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
+Date: Wed, 28 Dec 2022 22:26:04 +0100
+Subject: cpufreq: intel_pstate: Drop ACPI _PSS states table patching
+
+From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+
+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 <rafael.j.wysocki@intel.com>
+Tested-by: Hagar Hemdan <hagarhem@amazon.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/cpufreq/intel_pstate.c |   14 --------------
+ 1 file changed, 14 deletions(-)
+
+--- a/drivers/cpufreq/intel_pstate.c
++++ b/drivers/cpufreq/intel_pstate.c
+@@ -442,20 +442,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");
index a96f906a49b1a10ae8766b7734b6be56fd7187ae..3029a5f5c8d40cc6fae30133a44a4641803e8b96 100644 (file)
@@ -78,3 +78,6 @@ virtio-net-fix-race-between-set-queues-and-probe.patch
 s390-dasd-fix-hanging-device-after-quiesce-resume.patch
 asoc-wm8904-fill-the-cache-for-wm8904_adc_test_0-register.patch
 dm-cache-policy-smq-ensure-io-doesn-t-prevent-cleaner-policy-progress.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