diff mbox

cpuidle: fix broadcast control when broadcast can not be entered

Message ID 20170901042956.29594-1-npiggin@gmail.com (mailing list archive)
State Mainlined
Delegated to: Rafael Wysocki
Headers show

Commit Message

Nicholas Piggin Sept. 1, 2017, 4:29 a.m. UTC
When failing to enter broadcast timer mode for an idle state that
requires it, a new state is selected that does not require broadcast,
but the broadcast variable remains set. This causes
tick_broadcast_exit to be called despite not having entered broadcast
mode.

This causes the WARN_ON_ONCE(!irqs_disabled()) to trigger in some
cases. It does not appear to cause problems for code today, but seems
to violate the interface so should be fixed.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 drivers/cpuidle/cpuidle.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Thomas Gleixner Sept. 1, 2017, 7:44 a.m. UTC | #1
On Fri, 1 Sep 2017, Nicholas Piggin wrote:

> When failing to enter broadcast timer mode for an idle state that
> requires it, a new state is selected that does not require broadcast,
> but the broadcast variable remains set. This causes
> tick_broadcast_exit to be called despite not having entered broadcast
> mode.
> 
> This causes the WARN_ON_ONCE(!irqs_disabled()) to trigger in some
> cases. It does not appear to cause problems for code today, but seems
> to violate the interface so should be fixed.
> 
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>

> ---
>  drivers/cpuidle/cpuidle.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
> index 60bb64f4329d..4453e27f855e 100644
> --- a/drivers/cpuidle/cpuidle.c
> +++ b/drivers/cpuidle/cpuidle.c
> @@ -208,6 +208,7 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv,
>  			return -EBUSY;
>  		}
>  		target_state = &drv->states[index];
> +		broadcast = false;
>  	}
>  
>  	/* Take note of the planned idle state. */
> -- 
> 2.13.3
> 
>
Rafael J. Wysocki Oct. 3, 2017, 12:31 a.m. UTC | #2
On Fri, Sep 1, 2017 at 9:44 AM, Thomas Gleixner <tglx@linutronix.de> wrote:
> On Fri, 1 Sep 2017, Nicholas Piggin wrote:
>
>> When failing to enter broadcast timer mode for an idle state that
>> requires it, a new state is selected that does not require broadcast,
>> but the broadcast variable remains set. This causes
>> tick_broadcast_exit to be called despite not having entered broadcast
>> mode.
>>
>> This causes the WARN_ON_ONCE(!irqs_disabled()) to trigger in some
>> cases. It does not appear to cause problems for code today, but seems
>> to violate the interface so should be fixed.
>>
>> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
>
> Reviewed-by: Thomas Gleixner <tglx@linutronix.de>

Applied, thanks!
diff mbox

Patch

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 60bb64f4329d..4453e27f855e 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -208,6 +208,7 @@  int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv,
 			return -EBUSY;
 		}
 		target_state = &drv->states[index];
+		broadcast = false;
 	}
 
 	/* Take note of the planned idle state. */