[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191022022508.g3ar735237haybxe@vireshk-i7>
Date: Tue, 22 Oct 2019 07:55:08 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: Sudeep Holla <sudeep.holla@....com>
Cc: linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
rjw@...ysocki.net
Subject: Re: [PATCH] cpufreq: Move cancelling of policy update work just
after removing notifiers
On 21-10-19, 14:28, Sudeep Holla wrote:
> Commit 099967699ad9 ("cpufreq: Cancel policy update work scheduled before freeing")
> added cancel_work_sync(policy->update) after the frequency QoS were
> removed. We can cancel the work just after taking the last CPU in the
> policy offline and unregistering the notifiers as policy->update cannot
> be scheduled from anywhere at this point.
>
> However, due to other bugs, doing so still triggered the race between
> freeing of policy and scheduled policy update work. Now that all those
> issues are resolved, we can move this cancelling of any scheduled policy
> update work just after removing min/max notifiers.
>
> Signed-off-by: Sudeep Holla <sudeep.holla@....com>
> ---
> drivers/cpufreq/cpufreq.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> Hi Rafael,
>
> Based on Viresh's suggestion, I am posting a patch to move this
> cancel_work_sync earlier though it's not a must have change.
For me it is :)
> I will leave it up to your preference.
>
> Regards,
> Sudeep
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 829a3764df1b..48a224a6b178 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1268,6 +1268,9 @@ static void cpufreq_policy_free(struct cpufreq_policy *policy)
> freq_qos_remove_notifier(&policy->constraints, FREQ_QOS_MIN,
> &policy->nb_min);
>
> + /* Cancel any pending policy->update work before freeing the policy. */
> + cancel_work_sync(&policy->update);
> +
> if (policy->max_freq_req) {
> /*
> * CPUFREQ_CREATE_POLICY notification is sent only after
> @@ -1279,8 +1282,6 @@ static void cpufreq_policy_free(struct cpufreq_policy *policy)
> }
>
> freq_qos_remove_request(policy->min_freq_req);
> - /* Cancel any pending policy->update work before freeing the policy. */
> - cancel_work_sync(&policy->update);
> kfree(policy->min_freq_req);
>
> cpufreq_policy_put_kobj(policy);
Thanks for doing this.
Acked-by: Viresh Kumar <viresh.kumar@...aro.org>
--
viresh
Powered by blists - more mailing lists