cpufreq: Last minute fixes for 3.12
Viresh Kumar
maintainercover cpufreq: Last minute fixes for 3.12
Hi Rafael/Srivatsa,
These are some last minute fixes for 3.12. I have found them while looking at the code to fix the latest suspend/resume crashes we see (Reported by Stephen)..
I believe at some place these are behind those crashes, otherwise people with a single cluster or single policy couldn't have faced it.. Like Stephen as he was working on Tegra.
I thought you will wait for my conversation with Srivatsa to get over before actually applying his patches, but saw that just happened :)
No issues, we can talk a bit more about the problems for now and then you can get whatever patches are required for 3.12-rc2
First three of the patchset are minor cleanups (you may or may not take them for 3.12), but last two are some real fixes.. I haven't faced any issue without them but simply found them in code review.
@Stephen: Probably you can try my branch: cpufreq-suspend-fix, which has these patches without Srivatsa's patches (though some bits of those will also be required I believe for multicluster systems)..
--
viresh
Viresh Kumar (5):
cpufreq: Remove extra blank line
cpufreq: don't break string in print statements
cpufreq: remove __cpufreq_remove_dev()
cpufreq: don't update policy->cpu while removing while removing other
CPUs
cpufreq: use correct values of cpus in __cpufreq_remove_dev_finish()
drivers/cpufreq/cpufreq.c | 50 +++++++++++++++++++---------------------------- 1 file changed, 20 insertions(+), 30 deletions(-)
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 1/5 cpufreq: Remove extra blank line
We don't need a blank line just at start of a block, lets remove it.
--- drivers/cpufreq/cpufreq.c | 1 - 1 file changed, 1 deletion(-)
drivers/cpufreq/cpufreq.c +0 -1
@@ -1185,7 +1185,6 @@ static int __cpufreq_remove_dev_prepare(struct device *dev,if (cpu != policy->cpu && !frozen) {sysfs_remove_link (&dev->kobj,"cpufreq" ); }else if (cpus >1 ) { - new_cpu =cpufreq_nominate_new_policy_cpu (policy, cpu, frozen);if (new_cpu >=0 ) {WARN_ON (lock_policy_rwsem_write (cpu));
Signature · 1 line
1.7.12.rc2.18.g61b472e
Re: [PATCH 1/5] cpufreq: Remove extra blank line
Quoted 2 lines · Viresh Kumar
We don't need a blank line just at start of a block, lets remove it.
Well, I felt having that line avoids clutter, especially since the code around it was already a bit hard to read..
Anyway, I don't have any strong opinions either way. So no objections from my side. (But you might have to rebase this patch on top of Rafael's tree, due to the recent changes he pushed in to this code).
Regards,
Srivatsa S. Bhat
Quoted 18 lines
Signed-off-by Viresh Kumar <[email protected]>--- drivers/cpufreq/cpufreq.c | 1 - 1 file changed, 1 deletion(-)drivers/cpufreq/cpufreq.c +0
-1@@ -1185,7 +1185,6 @@ static int __cpufreq_remove_dev_prepare(struct device *dev,if (cpu != policy->cpu && !frozen) {sysfs_remove_link (&dev->kobj,"cpufreq" ); }else if (cpus >1 ) { - new_cpu =cpufreq_nominate_new_policy_cpu (policy, cpu, frozen);if (new_cpu >=0 ) {WARN_ON (lock_policy_rwsem_write (cpu));
Viresh Kumar
maintainerRe: [PATCH 1/5] cpufreq: Remove extra blank line
Quoted 2 lines · Srivatsa S. Bhat
Well, I felt having that line avoids clutter, especially since the code around it was already a bit hard to read..
Well, its exact opposite for me.. somehow my attending keeps dragging to extra blank lines :)
Quoted 3 lines
Anyway, I don't have any strong opinions either way. So no objections from my side. (But you might have to rebase this patch on top of Rafael's tree, due to the recent changes he pushed in to this code).
I tried a rebase and couldn't find a issue.. And so not resending the series.
Viresh Kumar
maintainerPATCH 2/5 cpufreq: don't break string in print statements
In reply to Viresh KumarAs a rule its better not to break string (quoted inside "") in a print statement even if it crosses 80 column boundary as that may introduce unwanted bugs and so this patch rewrites one of the print statements..
--- drivers/cpufreq/cpufreq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/cpufreq/cpufreq.c +2 -2
@@ -1192,8 +1192,8 @@ static int __cpufreq_remove_dev_prepare(struct device *dev,unlock_policy_rwsem_write (cpu);if (!frozen) { -pr_debug ("%s: policy Kobject moved to cpu: %d " -"from: %d\n" ,__func__, new_cpu, cpu); +pr_debug ("%s: policy Kobject moved to cpu: %d from: %d\n" , + __func__, new_cpu, cpu); } } }
Signature · 1 line
1.7.12.rc2.18.g61b472e
Re: [PATCH 2/5] cpufreq: don't break string in print statements
Quoted 4 lines · Viresh Kumar
As a rule its better not to break string (quoted inside "") in a print statement even if it crosses 80 column boundary as that may introduce unwanted bugs and so this patch rewrites one of the print statements..
Ok, if that is the convention, then so be it.
Quoted 1 line
Signed-off-by Viresh Kumar <[email protected]>
Regards,
Srivatsa S. Bhat
Quoted 20 lines
--- drivers/cpufreq/cpufreq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/cpufreq/cpufreq.c +2
-2@@ -1192,8 +1192,8 @@ static int __cpufreq_remove_dev_prepare(struct device *dev,unlock_policy_rwsem_write (cpu);if (!frozen) { -pr_debug ("%s: policy Kobject moved to cpu: %d " -"from: %d\n" ,__func__, new_cpu, cpu); +pr_debug ("%s: policy Kobject moved to cpu: %d from: %d\n" , + __func__, new_cpu, cpu); } } }
Viresh Kumar
maintainerPATCH 3/5 cpufreq: remove __cpufreq_remove_dev()
In reply to Viresh KumarNobody except cpufreq_remove_dev() is calling __cpufreq_remove_dev() and so we don't need separate routines here. Lets merge code from __cpufreq_remove_dev() to cpufreq_remove_dev() and get rid of __cpufreq_remove_dev().
--- drivers/cpufreq/cpufreq.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-)
drivers/cpufreq/cpufreq.c +8 -18
@@ -1285,36 +1285,26 @@ static int __cpufreq_remove_dev_finish(struct device *dev, }/** -* __cpufreq_remove_dev - remove a CPU device +* cpufreq_remove_dev - remove a CPU device * * Removes the cpufreq interface for a CPU device. * Caller should already have policy_rwsem in write mode for this CPU. * This routine frees the rwsem before returning. */ -static inline int __cpufreq_remove_dev (struct device *dev, -struct subsys_interface *sif, -bool frozen) -{ -int ret; - - ret =__cpufreq_remove_dev_prepare (dev, sif, frozen); - -if (!ret) - ret =__cpufreq_remove_dev_finish (dev, sif, frozen); - -return ret; -} -static int cpufreq_remove_dev (struct device *dev,struct subsys_interface *sif) {unsigned int cpu = dev->id; -int retval; +int ret;if (cpu_is_offline (cpu))return 0 ; - retval =__cpufreq_remove_dev (dev, sif, false); -return retval; + ret =__cpufreq_remove_dev_prepare (dev, sif, false); + +if (!ret) + ret =__cpufreq_remove_dev_finish (dev, sif, false); + +return ret; }static void handle_update (struct work_struct *work)
Signature · 1 line
1.7.12.rc2.18.g61b472e
Re: [PATCH 3/5] cpufreq: remove __cpufreq_remove_dev()
Quoted 5 lines · Viresh Kumar
Nobody except
cpufreq_remove_dev()is calling__cpufreq_remove_dev()and so we don't need separate routines here. Lets merge code from__cpufreq_remove_dev()tocpufreq_remove_dev()and get rid of__cpufreq_remove_dev().Signed-off-by Viresh Kumar <[email protected]>
Regards,
Srivatsa S. Bhat
Quoted 54 lines
--- drivers/cpufreq/cpufreq.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-)drivers/cpufreq/cpufreq.c +8
-18@@ -1285,36 +1285,26 @@ static int __cpufreq_remove_dev_finish(struct device *dev, }/** -* __cpufreq_remove_dev - remove a CPU device +* cpufreq_remove_dev - remove a CPU device * * Removes the cpufreq interface for a CPU device. * Caller should already have policy_rwsem in write mode for this CPU. * This routine frees the rwsem before returning. */ -static inline int __cpufreq_remove_dev (struct device *dev, -struct subsys_interface *sif, -bool frozen) -{ -int ret; - - ret =__cpufreq_remove_dev_prepare (dev, sif, frozen); - -if (!ret) - ret =__cpufreq_remove_dev_finish (dev, sif, frozen); - -return ret; -} -static int cpufreq_remove_dev (struct device *dev,struct subsys_interface *sif) {unsigned int cpu = dev->id; -int retval; +int ret;if (cpu_is_offline (cpu))return 0 ; - retval =__cpufreq_remove_dev (dev, sif, false); -return retval; + ret =__cpufreq_remove_dev_prepare (dev, sif, false); + +if (!ret) + ret =__cpufreq_remove_dev_finish (dev, sif, false); + +return ret; }static void handle_update (struct work_struct *work)
Viresh Kumar
maintainerPATCH 4/5 cpufreq: don't update policy->cpu while removing while removing other CPUs
In reply to Viresh KumarWith a recent change the logic here is changed a bit and I just figured out it is something we don't want.
Consider we have four CPUs (0,1,2,3) managed by a policy and policy->cpu is set to 0. Now we are suspending and hence we call __cpufreq_remove_dev_prepare() for cpu 1, 2 & 3..
With the current code we always call cpufreq_nominate_new_policy_cpu() for cpu 1, 2 & 3 whereas we should skipped most of __cpufreq_remove_dev_prepare() routine.
Lets fix it by moving the check for !frozen inside the first if block.
--- drivers/cpufreq/cpufreq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/cpufreq/cpufreq.c +3 -2
@@ -1182,8 +1182,9 @@ static int __cpufreq_remove_dev_prepare(struct device *dev,cpumask_clear_cpu (cpu, policy->cpus);unlock_policy_rwsem_write (cpu); -if (cpu != policy->cpu && !frozen) { -sysfs_remove_link (&dev->kobj,"cpufreq" ); +if (cpu != policy->cpu) { +if (!frozen) +sysfs_remove_link (&dev->kobj,"cpufreq" ); }else if (cpus >1 ) { new_cpu =cpufreq_nominate_new_policy_cpu (policy, cpu, frozen);if (new_cpu >=0 ) {
Signature · 1 line
1.7.12.rc2.18.g61b472e
Re: [PATCH 4/5] cpufreq: don't update policy->cpu while removing while removing other CPUs
Quoted 7 lines · Viresh Kumar
With a recent change the logic here is changed a bit and I just figured out it is something we don't want.
Consider we have four CPUs (0,1,2,3) managed by a policy and
policy->cpuis set to 0. Now we are suspending and hence we call__cpufreq_remove_dev_prepare()for cpu 1, 2 & 3..
Quoted 6 lines
With the current code we always call
cpufreq_nominate_new_policy_cpu()for cpu 1, 2 & 3 whereas we should skipped most of__cpufreq_remove_dev_prepare()routine.Lets fix it by moving the check for !frozen inside the first if block.
As you noted in the other thread, Rafael already applied my patch[1] which does the same thing. So I guess you'll drop this patch from your series.
[1].http://git.kernel.org/cgit/linux/kernel/git/rafael/linux-pm.git/commit/?h=bleeding-edge&id=61173f256
Regards,
Srivatsa S. Bhat
Quoted 22 lines
Signed-off-by Viresh Kumar <[email protected]>--- drivers/cpufreq/cpufreq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/cpufreq/cpufreq.c +3
-2@@ -1182,8 +1182,9 @@ static int __cpufreq_remove_dev_prepare(struct device *dev,cpumask_clear_cpu (cpu, policy->cpus);unlock_policy_rwsem_write (cpu); -if (cpu != policy->cpu && !frozen) { -sysfs_remove_link (&dev->kobj,"cpufreq" ); +if (cpu != policy->cpu) { +if (!frozen) +sysfs_remove_link (&dev->kobj,"cpufreq" ); }else if (cpus >1 ) { new_cpu =cpufreq_nominate_new_policy_cpu (policy, cpu, frozen);if (new_cpu >=0 ) {
Viresh Kumar
maintainerPATCH 5/5 cpufreq: use correct values of cpus in __cpufreq_remove_dev_finish()
In reply to Viresh KumarThis broke after a recent change "cedb70a cpufreq: Split __cpufreq_remove_dev() into two parts" from Srivatsa..
Consider a scenario where we have two CPUs in a policy (0 & 1) and we are removing cpu 1. On the call to __cpufreq_remove_dev_prepare() we have cleared 1 from policy->cpus and now on a call to __cpufreq_remove_dev_finish() we read cpumask_weight of policy->cpus, which will come as 1 and this code will behave as if we are removing the last cpu from policy :)
Fix it by clearing cpu mask in __cpufreq_remove_dev_finish() instead of __cpufreq_remove_dev_prepare().
--- drivers/cpufreq/cpufreq.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/cpufreq/cpufreq.c +7 -7
@@ -1175,12 +1175,9 @@ static int __cpufreq_remove_dev_prepare(struct device *dev, policy->governor->name, CPUFREQ_NAME_LEN);#endif -WARN_ON (lock_policy_rwsem_write (cpu)); +lock_policy_rwsem_read (cpu); cpus =cpumask_weight (policy->cpus); - -if (cpus >1 ) -cpumask_clear_cpu (cpu, policy->cpus); -unlock_policy_rwsem_write (cpu); +unlock_policy_rwsem_read (cpu);if (cpu != policy->cpu) {if (!frozen)
@@ -1222,9 +1219,12 @@ static int __cpufreq_remove_dev_finish(struct device *dev,return -EINVAL ; } -lock_policy_rwsem_read (cpu); +WARN_ON (lock_policy_rwsem_write (cpu)); cpus =cpumask_weight (policy->cpus); -unlock_policy_rwsem_read (cpu); + +if (cpus >1 ) +cpumask_clear_cpu (cpu, policy->cpus); +unlock_policy_rwsem_write (cpu);/* If cpu is last user of policy, free policy */ if (cpus ==1 ) {
Signature · 1 line
1.7.12.rc2.18.g61b472e
Re: [PATCH 5/5] cpufreq: use correct values of cpus in __cpufreq_remove_dev_finish()
Quoted 12 lines · Viresh Kumar
This broke after a recent change "cedb70a cpufreq: Split
__cpufreq_remove_dev()into two parts" from Srivatsa..Consider a scenario where we have two CPUs in a policy (0 & 1) and we are removing cpu 1. On the call to
__cpufreq_remove_dev_prepare()we have cleared 1 frompolicy->cpusand now on a call to__cpufreq_remove_dev_finish()we readcpumask_weightofpolicy->cpus, which will come as 1 and this code will behave as if we are removing the last cpu from policy :)Fix it by clearing cpu mask in
__cpufreq_remove_dev_finish()instead of__cpufreq_remove_dev_prepare().
Oops! Good catch!
That said, your fix doesn't look correct. See below.
Quoted 14 lines
Signed-off-by Viresh Kumar <[email protected]>--- drivers/cpufreq/cpufreq.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)drivers/cpufreq/cpufreq.c +0
-1@@ -1175,12 +1175,9 @@ static int __cpufreq_remove_dev_prepare(struct device *dev, policy->governor->name, CPUFREQ_NAME_LEN);#endif -WARN_ON (lock_policy_rwsem_write (cpu));
drivers/cpufreq/cpufreq.c static int __cpufreq_remove_dev_prepare(struct device *dev, · line 1183
Quoted 10 lines
drivers/cpufreq/cpufreq.c +2
-4+lock_policy_rwsem_read (cpu); cpus =cpumask_weight (policy->cpus); - -if (cpus >1 ) -cpumask_clear_cpu (cpu, policy->cpus); -unlock_policy_rwsem_write (cpu); +unlock_policy_rwsem_read (cpu);if (cpu != policy->cpu) {if (!frozen)
Around here, we call cpufreq_nominate_new_policy_cpu(), and if we haven't cleared the CPU by then, there is a chance that it will nominate the same CPU that we are taking offline. So its important to clear the CPU before that point.
drivers/cpufreq/cpufreq.c static int __cpufreq_remove_dev_finish(struct device *dev, · line 1228
Quoted 13 lines
drivers/cpufreq/cpufreq.c +5
-2@@ -1222,9 +1219,12 @@ static int __cpufreq_remove_dev_finish(struct device *dev,return -EINVAL ; } -lock_policy_rwsem_read (cpu); +WARN_ON (lock_policy_rwsem_write (cpu)); cpus =cpumask_weight (policy->cpus); -unlock_policy_rwsem_read (cpu); + +if (cpus >1 ) +cpumask_clear_cpu (cpu, policy->cpus); +unlock_policy_rwsem_write (cpu);
Perhaps we can retain the above as a read operation, ...
drivers/cpufreq/cpufreq.c static int __cpufreq_remove_dev_finish(struct device *dev, · line 1230
Quoted 3 lines
drivers/cpufreq/cpufreq.c +0
-0/* If cpu is last user of policy, free policy */ if (cpus ==1 ) {
... and change this suitably (from 1 to 0 etc..) ? To add to it, it will look more clear as well:
if (cpus == 0) {
/* No cpus in policy, so free it */
} else {
/* Restart governor */
}Regards,
Srivatsa S. Bhat
Viresh Kumar
maintainerRe: [PATCH 5/5] cpufreq: use correct values of cpus in __cpufreq_remove_dev_finish()
Quoted 1 line · Srivatsa S. Bhat
That said, your fix doesn't look correct. See below.
I thought I was perfect !! :(
Quoted 8 lines
... and change this suitably (from 1 to 0 etc..) ? To add to it, it will look more clear as well:
if (cpus == 0) { /* No cpus in policy, so free it */ } else { /* Restart governor */ }
Currently cpus never become zero as we clear mask only while there are more than one cpu in a policy... Wait let me see what's the cleanest way to get this fixed..
Viresh Kumar
maintainerRe: [PATCH 5/5] cpufreq: use correct values of cpus in __cpufreq_remove_dev_finish()
Quoted 3 lines · Viresh Kumar
Currently cpus never become zero as we clear mask only while there are more than one cpu in a policy... Wait let me see what's the cleanest way to get this fixed..
Okay, simply replace cpumask_first() with cpumask_any_but() in cpufreq_nominate_new_policy_cpu() :)
Re: [PATCH 5/5] cpufreq: use correct values of cpus in __cpufreq_remove_dev_finish()
Quoted 8 lines · Viresh Kumar
Quoted 3 lines · Viresh Kumar
Currently cpus never become zero as we clear mask only while there are more than one cpu in a policy... Wait let me see what's the cleanest way to get this fixed..
Okay, simply replace
cpumask_first()withcpumask_any_but()incpufreq_nominate_new_policy_cpu():)
That sounds good! Even the naming is much better, it conveys the intent clearly.
Regards,
Srivatsa S. Bhat
Viresh Kumar
maintainerRe: [PATCH 5/5] cpufreq: use correct values of cpus in __cpufreq_remove_dev_finish()
Quoted 2 lines · Srivatsa S. Bhat
That sounds good! Even the naming is much better, it conveys the intent clearly.
Folded below change in my patch (attached):
drivers/cpufreq/cpufreq.c +0 -0
@@ -1111,7 +1111,7 @@ static int
cpufreq_nominate_new_policy_cpu(struct cpufreq_policy *policy,
int ret;
/* first sibling now owns the new sysfs dir */- cpu_dev = get_cpu_device(cpumask_first(policy->cpus));
+ cpu_dev = get_cpu_device(cpumask_any_but(policy->cpus, old_cpu));
/* Don't touch sysfs files during light-weight tear-down */
if (frozen)--
thanks
From a67b0daaabd0e18e1a912a16521c405bc17bded9 Mon Sep 17 00:00:00 2001
Message-Id: <a67b0daaabd0e18e1a912a16521c405bc17bded9.1378977689.git.viresh.kumar@linaro.org>
From: Viresh Kumar <[email protected]>
Date: Thu, 12 Sep 2013 10:25:00 +0530
Subject: [PATCH] cpufreq: use correct values of cpus in
__cpufreq_remove_dev_finish()
This broke after a recent change "cedb70a cpufreq: Split __cpufreq_remove_dev() into two parts" from Srivatsa..
Consider a scenario where we have two CPUs in a policy (0 & 1) and we are removing cpu 1. On the call to __cpufreq_remove_dev_prepare() we have cleared 1 from policy->cpus and now on a call to __cpufreq_remove_dev_finish() we read cpumask_weight of policy->cpus, which will come as 1 and this code will behave as if we are removing the last cpu from policy :)
Fix it by clearing cpu mask in __cpufreq_remove_dev_finish() instead of __cpufreq_remove_dev_prepare().
--- drivers/cpufreq/cpufreq.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/cpufreq/cpufreq.c +8 -8
@@ -1111,7 +1111,7 @@ static int cpufreq_nominate_new_policy_cpu(struct cpufreq_policy *policy,int ret;/* first sibling now owns the new sysfs dir */ - cpu_dev =get_cpu_device (cpumask_first (policy->cpus)); + cpu_dev =get_cpu_device (cpumask_any_but (policy->cpus, old_cpu));/* Don't touch sysfs files during light-weight tear-down */ if (frozen)
@@ -1175,12 +1175,9 @@ static int __cpufreq_remove_dev_prepare(struct device *dev, policy->governor->name, CPUFREQ_NAME_LEN);#endif -WARN_ON (lock_policy_rwsem_write (cpu)); +lock_policy_rwsem_read (cpu); cpus =cpumask_weight (policy->cpus); - -if (cpus >1 ) -cpumask_clear_cpu (cpu, policy->cpus); -unlock_policy_rwsem_write (cpu); +unlock_policy_rwsem_read (cpu);if (cpu != policy->cpu) {if (!frozen)
@@ -1222,9 +1219,12 @@ static int __cpufreq_remove_dev_finish(struct device *dev,return -EINVAL ; } -lock_policy_rwsem_read (cpu); +WARN_ON (lock_policy_rwsem_write (cpu)); cpus =cpumask_weight (policy->cpus); -unlock_policy_rwsem_read (cpu); + +if (cpus >1 ) +cpumask_clear_cpu (cpu, policy->cpus); +unlock_policy_rwsem_write (cpu);/* If cpu is last user of policy, free policy */ if (cpus ==1 ) {
Signature · 1 line
1.7.12.rc2.18.g61b472e
Re: [PATCH 5/5] cpufreq: use correct values of cpus in __cpufreq_remove_dev_finish()
Quoted 6 lines · Viresh Kumar
Quoted 2 lines · Srivatsa S. Bhat
That sounds good! Even the naming is much better, it conveys the intent clearly.
Folded below change in my patch (attached):
Please resend. And I honestly don't think that [1-3/5] are fixes and [4/5] is not needed any more.
Quoted 16 lines
drivers/cpufreq/cpufreq.c +1
-1@@ -1111,7 +1111,7 @@ static int cpufreq_nominate_new_policy_cpu(struct cpufreq_policy *policy, int ret;/* first sibling now owns the new sysfs dir */ - cpu_dev =get_cpu_device (cpumask_first (policy->cpus)); + cpu_dev =get_cpu_device (cpumask_any_but (policy->cpus, old_cpu));/* Don't touch sysfs files during light-weight tear-down */ if (frozen)
--
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
Viresh Kumar
maintainerRe: [PATCH 5/5] cpufreq: use correct values of cpus in __cpufreq_remove_dev_finish()
Quoted 2 lines · Rafael J. Wysocki
Please resend. And I honestly don't think that [1-3/5] are fixes and [4/5] is not needed any more.
Okay, I will resend 5/5.. I didn't get you last two statements clearly :(
- don't think that [1-3/5] are fixes: You meant they are cleanups rather? Yes, and that's why I asked you to take those on for 3.13 and not for 12..
- [4/5] is not needed any more: 4/5 is already applied by you and it came from Rafael.. I reinvented the wheel, nothing more. And so it is not required anymore :)
Re: [PATCH 5/5] cpufreq: use correct values of cpus in __cpufreq_remove_dev_finish()
Quoted 6 lines · Viresh Kumar
Quoted 2 lines · Rafael J. Wysocki
Please resend. And I honestly don't think that [1-3/5] are fixes and [4/5] is not needed any more.
Okay, I will resend 5/5.. I didn't get you last two statements clearly :(
- don't think that [1-3/5] are fixes: You meant they are cleanups rather?
Yes.
Quoted 1 line
Yes, and that's why I asked you to take those on for 3.13 and not for 12..
Ah, sorry, I must have overlooked that. I didn't say I wasn't going to take them, though.
Quoted 3 lines
- [4/5] is not needed any more: 4/5 is already applied by you and it came from Rafael.. I reinvented the wheel, nothing more. And so it is not required anymore :)
Surely from Srivatsa?
Thanks,
Rafael
Viresh Kumar
maintainerRe: [PATCH 5/5] cpufreq: use correct values of cpus in __cpufreq_remove_dev_finish()
Quoted 1 line · Rafael J. Wysocki
Surely from Srivatsa?
Ofcourse.. I kept repeating this to myself... "Viresh, please read mails you have written before you send.. So many times you are pointed about these silly mistakes"... And I keep forgetting them, ah its a fairly small mail, what can go wrong.. :)
--
viresh
Stephen Warren
Tested-byRe: [PATCH 5/5] cpufreq: use correct values of cpus in __cpufreq_remove_dev_finish()
In reply to Viresh KumarQuoted 6 lines · Viresh Kumar
Quoted 2 lines · Srivatsa S. Bhat
That sounds good! Even the naming is much better, it conveys the intent clearly.
Folded below change in my patch (attached):
...
For the record, the patch which was attached to Viresh's email solves the hangs I was getting in next-20130912 during (the second?) CPU hotplug and resume. So,
Without this, I saw:
Quoted 10 lines
root@localhost:~# ./cpuonline.py echo 0 > /sys/devices/system/cpu/cpu1/online [ 24.049729] CPU1: shutdown echo 1 > /sys/devices/system/cpu/cpu1/online [ 26.090439] CPU1: Booted secondary processor root@localhost:~# ./cpuonline.py echo 0 > /sys/devices/system/cpu/cpu1/online [ 29.003016] CPU1: shutdown echo 1 > /sys/devices/system/cpu/cpu1/online [ 31.032562] CPU1: Booted secondary processor
[hung]
Quoted 30 lines
[ 240.300393] INFO: task ondemand:678 blocked for more than 120 seconds. [ 240.312842] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 240.326658] ondemand D c050f6cc 0 678 1 0x00000000 [ 240.339062] [<c050f6cc>] (__schedule+0x330/0x6d0) from [<c050fe50>] (schedule_preempt_disabled+0x24/0x34) [ 240.354904] [<c050fe50>] (schedule_preempt_disabled+0x24/0x34) from [<c050e810>] (__mutex_lock_slowpath+0x178/0x370) [ 240.371767] [<c050e810>] (__mutex_lock_slowpath+0x178/0x370) from [<c050ea14>] (mutex_lock+0xc/0x24) [ 240.387363] [<c050ea14>] (mutex_lock+0xc/0x24) from [<c00245e8>] (get_online_cpus+0x2c/0x48) [ 240.402273] [<c00245e8>] (get_online_cpus+0x2c/0x48) from [<c0342c0c>] (store+0x18/0xbc) [ 240.417688] [<c0342c0c>] (store+0x18/0xbc) from [<c011d598>] (sysfs_write_file+0x168/0x198) [ 240.432687] [<c011d598>] (sysfs_write_file+0x168/0x198) from [<c00cbf98>] (vfs_write+0xb0/0x188) [ 240.448185] [<c00cbf98>] (vfs_write+0xb0/0x188) from [<c00cc348>] (SyS_write+0x3c/0x70) [ 240.462964] [<c00cc348>] (SyS_write+0x3c/0x70) from [<c000e540>] (ret_fast_syscall+0x0/0x30) [ 240.478239] INFO: task sh:827 blocked for more than 120 seconds. [ 240.491027] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 240.505795] sh D c050f6cc 0 827 825 0x00000001 [ 240.519169] [<c050f6cc>] (__schedule+0x330/0x6d0) from [<c0510660>] (__down_write_nested+0x78/0xcc) [ 240.535666] [<c0510660>] (__down_write_nested+0x78/0xcc) from [<c0342ae0>] (lock_policy_rwsem_write+0x34/0x48) [ 240.552950] [<c0342ae0>] (lock_policy_rwsem_write+0x34/0x48) from [<c0343a04>] (cpufreq_update_policy+0x20/0xec) [ 240.570631] [<c0343a04>] (cpufreq_update_policy+0x20/0xec) from [<c0344410>] (cpufreq_cpu_callback+0x78/0x8c) [ 240.588051] [<c0344410>] (cpufreq_cpu_callback+0x78/0x8c) from [<c0042f44>] (notifier_call_chain+0x44/0x84) [ 240.605401] [<c0042f44>] (notifier_call_chain+0x44/0x84) from [<c0024594>] (__cpu_notify+0x28/0x44) [ 240.622085] [<c0024594>] (__cpu_notify+0x28/0x44) from [<c00247fc>] (_cpu_up+0x100/0x154) [ 240.638006] [<c00247fc>] (_cpu_up+0x100/0x154) from [<c00248c4>] (cpu_up+0x5c/0x84) [ 240.653405] [<c00248c4>] (cpu_up+0x5c/0x84) from [<c028a2a8>] (device_online+0x64/0x88) [ 240.669263] [<c028a2a8>] (device_online+0x64/0x88) from [<c028a328>] (store_online+0x5c/0x64) [ 240.685683] [<c028a328>] (store_online+0x5c/0x64) from [<c028816c>] (dev_attr_store+0x18/0x24) [ 240.702337] [<c028816c>] (dev_attr_store+0x18/0x24) from [<c011d598>] (sysfs_write_file+0x168/0x198) [ 240.719520] [<c011d598>] (sysfs_write_file+0x168/0x198) from [<c00cbf98>] (vfs_write+0xb0/0x188) [ 240.736614] [<c00cbf98>] (vfs_write+0xb0/0x188) from [<c00cc348>] (SyS_write+0x3c/0x70) [ 240.752799] [<c00cc348>] (SyS_write+0x3c/0x70) from [<c000e540>] (ret_fast_syscall+0x0/0x30)
Re: [PATCH 5/5] cpufreq: use correct values of cpus in __cpufreq_remove_dev_finish()
In reply to Viresh KumarQuoted 11 lines · Viresh Kumar
This broke after a recent change "cedb70a cpufreq: Split
__cpufreq_remove_dev()into two parts" from Srivatsa..Consider a scenario where we have two CPUs in a policy (0 & 1) and we are removing cpu 1. On the call to
__cpufreq_remove_dev_prepare()we have cleared 1 frompolicy->cpusand now on a call to__cpufreq_remove_dev_finish()we readcpumask_weightofpolicy->cpus, which will come as 1 and this code will behave as if we are removing the last cpu from policy :)Fix it by clearing cpu mask in
__cpufreq_remove_dev_finish()instead of__cpufreq_remove_dev_prepare().
I see this patch isn't in linux-next yet, nor did it make 3.12-rc1. I assume it'll make 3.12-rc2? It solves various CPU hotplug and suspend/resume issues for me.
Viresh Kumar
maintainerRe: [PATCH 5/5] cpufreq: use correct values of cpus in __cpufreq_remove_dev_finish()
Quoted 10 lines · Stephen Warren
Quoted 9 lines · Viresh Kumar
This broke after a recent change "cedb70a cpufreq: Split
__cpufreq_remove_dev()into two parts" from Srivatsa..Consider a scenario where we have two CPUs in a policy (0 & 1) and we are removing cpu 1. On the call to
__cpufreq_remove_dev_prepare()we have cleared 1 frompolicy->cpusand now on a call to__cpufreq_remove_dev_finish()we readcpumask_weightofpolicy->cpus, which will come as 1 and this code will behave as if we are removing the last cpu from policy :)
Quoted 6 lines
Quoted 2 lines
Fix it by clearing cpu mask in
__cpufreq_remove_dev_finish()instead of__cpufreq_remove_dev_prepare().I see this patch isn't in linux-next yet, nor did it make 3.12-rc1. I assume it'll make 3.12-rc2? It solves various CPU hotplug and suspend/resume issues for me.
Yes, I have asked Rafael to get this in for rc2 and few others too.. Waiting for his reply though..
--
viresh
Re: [PATCH 5/5] cpufreq: use correct values of cpus in __cpufreq_remove_dev_finish()
Quoted 14 lines · Viresh Kumar
Quoted 13 lines · Stephen Warren
Quoted 11 lines · Viresh Kumar
This broke after a recent change "cedb70a cpufreq: Split
__cpufreq_remove_dev()into two parts" from Srivatsa..Consider a scenario where we have two CPUs in a policy (0 & 1) and we are removing cpu 1. On the call to
__cpufreq_remove_dev_prepare()we have cleared 1 frompolicy->cpusand now on a call to__cpufreq_remove_dev_finish()we readcpumask_weightofpolicy->cpus, which will come as 1 and this code will behave as if we are removing the last cpu from policy :)Fix it by clearing cpu mask in
__cpufreq_remove_dev_finish()instead of__cpufreq_remove_dev_prepare().
Quoted 6 lines
Quoted 3 lines
I see this patch isn't in linux-next yet, nor did it make 3.12-rc1. I assume it'll make 3.12-rc2? It solves various CPU hotplug and suspend/resume issues for me.
Yes, I have asked Rafael to get this in for rc2 and few others too.. Waiting for his reply though..
Care to remind me what the other patches were?
Rafael
Viresh Kumar
maintainerRe: [PATCH 5/5] cpufreq: use correct values of cpus in __cpufreq_remove_dev_finish()
In reply to Viresh KumarQuoted 4 lines · Viresh Kumar
On 17 September 2013 20:50, Stephen Warren <[email protected]> wrote:
Yes, I have asked Rafael to get this in for rc2 and few others too.. Waiting for his reply though..
Its applied now by Rafael..
Viresh Kumar
maintainerQuoted 11 lines · Viresh Kumar
First three of the patchset are minor cleanups (you may or may not take them for 3.12), but last two are some real fixes.. I haven't faced any issue without them but simply found them in code review.
Viresh Kumar (5):
cpufreq: Remove extra blank line
cpufreq: don't break string in print statements
cpufreq: remove__cpufreq_remove_dev()
cpufreq: don't updatepolicy->cpuwhile removing while removing other
CPUs
cpufreq: use correct values of cpus in__cpufreq_remove_dev_finish()
So in the end there is only one real fix in this series as 4/4/ is already in..
To make it clear again these are my pending patches for cpufreq:
For 3.12-rc2:
- 5/5 of this patchset (modified one)..
- "serialize freq transitions" that I will send separately today as Guennadi has already tested that ..
For 3.13:
- First 3 patches from this series (I tried rebase them over your linux-next and didn't found any issue)
- 5 patches from: http://www.gossamer-threads.com/lists/linux/kernel/1781051
- And the rest ~220 patches that I will send soon (Will rebase them over all above
patches)..
Thanks.
Viresh