mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
cpufreq: Use per-policy frequency QoS
Replace the CPU device PM QoS used for the management of min and max
frequency constraints in cpufreq (and its users) with per-policy
frequency QoS to avoid problems with cpufreq policies covering
more then one CPU.
Namely, a cpufreq driver is registered with the subsys interface
which calls cpufreq_add_dev() for each CPU, starting from CPU0, so
currently the PM QoS notifiers are added to the first CPU in the
policy (i.e. CPU0 in the majority of cases).
In turn, when the cpufreq driver is unregistered, the subsys interface
doing that calls cpufreq_remove_dev() for each CPU, starting from CPU0,
and the PM QoS notifiers are only removed when cpufreq_remove_dev() is
called for the last CPU in the policy, say CPUx, which as a rule is
not CPU0 if the policy covers more than one CPU. Then, the PM QoS
notifiers cannot be removed, because CPUx does not have them, and
they are still there in the device PM QoS notifiers list of CPU0,
which prevents new PM QoS notifiers from being registered for CPU0
on the next attempt to register the cpufreq driver.
The same issue occurs when the first CPU in the policy goes offline
before unregistering the driver.
After this change it does not matter which CPU is the policy CPU at
the driver registration time and whether or not it is online all the
time, because the frequency QoS is per policy and not per CPU.
Fixes: 67d874c3b2 ("cpufreq: Register notifiers with the PM QoS framework")
Reported-by: Dmitry Osipenko <[email protected]>
Tested-by: Dmitry Osipenko <[email protected]>
Reported-by: Sudeep Holla <[email protected]>
Tested-by: Sudeep Holla <[email protected]>
Diagnosed-by: Viresh Kumar <[email protected]>
Link: https://lore.kernel.org/linux-pm/5ad2624194baa2f53acc1f1e627eb7684c577a19.1562210705.git.viresh.kumar@linaro.org/T/#md2d89e95906b8c91c15f582146173dce2e86e99f
Link: https://lore.kernel.org/linux-pm/20191017094612.6tbkwoq4harsjcqv@vireshk-i7/T/#m30d48cc23b9a80467fbaa16e30f90b3828a5a29b
Signed-off-by: Rafael J. Wysocki <[email protected]>
Acked-by: Viresh Kumar <[email protected]>
This commit is contained in:
parent
77751a466e
commit
3000ce3c52
10 changed files with 114 additions and 114 deletions
|
|
@ -88,7 +88,7 @@ struct cpufreq_cooling_device {
|
|||
struct cpufreq_policy *policy;
|
||||
struct list_head node;
|
||||
struct time_in_idle *idle_time;
|
||||
struct dev_pm_qos_request qos_req;
|
||||
struct freq_qos_request qos_req;
|
||||
};
|
||||
|
||||
static DEFINE_IDA(cpufreq_ida);
|
||||
|
|
@ -331,7 +331,7 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev,
|
|||
|
||||
cpufreq_cdev->cpufreq_state = state;
|
||||
|
||||
return dev_pm_qos_update_request(&cpufreq_cdev->qos_req,
|
||||
return freq_qos_update_request(&cpufreq_cdev->qos_req,
|
||||
cpufreq_cdev->freq_table[state].frequency);
|
||||
}
|
||||
|
||||
|
|
@ -615,9 +615,9 @@ __cpufreq_cooling_register(struct device_node *np,
|
|||
cooling_ops = &cpufreq_cooling_ops;
|
||||
}
|
||||
|
||||
ret = dev_pm_qos_add_request(dev, &cpufreq_cdev->qos_req,
|
||||
DEV_PM_QOS_MAX_FREQUENCY,
|
||||
cpufreq_cdev->freq_table[0].frequency);
|
||||
ret = freq_qos_add_request(&policy->constraints,
|
||||
&cpufreq_cdev->qos_req, FREQ_QOS_MAX,
|
||||
cpufreq_cdev->freq_table[0].frequency);
|
||||
if (ret < 0) {
|
||||
pr_err("%s: Failed to add freq constraint (%d)\n", __func__,
|
||||
ret);
|
||||
|
|
@ -637,7 +637,7 @@ __cpufreq_cooling_register(struct device_node *np,
|
|||
return cdev;
|
||||
|
||||
remove_qos_req:
|
||||
dev_pm_qos_remove_request(&cpufreq_cdev->qos_req);
|
||||
freq_qos_remove_request(&cpufreq_cdev->qos_req);
|
||||
remove_ida:
|
||||
ida_simple_remove(&cpufreq_ida, cpufreq_cdev->id);
|
||||
free_table:
|
||||
|
|
@ -736,7 +736,7 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
|
|||
mutex_unlock(&cooling_list_lock);
|
||||
|
||||
thermal_cooling_device_unregister(cdev);
|
||||
dev_pm_qos_remove_request(&cpufreq_cdev->qos_req);
|
||||
freq_qos_remove_request(&cpufreq_cdev->qos_req);
|
||||
ida_simple_remove(&cpufreq_ida, cpufreq_cdev->id);
|
||||
kfree(cpufreq_cdev->idle_time);
|
||||
kfree(cpufreq_cdev->freq_table);
|
||||
|
|
|
|||
Loading…
Reference in a new issue