ARM: ux500:mach-ux500/cpuidle.c spinlock dis-matching
Subsystems (3)
PATCH 1/1 ARM: ux500:mach-ux500/cpuidle.c spinlock dis-matching
Hi Daniel,
I think we must unlock the master spinlock evenprcmu_gic_decouple function now always return 0.
Could you give some infos about this?
Thanks.
arch/arm/mach-ux500/cpuidle.c +6 -2
@@ -29,6 +29,7 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev, {int this_cpu =smp_processor_id ();bool recouple = false; +bool locked = false;clockevents_notify (CLOCK_EVT_NOTIFY_BROADCAST_ENTER , &this_cpu);
@@ -39,6 +40,8 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev,if (!spin_trylock (&master_lock)) goto wfi; + locked = true; +/* decouple the gic from the A9 cores */ if (prcmu_gic_decouple ()) goto out;
@@ -76,7 +79,7 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev,/* When we switch to retention, the prcmu is in charge * of recoupling the gic automatically */ recouple = false; - + locked = false;spin_unlock (&master_lock); } wfi:
@@ -86,7 +89,8 @@ out:if (recouple) {prcmu_gic_recouple (); -spin_unlock (&master_lock); +if (locked) +spin_unlock (&master_lock); }clockevents_notify (CLOCK_EVT_NOTIFY_BROADCAST_EXIT , &this_cpu);
Steve Zhan
PATCH 1/1 ARM: ux500:mach-ux500/cpuidle.c spinlock dis-matching
Update modify.
arch/arm/mach-ux500/cpuidle.c +7 -3
@@ -29,6 +29,7 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev, {int this_cpu =smp_processor_id ();bool recouple = false; +bool locked = false;clockevents_notify (CLOCK_EVT_NOTIFY_BROADCAST_ENTER , &this_cpu);
@@ -39,6 +40,8 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev,if (!spin_trylock (&master_lock)) goto wfi; + locked = true; +/* decouple the gic from the A9 cores */ if (prcmu_gic_decouple ()) goto out;
@@ -76,7 +79,7 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev,/* When we switch to retention, the prcmu is in charge * of recoupling the gic automatically */ recouple = false; - + locked = false;spin_unlock (&master_lock); } wfi:
@@ -84,10 +87,11 @@ wfi: out:atomic_dec (&master); -if (recouple) { +if (recouple)prcmu_gic_recouple (); + +if (locked)spin_unlock (&master_lock); - }clockevents_notify (CLOCK_EVT_NOTIFY_BROADCAST_EXIT , &this_cpu);
======
steve.
2012/12/28, steve.zhan <[email protected]>:
Quoted 55 lines
Hi Daniel,
I think we must unlock the master spinlock even
prcmu_gic_decouplefunction now always return 0.
Could you give some infos about this?
Thanks.arch/arm/mach-ux500/cpuidle.c +3
-0@@ -29,6 +29,7 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev, {int this_cpu =smp_processor_id ();bool recouple = false; +bool locked = false;clockevents_notify (CLOCK_EVT_NOTIFY_BROADCAST_ENTER , &this_cpu);@@ -39,6 +40,8 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev, if (!spin_trylock(&master_lock)) goto wfi; + locked = true; +/* decouple the gic from the A9 cores */ if (prcmu_gic_decouple ())goto out;arch/arm/mach-ux500/cpuidle.c +1
-1@@ -76,7 +79,7 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev,/* When we switch to retention, the prcmu is in charge * of recoupling the gic automatically */ recouple = false; - + locked = false;spin_unlock (&master_lock); }wfi:
arch/arm/mach-ux500/cpuidle.c +2
-1@@ -86,7 +89,8 @@ out:if (recouple) {prcmu_gic_recouple (); -spin_unlock (&master_lock); +if (locked) +spin_unlock (&master_lock); }clockevents_notify (CLOCK_EVT_NOTIFY_BROADCAST_EXIT , &this_cpu);Steve Zhan
Signature · 1 line
Steve Zhan
PATCH 1/1 ARM: ux500:mach-ux500/cpuidle.c spinlock dis-matching
In reply to steve.zhanHi all,
Is this not bug?
steve.
2012/12/28, steve.zhan <[email protected]>:
Quoted 55 lines
Hi Daniel,
I think we must unlock the master spinlock even
prcmu_gic_decouplefunction now always return 0.
Could you give some infos about this?
Thanks.arch/arm/mach-ux500/cpuidle.c +3
-0@@ -29,6 +29,7 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev, {int this_cpu =smp_processor_id ();bool recouple = false; +bool locked = false;clockevents_notify (CLOCK_EVT_NOTIFY_BROADCAST_ENTER , &this_cpu);@@ -39,6 +40,8 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev, if (!spin_trylock(&master_lock)) goto wfi; + locked = true; +/* decouple the gic from the A9 cores */ if (prcmu_gic_decouple ())goto out;arch/arm/mach-ux500/cpuidle.c +1
-1@@ -76,7 +79,7 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev,/* When we switch to retention, the prcmu is in charge * of recoupling the gic automatically */ recouple = false; - + locked = false;spin_unlock (&master_lock); }wfi:
arch/arm/mach-ux500/cpuidle.c +2
-1@@ -86,7 +89,8 @@ out:if (recouple) {prcmu_gic_recouple (); -spin_unlock (&master_lock); +if (locked) +spin_unlock (&master_lock); }clockevents_notify (CLOCK_EVT_NOTIFY_BROADCAST_EXIT , &this_cpu);Steve Zhan
Signature · 1 line
Steve Zhan
PATCH 1/1 ARM: ux500:mach-ux500/cpuidle.c spinlock dis-matching
In reply to steve.zhanQuoted 1 line · steve.zhan
Hi Daniel,
Hi Steve,
sorry I missed your email.
Quoted 4 lines
I think we must unlock the master spinlock even
prcmu_gic_decouplefunction now always return 0.
Could you give some infos about this?
I agree, that would be cleaner.
AFAICS, your patch does not solve the problem because 'recouple' will be false if prcmu_gic_decouple fails, so the lock will never be release.
That will be simpler to do:
if (prcmu_gic_decouple()) {
spin_unlock(&master);
goto out;
}no ?
Quoted 47 lines
Thanks.
arch/arm/mach-ux500/cpuidle.c +6
-2@@ -29,6 +29,7 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev, {int this_cpu =smp_processor_id ();bool recouple = false; +bool locked = false;clockevents_notify (CLOCK_EVT_NOTIFY_BROADCAST_ENTER , &this_cpu);@@ -39,6 +40,8 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev,if (!spin_trylock (&master_lock)) goto wfi; + locked = true; +/* decouple the gic from the A9 cores */ if (prcmu_gic_decouple ()) goto out;@@ -76,7 +79,7 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev,/* When we switch to retention, the prcmu is in charge * of recoupling the gic automatically */ recouple = false; - + locked = false;spin_unlock (&master_lock); } wfi:@@ -86,7 +89,8 @@ out:if (recouple) {prcmu_gic_recouple (); -spin_unlock (&master_lock); +if (locked) +spin_unlock (&master_lock); }clockevents_notify (CLOCK_EVT_NOTIFY_BROADCAST_EXIT , &this_cpu);Steve Zhan
Signature · 5 lines
<http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
PATCH 1/1 ARM: ux500:mach-ux500/cpuidle.c spinlock dis-matching
Hi Daniel,
Happy new year, Thank you for reply.
Sorry for that i have refer the old patch email.
I have updated the patch, Pls check the URL:
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-December/138939.html
Now i am using gmail GUI tools to send mail, i will switch email tool to MUTT to commit the other patchs in the future.
--------------
steve.zhan
2013/1/7, Daniel Lezcano <[email protected]>:
Quoted 87 lines · steve.zhan
Quoted 1 line
Hi Daniel,
Hi Steve,
sorry I missed your email.
Quoted 4 lines
I think we must unlock the master spinlock even
prcmu_gic_decouplefunction now always return 0.
Could you give some infos about this?I agree, that would be cleaner.
AFAICS, your patch does not solve the problem because 'recouple' will be false if
prcmu_gic_decouplefails, so the lock will never be release.That will be simpler to do:
if (prcmu_gic_decouple()) { spin_unlock(&master); goto out; }no ?
Quoted 49 lines
Thanks.
arch/arm/mach-ux500/cpuidle.c +3
-0@@ -29,6 +29,7 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev, {int this_cpu =smp_processor_id ();bool recouple = false; +bool locked = false;clockevents_notify (CLOCK_EVT_NOTIFY_BROADCAST_ENTER , &this_cpu);@@ -39,6 +40,8 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev, if (!spin_trylock(&master_lock)) goto wfi; + locked = true; +/* decouple the gic from the A9 cores */ if (prcmu_gic_decouple ())goto out;arch/arm/mach-ux500/cpuidle.c +1
-1@@ -76,7 +79,7 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev,/* When we switch to retention, the prcmu is in charge * of recoupling the gic automatically */ recouple = false; - + locked = false;spin_unlock (&master_lock); }wfi:
arch/arm/mach-ux500/cpuidle.c +2
-1@@ -86,7 +89,8 @@ out:if (recouple) {prcmu_gic_recouple (); -spin_unlock (&master_lock); +if (locked) +spin_unlock (&master_lock); }clockevents_notify (CLOCK_EVT_NOTIFY_BROADCAST_EXIT , &this_cpu);Quoted 2 lines
Steve Zhan
--
<http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCsFollow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
Signature · 1 line
Steve Zhan
PATCH 1/1 ARM: ux500:mach-ux500/cpuidle.c spinlock dis-matching
Quoted 8 lines · steve.zhan
Hi Daniel,
Happy new year, Thank you for reply.
Sorry for that i have refer the old patch email.
I have updated the patch, Pls check the URL:
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-December/138939.html
Now i am using gmail GUI tools to send mail, i will switch email tool to MUTT to commit the other patchs in the future.
Ok.
Please do not introduce a new variable which is at the end pointless and add more complexity.
You can simply remove the if statement for prcmu_gic_decouple(), or unlock if it fails.
Thanks
-- Daniel
Quoted 93 lines
--------------
steve.zhan2013/1/7, Daniel Lezcano <[email protected]>:
Quoted 87 lines · steve.zhan
Quoted 1 line
Hi Daniel,
Hi Steve,
sorry I missed your email.
Quoted 4 lines
I think we must unlock the master spinlock even
prcmu_gic_decouplefunction now always return 0.
Could you give some infos about this?I agree, that would be cleaner.
AFAICS, your patch does not solve the problem because 'recouple' will be false if
prcmu_gic_decouplefails, so the lock will never be release.That will be simpler to do:
if (prcmu_gic_decouple()) { spin_unlock(&master); goto out; }no ?
Quoted 49 lines
Thanks.
arch/arm/mach-ux500/cpuidle.c +3
-0@@ -29,6 +29,7 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev, {int this_cpu =smp_processor_id ();bool recouple = false; +bool locked = false;clockevents_notify (CLOCK_EVT_NOTIFY_BROADCAST_ENTER , &this_cpu);@@ -39,6 +40,8 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev, if (!spin_trylock(&master_lock)) goto wfi; + locked = true; +/* decouple the gic from the A9 cores */ if (prcmu_gic_decouple ())goto out;arch/arm/mach-ux500/cpuidle.c +1
-1@@ -76,7 +79,7 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev,/* When we switch to retention, the prcmu is in charge * of recoupling the gic automatically */ recouple = false; - + locked = false;spin_unlock (&master_lock); }wfi:
arch/arm/mach-ux500/cpuidle.c +2
-1@@ -86,7 +89,8 @@ out:if (recouple) {prcmu_gic_recouple (); -spin_unlock (&master_lock); +if (locked) +spin_unlock (&master_lock); }clockevents_notify (CLOCK_EVT_NOTIFY_BROADCAST_EXIT , &this_cpu);Quoted 2 lines
Steve Zhan
--
<http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCsFollow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
Signature · 5 lines
<http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
PATCH 1/1 ARM: ux500:mach-ux500/cpuidle.c spinlock dis-matching
Hi Daniel,
Thank you.
commit 99d0a05d163bd070eba7caab7e772206edbcbbc9
Author: steve.zhan <[email protected]> Date: Mon Jan 7 18:19:14 2013 +0800
ARM: ux500: add spin_unlock(&master_lock).
Add the missing spin_unlock statement to unlock master_lock when prcmu_gic_decouple() return TRUE
arch/arm/mach-ux500/cpuidle.c +0 -0
@@ -40,8 +40,10 @@ static inline int ux500_enter_idle(struct
cpuidle_device *dev,
goto wfi;
/* decouple the gic from the A9 cores */
- if (prcmu_gic_decouple())
+ if (prcmu_gic_decouple()) {
+ spin_unlock(&master_lock);
goto out;+ }
/* If an error occur, we will have to recouple the gic
* manually */
-------------
steve zhan
2013/1/7 Daniel Lezcano <[email protected]>:
Quoted 123 lines · steve.zhan
Quoted 8 lines
Hi Daniel,
Happy new year, Thank you for reply.
Sorry for that i have refer the old patch email.
I have updated the patch, Pls check the URL:
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-December/138939.html
Now i am using gmail GUI tools to send mail, i will switch email tool to MUTT to commit the other patchs in the future.Ok.
Please do not introduce a new variable which is at the end pointless and add more complexity.
You can simply remove the if statement for
prcmu_gic_decouple(), or unlock if it fails.Thanks
-- DanielQuoted 93 lines
--------------
steve.zhan2013/1/7, Daniel Lezcano <[email protected]>:
Quoted 87 lines · steve.zhan
Quoted 1 line
Hi Daniel,
Hi Steve,
sorry I missed your email.
Quoted 4 lines
I think we must unlock the master spinlock even
prcmu_gic_decouplefunction now always return 0.
Could you give some infos about this?I agree, that would be cleaner.
AFAICS, your patch does not solve the problem because 'recouple' will be false if
prcmu_gic_decouplefails, so the lock will never be release.That will be simpler to do:
if (prcmu_gic_decouple()) { spin_unlock(&master); goto out; }no ?
Quoted 49 lines
Thanks.
arch/arm/mach-ux500/cpuidle.c +3
-0@@ -29,6 +29,7 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev, {int this_cpu =smp_processor_id ();bool recouple = false; +bool locked = false;clockevents_notify (CLOCK_EVT_NOTIFY_BROADCAST_ENTER , &this_cpu);@@ -39,6 +40,8 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev, if (!spin_trylock(&master_lock)) goto wfi; + locked = true; +/* decouple the gic from the A9 cores */ if (prcmu_gic_decouple ())goto out;arch/arm/mach-ux500/cpuidle.c +1
-1@@ -76,7 +79,7 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev,/* When we switch to retention, the prcmu is in charge * of recoupling the gic automatically */ recouple = false; - + locked = false;spin_unlock (&master_lock); }wfi:
arch/arm/mach-ux500/cpuidle.c +2
-1@@ -86,7 +89,8 @@ out:if (recouple) {prcmu_gic_recouple (); -spin_unlock (&master_lock); +if (locked) +spin_unlock (&master_lock); }clockevents_notify (CLOCK_EVT_NOTIFY_BROADCAST_EXIT , &this_cpu);Quoted 2 lines
Steve Zhan
--
<http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCsFollow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog--
<http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCsFollow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
Signature · 1 line
Steve Zhan