]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
cpufreq: Fix initialization of min and max frequency QoS requests
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 16 Dec 2021 19:32:15 +0000 (20:32 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 7 Mar 2022 15:36:20 +0000 (16:36 +0100)
BugLink: https://bugs.launchpad.net/bugs/1960566
[ Upstream commit 521223d8b3ec078f670c7c35a1a04b1b2af07966 ]

The min and max frequency QoS requests in the cpufreq core are
initialized to whatever the current min and max frequency values are
at the init time, but if any of these values change later (for
example, cpuinfo.max_freq is updated by the driver), these initial
request values will be limiting the CPU frequency unnecessarily
unless they are changed by user space via sysfs.

To address this, initialize min_freq_req and max_freq_req to
FREQ_QOS_MIN_DEFAULT_VALUE and FREQ_QOS_MAX_DEFAULT_VALUE,
respectively, so they don't really limit anything until user
space updates them.

Reported-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Tested-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/cpufreq/cpufreq.c

index 5a70f1d9db0c0f76cff9b6d7093956eefd6ad660..bb9aba268ae978ef9ed3965fb77d89ebde6e2f37 100644 (file)
@@ -1393,7 +1393,7 @@ static int cpufreq_online(unsigned int cpu)
 
                ret = freq_qos_add_request(&policy->constraints,
                                           policy->min_freq_req, FREQ_QOS_MIN,
-                                          policy->min);
+                                          FREQ_QOS_MIN_DEFAULT_VALUE);
                if (ret < 0) {
                        /*
                         * So we don't call freq_qos_remove_request() for an
@@ -1413,7 +1413,7 @@ static int cpufreq_online(unsigned int cpu)
 
                ret = freq_qos_add_request(&policy->constraints,
                                           policy->max_freq_req, FREQ_QOS_MAX,
-                                          policy->max);
+                                          FREQ_QOS_MAX_DEFAULT_VALUE);
                if (ret < 0) {
                        policy->max_freq_req = NULL;
                        goto out_destroy_policy;