History

rcu: Fix stall-warning deadlock due to non-release of rcu_node ->lock

If rcu_print_task_stall() is invoked on an rcu_node structure that does not contain any tasks blocking the current grace period, it takes an early exit that fails to release that rcu_node structure's lock. This results in a self-deadlock, which is detected by lockdep. To reproduce this bug: tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --duration 3 --trust-make --configs "TREE03" --kconfig "CONFIG_PROVE_LOCKING=y" --bootargs "rcutorture.stall_cpu=30 rcutorture.stall_cpu_block=1 rcutorture.fwd_progress=0 rcutorture.test_boost=0" This will also result in other complaints, including RCU's scheduler hook complaining about blocking rather than preemption and an rcutorture writer stall. Only a partial RCU CPU stall warning message will be printed because of the self-deadlock. This commit therefore releases the lock on the rcu_print_task_stall() function's early exit path.

Yanfei Xu committed 5 years ago

Commit dc877401 parent e6a901a1 file · +3 −1Browse files

Unified · Split

kernel/rcu/tree_stall.h+3−1
@@ -267,8 +267,10 @@ static int rcu_print_task_stall(struct rcu_node *rnp, unsigned long flags) · 266 unmodified lines
267 struct task_struct *ts[8];267 struct task_struct *ts[8];
268 268
269 lockdep_assert_irqs_disabled();269 lockdep_assert_irqs_disabled();
270 if (!rcu_preempt_blocked_readers_cgp(rnp))270 if (!rcu_preempt_blocked_readers_cgp(rnp)) {
271 raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
271 return 0;272 return 0;
273 }
272 pr_err("\tTasks blocked on level-%d rcu_node (CPUs %d-%d):",274 pr_err("\tTasks blocked on level-%d rcu_node (CPUs %d-%d):",
273 rnp->level, rnp->grplo, rnp->grphi);275 rnp->level, rnp->grplo, rnp->grphi);
274 t = list_entry(rnp->gp_tasks->prev,276 t = list_entry(rnp->gp_tasks->prev,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t