[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3504053.Rmt1Mul0J4@kreacher>
Date: Tue, 18 Jun 2019 01:26:11 +0200
From: "Rafael J. Wysocki" <rjw@...ysocki.net>
To: Viresh Kumar <viresh.kumar@...aro.org>
Cc: linux-pm@...r.kernel.org,
Vincent Guittot <vincent.guittot@...aro.org>,
Qais.Yousef@....com, mka@...omium.org, juri.lelli@...il.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH V3 4/5] cpufreq: Register notifiers with the PM QoS framework
On Monday, June 10, 2019 12:51:35 PM CEST Viresh Kumar wrote:
> This registers the notifiers for min/max frequency constraints with the
> PM QoS framework. The constraints are also taken into consideration in
> cpufreq_set_policy().
>
> This also relocates cpufreq_policy_put_kobj() as it is required to be
> called from cpufreq_policy_alloc() now.
>
> No constraints are added until now though.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>
> ---
> drivers/cpufreq/cpufreq.c | 139 +++++++++++++++++++++++++++++++-------
> include/linux/cpufreq.h | 4 ++
> 2 files changed, 120 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 85ff958e01f1..547d221b2ff2 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -26,6 +26,7 @@
> #include <linux/kernel_stat.h>
> #include <linux/module.h>
> #include <linux/mutex.h>
> +#include <linux/pm_qos.h>
> #include <linux/slab.h>
> #include <linux/suspend.h>
> #include <linux/syscore_ops.h>
> @@ -1126,11 +1127,77 @@ static void handle_update(struct work_struct *work)
> cpufreq_update_policy(cpu);
> }
>
> +static void cpufreq_update_freq_work(struct work_struct *work)
> +{
> + struct cpufreq_policy *policy =
> + container_of(work, struct cpufreq_policy, req_work);
> + struct cpufreq_policy new_policy = *policy;
> +
> + /* We should read constraint values from QoS layer */
> + new_policy.min = 0;
> + new_policy.max = UINT_MAX;
> +
> + down_write(&policy->rwsem);
> +
> + if (!policy_is_inactive(policy))
> + cpufreq_set_policy(policy, &new_policy);
> +
> + up_write(&policy->rwsem);
> +}
> +
> +static int cpufreq_update_freq(struct cpufreq_policy *policy)
> +{
> + schedule_work(&policy->req_work);
> + return 0;
> +}
> +
> +static int cpufreq_notifier_min(struct notifier_block *nb, unsigned long freq,
> + void *data)
> +{
> + struct cpufreq_policy *policy = container_of(nb, struct cpufreq_policy, nb_min);
> +
> + return cpufreq_update_freq(policy);
> +}
> +
> +static int cpufreq_notifier_max(struct notifier_block *nb, unsigned long freq,
> + void *data)
> +{
> + struct cpufreq_policy *policy = container_of(nb, struct cpufreq_policy, nb_max);
> +
> + return cpufreq_update_freq(policy);
> +}
This is a bit convoluted.
Two different notifiers are registered basically for the same thing.
Any chance to use just one?
Powered by blists - more mailing lists