sched: fix the endless sync_sched/rcu() inside _cpu_down()
PATCH 1/1 sched: fix the endless sync_sched/rcu() inside _cpu_down()
Commit 6acce3ef8:
sched: Remove get_online_cpus() usage
try to do sync_sched/rcu() inside _cpu_down() but trigger:
INFO: task swapper/0:1 blocked for more than 120 seconds. ... [<ffffffff811263dc>] synchronize_rcu+0x2c/0x30 [<ffffffff81d1bd82>] _cpu_down+0x2b2/0x340 ...
It was caused by that in rcu boost case, we rely on smpboot thread to finish the rcu callback, which has already parked before sync in here and lead to the endless sync_sched/rcu().
This patch exchange the sequence of smpboot_park_threads() and sync_sched/rcu() to fix the BUG.
--- kernel/cpu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/cpu.c +4 -1
@@ -306,7 +306,6 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen) __func__, cpu); goto out_release; } -smpboot_park_threads (cpu);/* * By now we've cleared cpu_active_mask, wait for all preempt-disabled
@@ -315,12 +314,16 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)* * For CONFIG_PREEMPT we have preemptible RCU and its sync_rcu() might * not imply sync_sched(), so explicitly call both. +* +* Do sync before park smpboot threads to take care the rcu boost case. */ #ifdef CONFIG_PREEMPT synchronize_sched ();#endif synchronize_rcu (); +smpboot_park_threads (cpu); +/* * So now all preempt/rcu users must observe !cpu_active(). */
Signature · 1 line
1.7.9.5
tip-bot for Michael wang
merge bot[tip:sched/urgent] sched: Fix endless sync_sched/rcu() loop inside _cpu_down()
sched: Fix endless sync_sched/rcu() loop inside _cpu_down()
Commit-ID: 106dd5afde3cd10db7e1370b6ddc77f0b2496a75 Gitweb: http://git.kernel.org/tip/106dd5afde3cd10db7e1370b6ddc77f0b2496a75 Author: Michael wang <[email protected]> AuthorDate: Wed, 13 Nov 2013 11:10:56 +0800 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 13 Nov 2013 13:33:50 +0100
sched: Fix endless sync_sched/rcu() loop inside _cpu_down()
Commit 6acce3ef8:
sched: Remove get_online_cpus() usage
tries to do sync_sched/rcu() inside _cpu_down() but triggers:
INFO: task swapper/0:1 blocked for more than 120 seconds. ... [<ffffffff811263dc>] synchronize_rcu+0x2c/0x30 [<ffffffff81d1bd82>] _cpu_down+0x2b2/0x340 ...
It was caused by that in the rcu boost case we rely on smpboot thread to finish the rcu callback, which has already been parked before sync in here and leads to the endless sync_sched/rcu().
This patch exchanges the sequence of smpboot_park_threads() and sync_sched/rcu() to fix the bug.
--- kernel/cpu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/cpu.c +4 -1
@@ -306,7 +306,6 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen) __func__, cpu); goto out_release; } -smpboot_park_threads (cpu);/* * By now we've cleared cpu_active_mask, wait for all preempt-disabled
@@ -315,12 +314,16 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)* * For CONFIG_PREEMPT we have preemptible RCU and its sync_rcu() might * not imply sync_sched(), so explicitly call both. +* +* Do sync before park smpboot threads to take care the rcu boost case. */ #ifdef CONFIG_PREEMPT synchronize_sched ();#endif synchronize_rcu (); +smpboot_park_threads (cpu); +/* * So now all preempt/rcu users must observe !cpu_active(). */