Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1325471 > unrolled thread
| Started by | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| First post | 2016-02-03 15:10 +0100 |
| Last post | 2016-02-04 02:50 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH V2 5/7] cpufreq: Merge cpufreq_offline_prepare/finish routines Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-03 15:10 +0100
Re: [PATCH V2 5/7] cpufreq: Merge cpufreq_offline_prepare/finish routines Saravana Kannan <skannan@codeaurora.org> - 2016-02-03 21:30 +0100
Re: [PATCH V2 5/7] cpufreq: Merge cpufreq_offline_prepare/finish routines Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-04 02:50 +0100
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2016-02-03 15:10 +0100 |
| Subject | [PATCH V2 5/7] cpufreq: Merge cpufreq_offline_prepare/finish routines |
| Message-ID | <qY6i7-2YF-5@gated-at.bofh.it> |
The offline routine was separated into two halves earlier by
'commit 1aee40ac9c86 ("cpufreq: Invoke __cpufreq_remove_dev_finish()
after releasing cpu_hotplug.lock");.
And the reasons cited were, race issues between accessing policy's sysfs
files and policy kobject's cleanup.
That race isn't valid anymore, as we don't remove the policy & its
kobject completely on hotplugs, but do that from ->remove() callback of
subsys framework.
These two routines can be merged back now.
This is a preparatory step for the next patch, that will enforce
policy->rwsem lock around __cpufreq_governor() routines STOP/EXIT
sequence.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/cpufreq/cpufreq.c | 36 ++++++++++--------------------------
1 file changed, 10 insertions(+), 26 deletions(-)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 5f7e24567e0e..dc43294e7b31 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1309,9 +1309,10 @@ static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif)
return ret;
}
-static void cpufreq_offline_prepare(unsigned int cpu)
+static void cpufreq_offline(unsigned int cpu)
{
struct cpufreq_policy *policy;
+ int ret;
pr_debug("%s: unregistering CPU %u\n", __func__, cpu);
@@ -1322,7 +1323,7 @@ static void cpufreq_offline_prepare(unsigned int cpu)
}
if (has_target()) {
- int ret = __cpufreq_governor(policy, CPUFREQ_GOV_STOP);
+ ret = __cpufreq_governor(policy, CPUFREQ_GOV_STOP);
if (ret)
pr_err("%s: Failed to stop governor\n", __func__);
}
@@ -1345,34 +1346,23 @@ static void cpufreq_offline_prepare(unsigned int cpu)
/* Start governor again for active policy */
if (!policy_is_inactive(policy)) {
if (has_target()) {
- int ret = __cpufreq_governor(policy, CPUFREQ_GOV_START);
+ ret = __cpufreq_governor(policy, CPUFREQ_GOV_START);
if (!ret)
ret = __cpufreq_governor(policy, CPUFREQ_GOV_LIMITS);
if (ret)
pr_err("%s: Failed to start governor\n", __func__);
}
- } else if (cpufreq_driver->stop_cpu) {
- cpufreq_driver->stop_cpu(policy);
- }
-}
-static void cpufreq_offline_finish(unsigned int cpu)
-{
- struct cpufreq_policy *policy = per_cpu(cpufreq_cpu_data, cpu);
-
- if (!policy) {
- pr_debug("%s: No cpu_data found\n", __func__);
return;
}
- /* Only proceed for inactive policies */
- if (!policy_is_inactive(policy))
- return;
+ if (cpufreq_driver->stop_cpu)
+ cpufreq_driver->stop_cpu(policy);
/* If cpu is last user of policy, free policy */
if (has_target()) {
- int ret = __cpufreq_governor(policy, CPUFREQ_GOV_POLICY_EXIT);
+ ret = __cpufreq_governor(policy, CPUFREQ_GOV_POLICY_EXIT);
if (ret)
pr_err("%s: Failed to exit governor\n", __func__);
}
@@ -1401,10 +1391,8 @@ static void cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif)
if (!policy)
return;
- if (cpu_online(cpu)) {
- cpufreq_offline_prepare(cpu);
- cpufreq_offline_finish(cpu);
- }
+ if (cpu_online(cpu))
+ cpufreq_offline(cpu);
cpumask_clear_cpu(cpu, policy->real_cpus);
remove_cpu_dev_symlink(policy, cpu);
@@ -2255,11 +2243,7 @@ static int cpufreq_cpu_callback(struct notifier_block *nfb,
break;
case CPU_DOWN_PREPARE:
- cpufreq_offline_prepare(cpu);
- break;
-
- case CPU_POST_DEAD:
- cpufreq_offline_finish(cpu);
+ cpufreq_offline(cpu);
break;
case CPU_DOWN_FAILED:
--
2.7.0.79.gdc08a19
[toc] | [next] | [standalone]
| From | Saravana Kannan <skannan@codeaurora.org> |
|---|---|
| Date | 2016-02-03 21:30 +0100 |
| Subject | Re: [PATCH V2 5/7] cpufreq: Merge cpufreq_offline_prepare/finish routines |
| Message-ID | <qYcdQ-6IA-7@gated-at.bofh.it> |
| In reply to | #1325471 |
On 02/03/2016 06:02 AM, Viresh Kumar wrote:
> The offline routine was separated into two halves earlier by
> 'commit 1aee40ac9c86 ("cpufreq: Invoke __cpufreq_remove_dev_finish()
> after releasing cpu_hotplug.lock");.
>
> And the reasons cited were, race issues between accessing policy's sysfs
> files and policy kobject's cleanup.
>
> That race isn't valid anymore, as we don't remove the policy & its
> kobject completely on hotplugs, but do that from ->remove() callback of
> subsys framework.
>
> These two routines can be merged back now.
>
> This is a preparatory step for the next patch, that will enforce
> policy->rwsem lock around __cpufreq_governor() routines STOP/EXIT
> sequence.
Is this stale text? Seems like this is now done in the *previous* patch?
-Saravana
--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
[toc] | [prev] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2016-02-04 02:50 +0100 |
| Subject | Re: [PATCH V2 5/7] cpufreq: Merge cpufreq_offline_prepare/finish routines |
| Message-ID | <qYhdv-1Vr-3@gated-at.bofh.it> |
| In reply to | #1325923 |
On 03-02-16, 12:21, Saravana Kannan wrote:
> On 02/03/2016 06:02 AM, Viresh Kumar wrote:
> >The offline routine was separated into two halves earlier by
> >'commit 1aee40ac9c86 ("cpufreq: Invoke __cpufreq_remove_dev_finish()
> >after releasing cpu_hotplug.lock");.
> >
> >And the reasons cited were, race issues between accessing policy's sysfs
> >files and policy kobject's cleanup.
> >
> >That race isn't valid anymore, as we don't remove the policy & its
> >kobject completely on hotplugs, but do that from ->remove() callback of
> >subsys framework.
> >
> >These two routines can be merged back now.
> >
> >This is a preparatory step for the next patch, that will enforce
> >policy->rwsem lock around __cpufreq_governor() routines STOP/EXIT
> >sequence.
>
> Is this stale text? Seems like this is now done in the *previous* patch?
No, the previous patch has fixed a single location only. The next
patch tried to fix others as well.
--
viresh
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web