Re: [PATCH] clk: fix spin_lock/unlock imbalance on bad clk_enable() reentrancy

2017-12-22 Thread David Lechner
On 12/21/2017 07:39 PM, Stephen Boyd wrote: On 12/20, Stephen Boyd wrote: On 12/20, David Lechner wrote: On 12/20/2017 02:33 PM, David Lechner wrote: So, the question I have is: what is the actual "correct" behavior of spin_trylock_irqsave()? Is it really supposed to always return true when C

Re: [PATCH] clk: fix spin_lock/unlock imbalance on bad clk_enable() reentrancy

2017-12-21 Thread David Lechner
On 12/21/2017 07:39 PM, Stephen Boyd wrote: On 12/20, Stephen Boyd wrote: On 12/20, David Lechner wrote: On 12/20/2017 02:33 PM, David Lechner wrote: So, the question I have is: what is the actual "correct" behavior of spin_trylock_irqsave()? Is it really supposed to always return true when C

Re: [PATCH] clk: fix spin_lock/unlock imbalance on bad clk_enable() reentrancy

2017-12-21 Thread Stephen Boyd
On 12/20, Stephen Boyd wrote: > On 12/20, David Lechner wrote: > > On 12/20/2017 02:33 PM, David Lechner wrote: > > > > > > So, the question I have is: what is the actual "correct" behavior of > > spin_trylock_irqsave()? Is it really supposed to always return true > > when CONFIG_DEBUG_SPINLOCK=n

Re: [PATCH] clk: fix spin_lock/unlock imbalance on bad clk_enable() reentrancy

2017-12-20 Thread Stephen Boyd
On 12/20, David Lechner wrote: > On 12/20/2017 02:33 PM, David Lechner wrote: > > > >So, as you can see, we get 4 warnings here. There is no problem > >with any clock provider or consumer (as far as I can tell). The > >bug here is that spin_trylock_irqsave() always returns true on > >non-SMP system

Re: [PATCH] clk: fix spin_lock/unlock imbalance on bad clk_enable() reentrancy

2017-12-20 Thread David Lechner
On 12/20/2017 02:33 PM, David Lechner wrote: So, as you can see, we get 4 warnings here. There is no problem with any clock provider or consumer (as far as I can tell). The bug here is that spin_trylock_irqsave() always returns true on non-SMP systems, which messes up the reference counting.

Re: [PATCH] clk: fix spin_lock/unlock imbalance on bad clk_enable() reentrancy

2017-12-20 Thread David Lechner
On 12/20/2017 01:24 PM, Michael Turquette wrote: Quoting David Lechner (2017-12-20 10:53:27) On 12/19/2017 04:29 PM, Michael Turquette wrote: Hi David, Quoting David Lechner (2017-12-15 08:29:56) On 12/12/2017 10:14 PM, David Lechner wrote: On 12/12/2017 05:43 PM, David Lechner wrote: If cl

Re: [PATCH] clk: fix spin_lock/unlock imbalance on bad clk_enable() reentrancy

2017-12-20 Thread Michael Turquette
Quoting David Lechner (2017-12-20 10:53:27) > On 12/19/2017 04:29 PM, Michael Turquette wrote: > > Hi David, > > > > Quoting David Lechner (2017-12-15 08:29:56) > >> On 12/12/2017 10:14 PM, David Lechner wrote: > >>> On 12/12/2017 05:43 PM, David Lechner wrote: > If clk_enable() is called in

Re: [PATCH] clk: fix spin_lock/unlock imbalance on bad clk_enable() reentrancy

2017-12-20 Thread David Lechner
On 12/19/2017 04:29 PM, Michael Turquette wrote: Hi David, Quoting David Lechner (2017-12-15 08:29:56) On 12/12/2017 10:14 PM, David Lechner wrote: On 12/12/2017 05:43 PM, David Lechner wrote: If clk_enable() is called in reentrant way and spin_trylock_irqsave() is not working as expected, it

Re: [PATCH] clk: fix spin_lock/unlock imbalance on bad clk_enable() reentrancy

2017-12-20 Thread Michael Turquette
Hi David, Quoting David Lechner (2017-12-15 08:29:56) > On 12/12/2017 10:14 PM, David Lechner wrote: > > On 12/12/2017 05:43 PM, David Lechner wrote: > >> If clk_enable() is called in reentrant way and spin_trylock_irqsave() is > >> not working as expected, it is possible to get a negative enable_

Re: [PATCH] clk: fix spin_lock/unlock imbalance on bad clk_enable() reentrancy

2017-12-15 Thread David Lechner
On 12/12/2017 10:14 PM, David Lechner wrote: On 12/12/2017 05:43 PM, David Lechner wrote: If clk_enable() is called in reentrant way and spin_trylock_irqsave() is not working as expected, it is possible to get a negative enable_refcnt which results in a missed call to spin_unlock_irqrestore().

Re: [PATCH] clk: fix spin_lock/unlock imbalance on bad clk_enable() reentrancy

2017-12-15 Thread David Lechner
On 12/15/2017 07:47 AM, Jerome Brunet wrote: On Tue, 2017-12-12 at 22:14 -0600, David Lechner wrote: On 12/12/2017 05:43 PM, David Lechner wrote: If clk_enable() is called in reentrant way and spin_trylock_irqsave() is not working as expected, it is possible to get a negative enable_refcnt whic

Re: [PATCH] clk: fix spin_lock/unlock imbalance on bad clk_enable() reentrancy

2017-12-15 Thread Jerome Brunet
On Tue, 2017-12-12 at 22:14 -0600, David Lechner wrote: > On 12/12/2017 05:43 PM, David Lechner wrote: > > If clk_enable() is called in reentrant way and spin_trylock_irqsave() is > > not working as expected, it is possible to get a negative enable_refcnt > > which results in a missed call to spin_

Re: [PATCH] clk: fix spin_lock/unlock imbalance on bad clk_enable() reentrancy

2017-12-12 Thread David Lechner
On 12/12/2017 05:43 PM, David Lechner wrote: If clk_enable() is called in reentrant way and spin_trylock_irqsave() is not working as expected, it is possible to get a negative enable_refcnt which results in a missed call to spin_unlock_irqrestore(). It works like this: 1. clk_enable() is called

[PATCH] clk: fix spin_lock/unlock imbalance on bad clk_enable() reentrancy

2017-12-12 Thread David Lechner
If clk_enable() is called in reentrant way and spin_trylock_irqsave() is not working as expected, it is possible to get a negative enable_refcnt which results in a missed call to spin_unlock_irqrestore(). It works like this: 1. clk_enable() is called. 2. clk_enable_unlock() calls spin_trylock_irq