diff mbox

clk: ti: omap3+: dpll: use non-locking version of clk_get_rate

Message ID 1453981067-8618-1-git-send-email-t-kristo@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tero Kristo Jan. 28, 2016, 11:37 a.m. UTC
As the code in this file is being executed within irq context in some
cases, we must avoid the clk_get_rate which uses mutex internally.
Switch the code to use clk_hw_get_rate instead which is non-locking.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
 drivers/clk/ti/dpll3xxx.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Tero Kristo Jan. 28, 2016, 11:43 a.m. UTC | #1
On 01/28/2016 01:37 PM, Tero Kristo wrote:
> As the code in this file is being executed within irq context in some
> cases, we must avoid the clk_get_rate which uses mutex internally.
> Switch the code to use clk_hw_get_rate instead which is non-locking.
>
> Signed-off-by: Tero Kristo <t-kristo@ti.com>

Ooops, sorry. Sent wrong version (read: old) of this patch, please 
ignore this one. Will re-send the correct version in a bit.

-Tero

> ---
>   drivers/clk/ti/dpll3xxx.c |    3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/ti/dpll3xxx.c b/drivers/clk/ti/dpll3xxx.c
> index f4dec00..7ed24bc 100644
> --- a/drivers/clk/ti/dpll3xxx.c
> +++ b/drivers/clk/ti/dpll3xxx.c
> @@ -437,7 +437,8 @@ int omap3_noncore_dpll_enable(struct clk_hw *hw)
>
>   	parent = clk_hw_get_parent(hw);
>
> -	if (clk_hw_get_rate(hw) == clk_get_rate(dd->clk_bypass)) {
> +	if (clk_hw_get_rate(hw) ==
> +	    clk_hw_get_rate(__clk_get_hw(dd->clk_bypass))) {
>   		WARN_ON(parent != __clk_get_hw(dd->clk_bypass));
>   		r = _omap3_noncore_dpll_bypass(clk);
>   	} else {
>
Tony Lindgren Jan. 28, 2016, 5:22 p.m. UTC | #2
* Tero Kristo <t-kristo@ti.com> [160128 03:44]:
> On 01/28/2016 01:37 PM, Tero Kristo wrote:
> >As the code in this file is being executed within irq context in some
> >cases, we must avoid the clk_get_rate which uses mutex internally.
> >Switch the code to use clk_hw_get_rate instead which is non-locking.
> >
> >Signed-off-by: Tero Kristo <t-kristo@ti.com>
> 
> Ooops, sorry. Sent wrong version (read: old) of this patch, please ignore
> this one. Will re-send the correct version in a bit.

I think this is still needed as a fix for -rc cycle with cc: stable
as otherwise we have omap4 and 5 hang if PM runtime is enabled before
a suspend/resume cycle?

Regards,

Tony


> >  drivers/clk/ti/dpll3xxx.c |    3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> >diff --git a/drivers/clk/ti/dpll3xxx.c b/drivers/clk/ti/dpll3xxx.c
> >index f4dec00..7ed24bc 100644
> >--- a/drivers/clk/ti/dpll3xxx.c
> >+++ b/drivers/clk/ti/dpll3xxx.c
> >@@ -437,7 +437,8 @@ int omap3_noncore_dpll_enable(struct clk_hw *hw)
> >
> >  	parent = clk_hw_get_parent(hw);
> >
> >-	if (clk_hw_get_rate(hw) == clk_get_rate(dd->clk_bypass)) {
> >+	if (clk_hw_get_rate(hw) ==
> >+	    clk_hw_get_rate(__clk_get_hw(dd->clk_bypass))) {
> >  		WARN_ON(parent != __clk_get_hw(dd->clk_bypass));
> >  		r = _omap3_noncore_dpll_bypass(clk);
> >  	} else {
> >
>
Tero Kristo Jan. 28, 2016, 6:48 p.m. UTC | #3
On 01/28/2016 07:22 PM, Tony Lindgren wrote:
> * Tero Kristo <t-kristo@ti.com> [160128 03:44]:
>> On 01/28/2016 01:37 PM, Tero Kristo wrote:
>>> As the code in this file is being executed within irq context in some
>>> cases, we must avoid the clk_get_rate which uses mutex internally.
>>> Switch the code to use clk_hw_get_rate instead which is non-locking.
>>>
>>> Signed-off-by: Tero Kristo <t-kristo@ti.com>
>>
>> Ooops, sorry. Sent wrong version (read: old) of this patch, please ignore
>> this one. Will re-send the correct version in a bit.
>
> I think this is still needed as a fix for -rc cycle with cc: stable
> as otherwise we have omap4 and 5 hang if PM runtime is enabled before
> a suspend/resume cycle?

Look at the other patch I sent, it should accomplish the same thing, and 
more.

https://www.spinics.net/lists/linux-clk/msg06094.html

-Tero

>
> Regards,
>
> Tony
>
>
>>>   drivers/clk/ti/dpll3xxx.c |    3 ++-
>>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/clk/ti/dpll3xxx.c b/drivers/clk/ti/dpll3xxx.c
>>> index f4dec00..7ed24bc 100644
>>> --- a/drivers/clk/ti/dpll3xxx.c
>>> +++ b/drivers/clk/ti/dpll3xxx.c
>>> @@ -437,7 +437,8 @@ int omap3_noncore_dpll_enable(struct clk_hw *hw)
>>>
>>>   	parent = clk_hw_get_parent(hw);
>>>
>>> -	if (clk_hw_get_rate(hw) == clk_get_rate(dd->clk_bypass)) {
>>> +	if (clk_hw_get_rate(hw) ==
>>> +	    clk_hw_get_rate(__clk_get_hw(dd->clk_bypass))) {
>>>   		WARN_ON(parent != __clk_get_hw(dd->clk_bypass));
>>>   		r = _omap3_noncore_dpll_bypass(clk);
>>>   	} else {
>>>
>>
Tony Lindgren Jan. 28, 2016, 7 p.m. UTC | #4
* Tero Kristo <t-kristo@ti.com> [160128 10:48]:
> On 01/28/2016 07:22 PM, Tony Lindgren wrote:
> >* Tero Kristo <t-kristo@ti.com> [160128 03:44]:
> >>On 01/28/2016 01:37 PM, Tero Kristo wrote:
> >>>As the code in this file is being executed within irq context in some
> >>>cases, we must avoid the clk_get_rate which uses mutex internally.
> >>>Switch the code to use clk_hw_get_rate instead which is non-locking.
> >>>
> >>>Signed-off-by: Tero Kristo <t-kristo@ti.com>
> >>
> >>Ooops, sorry. Sent wrong version (read: old) of this patch, please ignore
> >>this one. Will re-send the correct version in a bit.
> >
> >I think this is still needed as a fix for -rc cycle with cc: stable
> >as otherwise we have omap4 and 5 hang if PM runtime is enabled before
> >a suspend/resume cycle?
> 
> Look at the other patch I sent, it should accomplish the same thing, and
> more.
> 
> https://www.spinics.net/lists/linux-clk/msg06094.html

Right.. But is that suitable for the -rc cycle with cc stable?

You should also describe the bug it causes in the change log.
Something like:

This fixes an issue where PM runtime will hang the system if
enabled with a serial console before a suspend-resume cycle.

Regards,

Tony
Tero Kristo Jan. 28, 2016, 7:09 p.m. UTC | #5
On 01/28/2016 09:00 PM, Tony Lindgren wrote:
> * Tero Kristo <t-kristo@ti.com> [160128 10:48]:
>> On 01/28/2016 07:22 PM, Tony Lindgren wrote:
>>> * Tero Kristo <t-kristo@ti.com> [160128 03:44]:
>>>> On 01/28/2016 01:37 PM, Tero Kristo wrote:
>>>>> As the code in this file is being executed within irq context in some
>>>>> cases, we must avoid the clk_get_rate which uses mutex internally.
>>>>> Switch the code to use clk_hw_get_rate instead which is non-locking.
>>>>>
>>>>> Signed-off-by: Tero Kristo <t-kristo@ti.com>
>>>>
>>>> Ooops, sorry. Sent wrong version (read: old) of this patch, please ignore
>>>> this one. Will re-send the correct version in a bit.
>>>
>>> I think this is still needed as a fix for -rc cycle with cc: stable
>>> as otherwise we have omap4 and 5 hang if PM runtime is enabled before
>>> a suspend/resume cycle?
>>
>> Look at the other patch I sent, it should accomplish the same thing, and
>> more.
>>
>> https://www.spinics.net/lists/linux-clk/msg06094.html
>
> Right.. But is that suitable for the -rc cycle with cc stable?

Hmm yea, thats a good question, we may need to resurrect this patch 
after all.

> You should also describe the bug it causes in the change log.
> Something like:
>
> This fixes an issue where PM runtime will hang the system if
> enabled with a serial console before a suspend-resume cycle.

Yea I can add this to the desc if we want to keep this version of the patch.

-Tero
Tony Lindgren Jan. 28, 2016, 7:19 p.m. UTC | #6
* Tero Kristo <t-kristo@ti.com> [160128 11:10]:
> On 01/28/2016 09:00 PM, Tony Lindgren wrote:
> >* Tero Kristo <t-kristo@ti.com> [160128 10:48]:
> >>On 01/28/2016 07:22 PM, Tony Lindgren wrote:
> >>>* Tero Kristo <t-kristo@ti.com> [160128 03:44]:
> >>>>On 01/28/2016 01:37 PM, Tero Kristo wrote:
> >>>>>As the code in this file is being executed within irq context in some
> >>>>>cases, we must avoid the clk_get_rate which uses mutex internally.
> >>>>>Switch the code to use clk_hw_get_rate instead which is non-locking.
> >>>>>
> >>>>>Signed-off-by: Tero Kristo <t-kristo@ti.com>
> >>>>
> >>>>Ooops, sorry. Sent wrong version (read: old) of this patch, please ignore
> >>>>this one. Will re-send the correct version in a bit.
> >>>
> >>>I think this is still needed as a fix for -rc cycle with cc: stable
> >>>as otherwise we have omap4 and 5 hang if PM runtime is enabled before
> >>>a suspend/resume cycle?
> >>
> >>Look at the other patch I sent, it should accomplish the same thing, and
> >>more.
> >>
> >>https://www.spinics.net/lists/linux-clk/msg06094.html
> >
> >Right.. But is that suitable for the -rc cycle with cc stable?
> 
> Hmm yea, thats a good question, we may need to resurrect this patch after
> all.

Yes a minimal fix first with cc stable, then the rest of the changes
can be done for v4.6?

> >You should also describe the bug it causes in the change log.
> >Something like:
> >
> >This fixes an issue where PM runtime will hang the system if
> >enabled with a serial console before a suspend-resume cycle.
> 
> Yea I can add this to the desc if we want to keep this version of the patch.

Yes please. It seems the fix should be cc stable for several merge
windows.

Regards,

Tony
Tony Lindgren Feb. 15, 2016, 9:31 p.m. UTC | #7
* Tony Lindgren <tony@atomide.com> [160128 11:20]:
> * Tero Kristo <t-kristo@ti.com> [160128 11:10]:
> > On 01/28/2016 09:00 PM, Tony Lindgren wrote:
> > >* Tero Kristo <t-kristo@ti.com> [160128 10:48]:
> > >>On 01/28/2016 07:22 PM, Tony Lindgren wrote:
> > >>>* Tero Kristo <t-kristo@ti.com> [160128 03:44]:
> > >>>>On 01/28/2016 01:37 PM, Tero Kristo wrote:
> > >>>>>As the code in this file is being executed within irq context in some
> > >>>>>cases, we must avoid the clk_get_rate which uses mutex internally.
> > >>>>>Switch the code to use clk_hw_get_rate instead which is non-locking.
> > >>>>>
> > >>>>>Signed-off-by: Tero Kristo <t-kristo@ti.com>
> > >>>>
> > >>>>Ooops, sorry. Sent wrong version (read: old) of this patch, please ignore
> > >>>>this one. Will re-send the correct version in a bit.
> > >>>
> > >>>I think this is still needed as a fix for -rc cycle with cc: stable
> > >>>as otherwise we have omap4 and 5 hang if PM runtime is enabled before
> > >>>a suspend/resume cycle?
> > >>
> > >>Look at the other patch I sent, it should accomplish the same thing, and
> > >>more.
> > >>
> > >>https://www.spinics.net/lists/linux-clk/msg06094.html
> > >
> > >Right.. But is that suitable for the -rc cycle with cc stable?
> > 
> > Hmm yea, thats a good question, we may need to resurrect this patch after
> > all.
> 
> Yes a minimal fix first with cc stable, then the rest of the changes
> can be done for v4.6?
> 
> > >You should also describe the bug it causes in the change log.
> > >Something like:
> > >
> > >This fixes an issue where PM runtime will hang the system if
> > >enabled with a serial console before a suspend-resume cycle.
> > 
> > Yea I can add this to the desc if we want to keep this version of the patch.
> 
> Yes please. It seems the fix should be cc stable for several merge
> windows.

Tero, what's the status on this one? We have systems hang shortly
after entering init if PM is enabled without this one.

Regards,

Tony
diff mbox

Patch

diff --git a/drivers/clk/ti/dpll3xxx.c b/drivers/clk/ti/dpll3xxx.c
index f4dec00..7ed24bc 100644
--- a/drivers/clk/ti/dpll3xxx.c
+++ b/drivers/clk/ti/dpll3xxx.c
@@ -437,7 +437,8 @@  int omap3_noncore_dpll_enable(struct clk_hw *hw)
 
 	parent = clk_hw_get_parent(hw);
 
-	if (clk_hw_get_rate(hw) == clk_get_rate(dd->clk_bypass)) {
+	if (clk_hw_get_rate(hw) ==
+	    clk_hw_get_rate(__clk_get_hw(dd->clk_bypass))) {
 		WARN_ON(parent != __clk_get_hw(dd->clk_bypass));
 		r = _omap3_noncore_dpll_bypass(clk);
 	} else {