Skip to content

Commit 2bbb681

Browse files
fweisbecpaulmck
authored andcommitted
nohz: Allow rcu extended quiescent state handling seperately from tick stop
It is assumed that rcu won't be used once we switch to tickless mode and until we restart the tick. However this is not always true, as in x86-64 where we dereference the idle notifiers after the tick is stopped. To prepare for fixing this, add two new APIs: tick_nohz_idle_enter_norcu() and tick_nohz_idle_exit_norcu(). If no use of RCU is made in the idle loop between tick_nohz_enter_idle() and tick_nohz_exit_idle() calls, the arch must instead call the new *_norcu() version such that the arch doesn't need to call rcu_idle_enter() and rcu_idle_exit(). Otherwise the arch must call tick_nohz_enter_idle() and tick_nohz_exit_idle() and also call explicitly: - rcu_idle_enter() after its last use of RCU before the CPU is put to sleep. - rcu_idle_exit() before the first use of RCU after the CPU is woken up. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Frysinger <vapier@gentoo.org> Cc: Guan Xuetao <gxt@mprc.pku.edu.cn> Cc: David Miller <davem@davemloft.net> Cc: Chris Metcalf <cmetcalf@tilera.com> Cc: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Russell King <linux@arm.linux.org.uk> Cc: Paul Mackerras <paulus@samba.org> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Paul Mundt <lethal@linux-sh.org> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
1 parent 280f067 commit 2bbb681

18 files changed

Lines changed: 90 additions & 49 deletions

File tree

‎arch/arm/kernel/process.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ void cpu_idle(void)
183183

184184
/* endless idle loop with no priority at all */
185185
while (1) {
186-
tick_nohz_idle_enter();
186+
tick_nohz_idle_enter_norcu();
187187
leds_event(led_idle_start);
188188
while (!need_resched()) {
189189
#ifdef CONFIG_HOTPLUG_CPU
@@ -213,7 +213,7 @@ void cpu_idle(void)
213213
}
214214
}
215215
leds_event(led_idle_end);
216-
tick_nohz_idle_exit();
216+
tick_nohz_idle_exit_norcu();
217217
preempt_enable_no_resched();
218218
schedule();
219219
preempt_disable();

‎arch/avr32/kernel/process.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ void cpu_idle(void)
3434
{
3535
/* endless idle loop with no priority at all */
3636
while (1) {
37-
tick_nohz_idle_enter();
37+
tick_nohz_idle_enter_norcu();
3838
while (!need_resched())
3939
cpu_idle_sleep();
40-
tick_nohz_idle_exit();
40+
tick_nohz_idle_exit_norcu();
4141
preempt_enable_no_resched();
4242
schedule();
4343
preempt_disable();

‎arch/blackfin/kernel/process.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ void cpu_idle(void)
8888
#endif
8989
if (!idle)
9090
idle = default_idle;
91-
tick_nohz_idle_enter();
91+
tick_nohz_idle_enter_norcu();
9292
while (!need_resched())
9393
idle();
94-
tick_nohz_idle_exit();
94+
tick_nohz_idle_exit_norcu();
9595
preempt_enable_no_resched();
9696
schedule();
9797
preempt_disable();

‎arch/microblaze/kernel/process.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ void cpu_idle(void)
103103
if (!idle)
104104
idle = default_idle;
105105

106-
tick_nohz_idle_enter();
106+
tick_nohz_idle_enter_norcu();
107107
while (!need_resched())
108108
idle();
109-
tick_nohz_idle_exit();
109+
tick_nohz_idle_exit_norcu();
110110

111111
preempt_enable_no_resched();
112112
schedule();

‎arch/mips/kernel/process.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void __noreturn cpu_idle(void)
5656

5757
/* endless idle loop with no priority at all */
5858
while (1) {
59-
tick_nohz_idle_enter();
59+
tick_nohz_idle_enter_norcu();
6060
while (!need_resched() && cpu_online(cpu)) {
6161
#ifdef CONFIG_MIPS_MT_SMTC
6262
extern void smtc_idle_loop_hook(void);
@@ -77,7 +77,7 @@ void __noreturn cpu_idle(void)
7777
system_state == SYSTEM_BOOTING))
7878
play_dead();
7979
#endif
80-
tick_nohz_idle_exit();
80+
tick_nohz_idle_exit_norcu();
8181
preempt_enable_no_resched();
8282
schedule();
8383
preempt_disable();

‎arch/openrisc/kernel/idle.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void cpu_idle(void)
5151

5252
/* endless idle loop with no priority at all */
5353
while (1) {
54-
tick_nohz_idle_enter();
54+
tick_nohz_idle_enter_norcu();
5555

5656
while (!need_resched()) {
5757
check_pgt_cache();
@@ -69,7 +69,7 @@ void cpu_idle(void)
6969
set_thread_flag(TIF_POLLING_NRFLAG);
7070
}
7171

72-
tick_nohz_idle_exit();
72+
tick_nohz_idle_exit_norcu();
7373
preempt_enable_no_resched();
7474
schedule();
7575
preempt_disable();

‎arch/powerpc/kernel/idle.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void cpu_idle(void)
5656

5757
set_thread_flag(TIF_POLLING_NRFLAG);
5858
while (1) {
59-
tick_nohz_idle_enter();
59+
tick_nohz_idle_enter_norcu();
6060
while (!need_resched() && !cpu_should_die()) {
6161
ppc64_runlatch_off();
6262

@@ -93,7 +93,7 @@ void cpu_idle(void)
9393

9494
HMT_medium();
9595
ppc64_runlatch_on();
96-
tick_nohz_idle_exit();
96+
tick_nohz_idle_exit_norcu();
9797
preempt_enable_no_resched();
9898
if (cpu_should_die())
9999
cpu_die();

‎arch/powerpc/platforms/iseries/setup.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ static void yield_shared_processor(void)
563563
static void iseries_shared_idle(void)
564564
{
565565
while (1) {
566-
tick_nohz_idle_enter();
566+
tick_nohz_idle_enter_norcu();
567567
while (!need_resched() && !hvlpevent_is_pending()) {
568568
local_irq_disable();
569569
ppc64_runlatch_off();
@@ -577,7 +577,7 @@ static void iseries_shared_idle(void)
577577
}
578578

579579
ppc64_runlatch_on();
580-
tick_nohz_idle_exit();
580+
tick_nohz_idle_exit_norcu();
581581

582582
if (hvlpevent_is_pending())
583583
process_iSeries_events();
@@ -593,7 +593,7 @@ static void iseries_dedicated_idle(void)
593593
set_thread_flag(TIF_POLLING_NRFLAG);
594594

595595
while (1) {
596-
tick_nohz_idle_enter();
596+
tick_nohz_idle_enter_norcu();
597597
if (!need_resched()) {
598598
while (!need_resched()) {
599599
ppc64_runlatch_off();
@@ -610,7 +610,7 @@ static void iseries_dedicated_idle(void)
610610
}
611611

612612
ppc64_runlatch_on();
613-
tick_nohz_idle_exit();
613+
tick_nohz_idle_exit_norcu();
614614
preempt_enable_no_resched();
615615
schedule();
616616
preempt_disable();

‎arch/s390/kernel/process.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ static void default_idle(void)
9191
void cpu_idle(void)
9292
{
9393
for (;;) {
94-
tick_nohz_idle_enter();
94+
tick_nohz_idle_enter_norcu();
9595
while (!need_resched())
9696
default_idle();
97-
tick_nohz_idle_exit();
97+
tick_nohz_idle_exit_norcu();
9898
preempt_enable_no_resched();
9999
schedule();
100100
preempt_disable();

‎arch/sh/kernel/idle.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ void cpu_idle(void)
8989

9090
/* endless idle loop with no priority at all */
9191
while (1) {
92-
tick_nohz_idle_enter();
92+
tick_nohz_idle_enter_norcu();
9393

9494
while (!need_resched()) {
9595
check_pgt_cache();
@@ -111,7 +111,7 @@ void cpu_idle(void)
111111
start_critical_timings();
112112
}
113113

114-
tick_nohz_idle_exit();
114+
tick_nohz_idle_exit_norcu();
115115
preempt_enable_no_resched();
116116
schedule();
117117
preempt_disable();

0 commit comments

Comments
 (0)