[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190614164641.GP137143@google.com>
Date: Fri, 14 Jun 2019 09:46:41 -0700
From: Matthias Kaehlcke <mka@...omium.org>
To: Viresh Kumar <viresh.kumar@...aro.org>
Cc: Rafael Wysocki <rjw@...ysocki.net>, linux-pm@...r.kernel.org,
Vincent Guittot <vincent.guittot@...aro.org>,
Qais.Yousef@....com, juri.lelli@...il.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH V3 4/5] cpufreq: Register notifiers with the PM QoS
framework
Hi Viresh,
On Mon, Jun 10, 2019 at 04:21:35PM +0530, 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);
I think you need to add a cancel_work_sync() in cpufreq_policy_free()
to make sure the work doesn't run after the policy has been freed.
Otherwise it looks good to me.
Cheers
Matthias
Powered by blists - more mailing lists