Skip to content

Commit ae0afb4

Browse files
committed
suspend-to-idle: Prevent RCU from complaining about tick_freeze()
Put tick_freeze() under RCU_NONIDLE() to prevent RCU from complaining about suspicious RCU usage in idle by trace_suspend_resume() called from there. While at it, fix a comment related to another usage of RCU_NONIDLE() in enter_freeze_proper(). Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
1 parent d770e55 commit ae0afb4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/cpuidle/cpuidle.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,12 @@ int cpuidle_find_deepest_state(struct cpuidle_driver *drv,
112112
static void enter_freeze_proper(struct cpuidle_driver *drv,
113113
struct cpuidle_device *dev, int index)
114114
{
115-
tick_freeze();
115+
/*
116+
* trace_suspend_resume() called by tick_freeze() for the last CPU
117+
* executing it contains RCU usage regarded as invalid in the idle
118+
* context, so tell RCU about that.
119+
*/
120+
RCU_NONIDLE(tick_freeze());
116121
/*
117122
* The state used here cannot be a "coupled" one, because the "coupled"
118123
* cpuidle mechanism enables interrupts and doing that with timekeeping
@@ -122,7 +127,7 @@ static void enter_freeze_proper(struct cpuidle_driver *drv,
122127
WARN_ON(!irqs_disabled());
123128
/*
124129
* timekeeping_resume() that will be called by tick_unfreeze() for the
125-
* last CPU executing it calls functions containing RCU read-side
130+
* first CPU executing it calls functions containing RCU read-side
126131
* critical sections, so tell RCU about that.
127132
*/
128133
RCU_NONIDLE(tick_unfreeze());

0 commit comments

Comments
 (0)